Skip to content
Commits on Source (5)
......@@ -51,15 +51,15 @@ static bool AnonymizeOneFileDumb(gdcm::Anonymizer &anon, const char *filename, c
reader.SetFileName( filename );
if( !reader.Read() )
{
std::cerr << "Could not read : " << filename << std::endl;
std::cerr << "Could not read : " << filename;
if( continuemode )
{
std::cerr << "Skipping from anonymization process (continue mode)." << std::endl;
std::cerr << " -> Skipping from anonymization process (continue mode)." << std::endl;
return true;
}
else
{
std::cerr << "Check [--continue] option for skipping files." << std::endl;
std::cerr << " -> Check [--continue] option for skipping files." << std::endl;
return false;
}
}
......@@ -611,7 +611,7 @@ int main(int argc, char *argv[])
crypto_factory = gdcm::CryptoFactory::GetFactoryInstance(crypto_lib);
if (!crypto_factory)
{
std::cerr << "Requested cryptoraphic library not configured." << std::endl;
std::cerr << "Requested cryptographic library not configured." << std::endl;
return 1;
}
}
......
......@@ -70,8 +70,12 @@
#include <getopt.h>
#include <string.h>
#ifndef GDCM_HAVE_ATOLL
#ifdef _MSC_VER
#define atoll _atoi64
#else
#define atoll atol
#endif
#endif
static unsigned int readsize(const char *str, unsigned int * size)
......@@ -967,6 +971,7 @@ int main (int argc, char *argv[])
if( gdcm::System::StrCaseCmp(inputextension,".pgm") == 0
|| gdcm::System::StrCaseCmp(inputextension,".pnm") == 0
|| gdcm::System::StrCaseCmp(inputextension,".pbm") == 0
|| gdcm::System::StrCaseCmp(inputextension,".ppm") == 0 )
{
gdcm::PNMCodec pnm;
......@@ -1114,6 +1119,7 @@ int main (int argc, char *argv[])
{
if( gdcm::System::StrCaseCmp(outputextension,".pgm") == 0
|| gdcm::System::StrCaseCmp(outputextension,".pnm") == 0
|| gdcm::System::StrCaseCmp(outputextension,".pbm") == 0
|| gdcm::System::StrCaseCmp(outputextension,".ppm") == 0 )
{
gdcm::PNMCodec pnm;
......
......@@ -258,7 +258,7 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
{
Object obj;
const GooString *s1;
GBool isUnicode;
bool isUnicode;
Unicode u;
char buf[8];
int i, n;
......@@ -274,12 +274,12 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
if ((s1->getChar(0) & 0xff) == 0xfe &&
(s1->getChar(1) & 0xff) == 0xff)
{
isUnicode = gTrue;
isUnicode = true;
i = 2;
}
else
{
isUnicode = gFalse;
isUnicode = false;
i = 0;
}
while (i < obj.getString()->getLength())
......@@ -539,10 +539,10 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
int pages = doc->getNumPages();
const char *encrypted = doc->isEncrypted() ? "yes" : "no";
// printf("yes (print:%s copy:%s change:%s addNotes:%s)\n",
// doc->okToPrint(gTrue) ? "yes" : "no",
// doc->okToCopy(gTrue) ? "yes" : "no",
// doc->okToChange(gTrue) ? "yes" : "no",
// doc->okToAddNotes(gTrue) ? "yes" : "no");
// doc->okToPrint(true) ? "yes" : "no",
// doc->okToCopy(true) ? "yes" : "no",
// doc->okToChange(true) ? "yes" : "no",
// doc->okToAddNotes(true) ? "yes" : "no");
// print linearization info
const char *optimized = doc->isLinearized() ? "yes" : "no";
......
......@@ -102,11 +102,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
return out;
}
static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap, GBool & unicode)
static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uMap, bool & unicode)
{
Object obj;
const GooString *s1;
GBool isUnicode = gFalse;
bool isUnicode = false;
Unicode u;
char buf[8];
int i, n;
......@@ -122,12 +122,12 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
if ((s1->getChar(0) & 0xff) == 0xfe &&
(s1->getChar(1) & 0xff) == 0xff)
{
isUnicode = gTrue;
isUnicode = true;
i = 2;
}
else
{
isUnicode = gFalse;
isUnicode = false;
i = 0;
}
while (i < obj.getString()->getLength())
......@@ -398,7 +398,7 @@ http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx
std::string creationdate;
std::string moddate;
GBool isUnicode = gFalse;
bool isUnicode = false;
if (doc->isOk())
{
#ifdef LIBPOPPLER_NEW_OBJECT_API
......
......@@ -523,7 +523,7 @@ static int MakeImageEnhanced( std::string const & filename, std::string const &o
// construct the target name:
std::string targetname = targetdir;
targetdir += "/old/";
targetdir += "/old";
// make sure the dir exist first:
if( !gdcm::System::MakeDirectory( targetdir.c_str() ) )
......@@ -779,10 +779,10 @@ static int MakeImageEnhanced( std::string const & filename, std::string const &o
if( !unsorted.empty() )
{
std::string targetdir3 = outfilename;
targetdir3 += "/unhandled/";
targetdir3 += "/unhandled";
if( !gdcm::System::MakeDirectory( targetdir3.c_str() ) )
{
std::cerr << "Could not create dir: " << outfilename << std::endl;
std::cerr << "Could not create dir: " << targetdir3 << std::endl;
return 1;
}
std::cerr << "Could not process the following files (please report): " << std::endl;
......
......@@ -43,7 +43,7 @@ set(GDCM_PACKAGE_CONTACT "GDCM Developers <gdcm-developers@lists.sourceforge.net
#----------------------------------------------------------------------------
set(GDCM_MAJOR_VERSION 2)
set(GDCM_MINOR_VERSION 8)
set(GDCM_BUILD_VERSION 8)
set(GDCM_BUILD_VERSION 9)
set(GDCM_VERSION
"${GDCM_MAJOR_VERSION}.${GDCM_MINOR_VERSION}.${GDCM_BUILD_VERSION}")
# let advanced user the option to define GDCM_API_VERSION:
......
......@@ -51,6 +51,10 @@ CHECK_FUNCTION_EXISTS(_snprintf GDCM_HAVE__SNPRINTF)
set(CMAKE_REQUIRED_INCLUDES math.h)
set(CMAKE_REQUIRED_LIBRARIES m)
check_function_exists(lround GDCM_HAVE_LROUND)
set(CMAKE_REQUIRED_INCLUDES stdlib.h)
check_function_exists(atoll GDCM_HAVE_ATOLL)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
#include(CheckSymbolExists)
CHECK_FUNCTION_EXISTS(gettimeofday GDCM_HAVE_GETTIMEOFDAY)
......
......@@ -117,6 +117,7 @@
#cmakedefine GDCM_HAVE__SNPRINTF
#cmakedefine GDCM_HAVE_LROUND
#cmakedefine GDCM_HAVE_GETTIMEOFDAY
#cmakedefine GDCM_HAVE_ATOLL
#cmakedefine GDCM_HAVE_JSON_OBJECT_OBJECT_GET_EX
// MM: I have a feeling that if GDCM_HAVE_WCHAR_IFSTREAM, then UNICODE filename
......
......@@ -158,8 +158,8 @@ bool System::MakeDirectory(const char *path)
bool ok = true;
while(ok && (pos = dir.find('/', pos)) != std::string::npos)
{
topdir = dir.substr(0, pos);
ok = ok && Mkdir(topdir.c_str());
topdir = dir.substr(0, pos+1);
ok = ok && (System::FileIsDirectory(topdir.c_str()) || 0 == Mkdir(topdir.c_str()));
pos++;
}
if( !ok ) return false;
......
......@@ -24,7 +24,8 @@
#include "gdcmDict.h"
#include "gdcmDictEntry.h"
 
namespace gdcm {
namespace {
using namespace gdcm;
typedef struct
{
uint16_t group;
......@@ -13275,6 +13276,9 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0xffff,0xffff,VR::INVALID,VM::VM0,"","",true }, // dummy
{0xffff,0xffff,VR::INVALID,VM::VM0,0,0,true } // Gard
};
} // end anonymous namespace
namespace gdcm {
 
void Dict::LoadDefault()
{
......@@ -24,7 +24,8 @@
#include "gdcmDict.h"
#include "gdcmDictEntry.h"
 
namespace gdcm {
namespace {
using namespace gdcm;
typedef struct
{
uint16_t group;
......@@ -10263,6 +10264,8 @@ static const DICT_ENTRY DICOMV3DataDict [] = {
{0xffff,0xffff,"GDCM Private Sentinel",VR::INVALID,VM::VM0,"",true }, // Dummy invalid element
{0xffff,0xffff,"",VR::INVALID,VM::VM0,0,true } // Gard (will NOT be added)
};
} //end anonymous namespace
namespace gdcm {
 
/*
void Dict::LoadDefault()
......
......@@ -54,8 +54,11 @@ public:
if( TagField != itemStart )
{
// Bug_Siemens_PrivateIconNoItem.dcm
gdcmDebugMacro( "Could be Bug_Siemens_PrivateIconNoItem.dcm" );
throw "SIEMENS Icon thingy";
//gdcmDebugMacro( "Could be Bug_Siemens_PrivateIconNoItem.dcm" );
ParseException pe;
pe.SetLastElement(*this);
//throw "SIEMENS Icon thingy";
throw pe;
}
if( !ValueLengthField.Read<TSwap>(is) )
{
......
......@@ -93,8 +93,8 @@ std::istream& Read(std::istream &is, bool readvalues = true)
template <typename TSwap>
std::istream& ReadPreValue(std::istream &is)
{
//if( SequenceLengthField.IsUndefined() )
// First item is the basic offset table:
#if 0
try
{
Table.Read<TSwap>(is);
......@@ -125,6 +125,10 @@ std::istream& ReadPreValue(std::istream &is)
//assert(0);
}
}
#else
Table.Read<TSwap>(is);
gdcmDebugMacro( "Table: " << Table );
#endif
return is;
}
......
......@@ -108,7 +108,7 @@ bool Writer::Write()
return false;
}
return true;//os;
return !os.fail();
}
try
......@@ -159,7 +159,7 @@ bool Writer::Write()
Ofstream->close();
}
return true;
return !os.fail();
}
void Writer::SetFileName(const char *filename)
......
......@@ -285,8 +285,11 @@ unsigned long Bitmap::GetBufferLength() const
else if( PF == PixelFormat::SINGLEBIT )
{
assert( PF.GetSamplesPerPixel() == 1 );
unsigned int save = mul;
save /= 8;
const size_t bytesPerRow = Dimensions[0] / 8 + (Dimensions[0] % 8 != 0 ? 1 : 0);
unsigned int save = bytesPerRow * Dimensions[1];
if( NumberOfDimensions > 2 )
save *= Dimensions[2];
if(Dimensions[0] % 8 == 0 )
assert( save * 8 == mul );
mul = save;
}
......
......@@ -18,4 +18,8 @@
#include <setjmp.h>
#define JPEGBITSCodec JPEG12Codec
#include "gdcmJPEGBITSCodec.cxx"
#define my_error_mgr my_error_mgr_12BIT
#define JPEGInternals JPEGInternals_12BIT
#define my_source_mgr my_source_mgr_12BIT
#define my_destination_mgr my_destination_mgr_12BIT
#include "gdcmJPEGBITSCodec.hxx"
......@@ -19,7 +19,7 @@
namespace gdcm
{
class JPEGInternals;
class JPEGInternals_12BIT;
class ByteValue;
/**
* \brief Class to do JPEG 12bits (lossy & lossless)
......@@ -41,7 +41,7 @@ protected:
virtual bool EncodeBuffer(std::ostream &os, const char *data, size_t datalen);
private:
JPEGInternals *Internals;
JPEGInternals_12BIT *Internals;
};
} // end namespace gdcm
......
......@@ -18,4 +18,8 @@
#include <setjmp.h>
#define JPEGBITSCodec JPEG16Codec
#include "gdcmJPEGBITSCodec.cxx"
#define my_error_mgr my_error_mgr_16BIT
#define JPEGInternals JPEGInternals_16BIT
#define my_source_mgr my_source_mgr_16BIT
#define my_destination_mgr my_destination_mgr_16BIT
#include "gdcmJPEGBITSCodec.hxx"
......@@ -19,7 +19,7 @@
namespace gdcm
{
class JPEGInternals;
class JPEGInternals_16BIT;
class ByteValue;
/**
* \brief Class to do JPEG 16bits (lossless)
......@@ -41,7 +41,7 @@ protected:
virtual bool EncodeBuffer(std::ostream &os, const char *data, size_t datalen);
private:
JPEGInternals *Internals;
JPEGInternals_16BIT *Internals;
};
} // end namespace gdcm
......
......@@ -18,4 +18,8 @@
#include <setjmp.h>
#define JPEGBITSCodec JPEG8Codec
#include "gdcmJPEGBITSCodec.cxx"
#define my_error_mgr my_error_mgr_8BIT
#define JPEGInternals JPEGInternals_8BIT
#define my_source_mgr my_source_mgr_8BIT
#define my_destination_mgr my_destination_mgr_8BIT
#include "gdcmJPEGBITSCodec.hxx"