Skip to content

Commit 95d4821

Browse files
committed
Make libpq++ safe again for older C++ compilers. Do 'using namespace std'
only if configure found it was safe to do so; do not assume const_cast is available.
1 parent 9588084 commit 95d4821

File tree

7 files changed

+17
-20
lines changed

7 files changed

+17
-20
lines changed

src/interfaces/libpq++/pgconnection.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgconnection.cc,v 1.11 2001/05/09 17:29:10 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgconnection.cc,v 1.12 2001/09/30 22:30:37 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
1717

1818
#include "pgconnection.h"
1919

20+
#ifdef HAVE_NAMESPACE_STD
2021
using namespace std;
22+
#endif
2123

2224

2325
// ****************************************************************

src/interfaces/libpq++/pgconnection.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1414
* Portions Copyright (c) 1994, Regents of the University of California
1515
*
16-
* $Id: pgconnection.h,v 1.13 2001/08/24 14:07:49 petere Exp $
16+
* $Id: pgconnection.h,v 1.14 2001/09/30 22:30:37 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -96,9 +96,6 @@ class DLLIMPORT PgConnection {
9696
};
9797

9898

99-
#ifdef HAVE_NAMESPACE_STD
10099
#undef PGSTD
101-
#endif
102-
103100

104101
#endif // PGCONNECTION_H

src/interfaces/libpq++/pgcursordb.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgcursordb.cc,v 1.5 2001/05/09 17:29:10 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgcursordb.cc,v 1.6 2001/09/30 22:30:37 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
1717

1818
#include "pgcursordb.h"
1919

20-
20+
#ifdef HAVE_NAMESPACE_STD
2121
using namespace std;
22+
#endif
2223

2324

2425
// ****************************************************************

src/interfaces/libpq++/pgcursordb.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Portions Copyright (c) 1994, Regents of the University of California
1515
*
1616
*
17-
* $Id: pgcursordb.h,v 1.8 2001/07/11 22:12:43 momjian Exp $
17+
* $Id: pgcursordb.h,v 1.9 2001/09/30 22:30:37 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -78,9 +78,7 @@ class DLLIMPORT PgCursor : public PgTransaction {
7878
}; // End PgCursor Class Declaration
7979

8080

81-
#ifdef HAVE_NAMESPACE_STD
8281
#undef PGSTD
83-
#endif
8482

8583
#endif // PGCURSORDB_H
8684

src/interfaces/libpq++/pgdatabase.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.11 2001/05/09 17:46:11 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.12 2001/09/30 22:30:37 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
1717

1818
#include "pgdatabase.h"
1919

20-
20+
#ifdef HAVE_NAMESPACE_STD
2121
using namespace std;
22+
#endif
2223

2324

2425
// OBSOLESCENT (uses PQprint(), which is no longer being maintained)
@@ -33,7 +34,7 @@ void PgDatabase::DisplayTuples(FILE *out,
3334
po.header = printHeader;
3435
po.align = fillAlign;
3536
po.standard = po.html3 = po.expanded = po.pager = 0;
36-
po.fieldSep = const_cast<char *>(fieldSep);
37+
po.fieldSep = (char *) (fieldSep);
3738
po.tableOpt = po.caption = 0;
3839
po.fieldName = 0;
3940

@@ -54,7 +55,7 @@ void PgDatabase::PrintTuples(FILE *out,
5455
po.align = fillAlign;
5556
po.standard = po.html3 = po.expanded = po.pager = 0;
5657
po.tableOpt = po.caption = 0;
57-
po.fieldSep = const_cast<char *>(terseOutput ? "" : "|");
58+
po.fieldSep = (char *) (terseOutput ? "" : "|");
5859
po.fieldName = 0;
5960

6061
PQprint(out,pgResult,&po);

src/interfaces/libpq++/pglobject.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 1994, Regents of the University of California
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.7 2001/05/09 17:29:10 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.8 2001/09/30 22:30:37 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -21,8 +21,9 @@ extern "C" {
2121
#include "libpq/libpq-fs.h"
2222
}
2323

24-
24+
#ifdef HAVE_NAMESPACE_STD
2525
using namespace std;
26+
#endif
2627

2728

2829
// ****************************************************************

src/interfaces/libpq++/pglobject.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
*
14-
* $Id: pglobject.h,v 1.8 2001/07/11 22:12:43 momjian Exp $
14+
* $Id: pglobject.h,v 1.9 2001/09/30 22:30:37 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -68,9 +68,6 @@ class DLLIMPORT PgLargeObject : public PgConnection {
6868
};
6969

7070

71-
#ifdef HAVE_NAMESPACE_STD
7271
#undef PGSTD
73-
#endif
74-
7572

7673
#endif // PGLOBJECT_H

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy