Skip to content

Commit

Permalink
Removed "using namespace std" statements.
Browse files Browse the repository at this point in the history
Removed most of the "using namespace std" statements in DCMTK implementation
files, since these are in general undesirable. This will probably break
builds on a few platforms (such as VS 2008) that will be fixed with a
follow-up commit.
  • Loading branch information
Marco Eichelberg committed Mar 22, 2021
1 parent 58484a6 commit 8f2df23
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 41 deletions.
2 changes: 1 addition & 1 deletion dcmimage/libsrc/diqtfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmimage/diqtfs.h"
#include "dcmtk/ofstd/ofstd.h" /* for OFStandard::myrand_r */
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

BEGIN_EXTERN_C
#include <sys/types.h> // needed for time()
Expand Down
4 changes: 2 additions & 2 deletions dcmimage/libsrc/diqtpbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/ofcast.h"
#include "dcmtk/dcmimage/diqtpbox.h" /* for DcmQuantPixelBoxArray */
#include "dcmtk/ofstd/ofstdinc.h"

// Solaris defines qsort() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE qsort;

BEGIN_EXTERN_C
static int sumcompare(const void *x1, const void *x2)
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/dipijpeg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "dcmtk/dcmdata/dctypes.h"
#include "dcmtk/dcmimgle/diimage.h"
#include "dcmtk/dcmjpeg/dipijpeg.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

BEGIN_EXTERN_C
Expand All @@ -41,8 +41,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DIEIJG8ErrorStruct
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/djdijg12.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "dcmtk/dcmjpeg/djdijg12.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmdata/dcerror.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

// These two macros are re-defined in the IJG header files.
Expand All @@ -48,8 +48,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DJDIJG12ErrorStruct
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/djdijg16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "dcmtk/dcmjpeg/djdijg16.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmdata/dcerror.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

// These two macros are re-defined in the IJG header files.
Expand All @@ -48,8 +48,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DJDIJG16ErrorStruct
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/djdijg8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "dcmtk/dcmjpeg/djdijg8.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmdata/dcerror.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

// These two macros are re-defined in the IJG header files.
Expand All @@ -48,8 +48,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DJDIJG8ErrorStruct
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/djeijg12.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "dcmtk/dcmjpeg/djeijg12.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmdata/dcerror.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

// These two macros are re-defined in the IJG header files.
Expand Down Expand Up @@ -52,8 +52,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DJEIJG12ErrorStruct
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/djeijg16.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "dcmtk/dcmjpeg/djeijg16.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmdata/dcerror.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

// These two macros are re-defined in the IJG header files.
Expand Down Expand Up @@ -52,8 +52,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DJEIJG16ErrorStruct
Expand Down
6 changes: 3 additions & 3 deletions dcmjpeg/libsrc/djeijg8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "dcmtk/dcmjpeg/djeijg8.h"
#include "dcmtk/dcmjpeg/djcparam.h"
#include "dcmtk/dcmdata/dcerror.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <csetjmp>

// These two macros are re-defined in the IJG header files.
Expand Down Expand Up @@ -52,8 +52,8 @@ BEGIN_EXTERN_C
#endif

// Solaris defines longjmp() in namespace std, other compilers don't...
namespace std { }
using namespace std;
using STD_NAMESPACE longjmp;
using STD_NAMESPACE jmp_buf;

// private error handler struct
struct DJEIJG8ErrorStruct
Expand Down
2 changes: 1 addition & 1 deletion dcmnet/apps/storescu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ END_EXTERN_C
#include "dcmtk/dcmdata/dcuid.h" /* for dcmtk version name */
#include "dcmtk/dcmdata/dcostrmz.h" /* for dcmZlibCompressionLevel */
#include "dcmtk/dcmtls/tlsopt.h" /* for DcmTLSOptions */
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

#ifdef ON_THE_FLY_COMPRESSION
#include "dcmtk/dcmjpeg/djdecode.h" /* for JPEG decoders */
Expand Down
2 changes: 1 addition & 1 deletion dcmnet/libsrc/dstorscp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

#include "dcmtk/dcmnet/dstorscp.h"
#include "dcmtk/dcmnet/diutil.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

// constant definitions

Expand Down
2 changes: 1 addition & 1 deletion dcmnet/libsrc/dstorscu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include "dcmtk/dcmdata/dcdatutl.h"
#include "dcmtk/dcmnet/dstorscu.h"
#include "dcmtk/dcmnet/diutil.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

// these are private DIMSE status codes of the class "pending"
#define STATUS_STORE_Pending_NoPresentationContext 0xffff
Expand Down
2 changes: 1 addition & 1 deletion dcmnet/libsrc/dulfsm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ END_EXTERN_C
#endif

#include "dcmtk/ofstd/ofstream.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include "dcmtk/dcmnet/dicom.h"
#include "dcmtk/dcmnet/lst.h"
#include "dcmtk/dcmnet/cond.h"
Expand All @@ -116,7 +117,6 @@ END_EXTERN_C
#include "dcmtk/ofstd/ofsockad.h" /* for class OFSockAddr */
#include <ctime>

using namespace std;

/* At least Solaris doesn't define this */
#ifndef INADDR_NONE
Expand Down
3 changes: 1 addition & 2 deletions dcmqrdb/libsrc/dcmqrdbi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ END_EXTERN_C
#include "dcmtk/dcmqrdb/dcmqrdbi.h"
#include "dcmtk/dcmqrdb/dcmqrcnf.h"
#include "dcmtk/dcmqrdb/dcmqropt.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include "dcmtk/dcmqrdb/dcmqridx.h"
#include "dcmtk/dcmnet/diutil.h"
#include "dcmtk/dcmdata/dcfilefo.h"
#include "dcmtk/dcmdata/dcmatch.h"
#include <ctime>

using namespace std;

/* ========================= static data ========================= */

Expand Down
2 changes: 1 addition & 1 deletion dcmqrdb/libsrc/dcmqrptb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmqrdb/dcmqrptb.h"
#include "dcmtk/dcmqrdb/dcmqropt.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

/** helper class that describes entries in the process slot table. Internal use only.
*/
Expand Down
2 changes: 1 addition & 1 deletion dcmqrdb/libsrc/dcmqrtis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include "dcmtk/dcmqrdb/dcmqrdbs.h"
#include "dcmtk/dcmdata/dcfilefo.h"
#include "dcmtk/dcmqrdb/dcmqropt.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

BEGIN_EXTERN_C
#ifdef HAVE_SYS_STAT_H
Expand Down
2 changes: 1 addition & 1 deletion dcmwlm/libsrc/wlmactmg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
#include "dcmtk/dcmdata/dcdicent.h" // needed by MSVC5 with STL
#include "dcmtk/oflog/internal/env.h"
#include "dcmtk/dcmwlm/wlmactmg.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;


// ----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion ofstd/libsrc/ofdate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/ofdate.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

/*------------------*
* implementation *
Expand Down
2 changes: 1 addition & 1 deletion ofstd/libsrc/ofdatime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ END_EXTERN_C
#endif

#include "dcmtk/ofstd/ofdatime.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

/*------------------*
* implementation *
Expand Down
2 changes: 1 addition & 1 deletion ofstd/libsrc/offname.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#include "dcmtk/ofstd/offname.h"
#include "dcmtk/ofstd/ofcast.h"
#include "dcmtk/ofstd/ofstd.h" /* for OFString::myrand_r */
#include "dcmtk/ofstd/ofstdinc.h"
#include <cerrno>
#include <ctime>

using namespace std;

BEGIN_EXTERN_C
#ifdef HAVE_SYS_TYPES_H
Expand Down
2 changes: 1 addition & 1 deletion ofstd/libsrc/ofrand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include "dcmtk/ofstd/ofrand.h"
#include "dcmtk/ofstd/ofcast.h"
#include "dcmtk/ofstd/ofstd.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

BEGIN_EXTERN_C
#ifdef HAVE_SYS_TIME_H
Expand Down
2 changes: 1 addition & 1 deletion ofstd/libsrc/oftempf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include "dcmtk/ofstd/oftempf.h"
#include "dcmtk/ofstd/offname.h"
#include "dcmtk/ofstd/ofstd.h"
#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

BEGIN_EXTERN_C
#ifdef HAVE_IO_H
Expand Down
3 changes: 1 addition & 2 deletions ofstd/libsrc/oftime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@


#include "dcmtk/config/osconfig.h"

#include "dcmtk/ofstd/ofstdinc.h"
#include <ctime>

using namespace std;

BEGIN_EXTERN_C
#ifdef HAVE_SYS_TIME_H
Expand Down
17 changes: 16 additions & 1 deletion ofstd/libsrc/ofxml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
#endif
// DCMTK: we need this header file at the beginning of each file
#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/ofstdinc.h"

// DCMTK: we need the correct header file (was "xmlParser.h")
#include "dcmtk/ofstd/ofxml.h"
Expand All @@ -120,9 +121,23 @@
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include "dcmtk/ofstd/ofstdinc.h"

using namespace std;
using STD_NAMESPACE free;
using STD_NAMESPACE malloc;
using STD_NAMESPACE FILE;
using STD_NAMESPACE fopen;
using STD_NAMESPACE atoi;
using STD_NAMESPACE fread;
using STD_NAMESPACE atof;
using STD_NAMESPACE fclose;
using STD_NAMESPACE fprintf;
using STD_NAMESPACE realloc;
using STD_NAMESPACE atol;
using STD_NAMESPACE fwrite;
using STD_NAMESPACE fseek;
using STD_NAMESPACE ftell;

#ifdef HAVE_STRINGS_H
BEGIN_EXTERN_C
Expand Down

0 comments on commit 8f2df23

Please sign in to comment.