X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FgdcmUtil.cxx;h=936e0dde2985bf64a8f3a43c250290de15514f26;hb=359ebc818c100156bd8f7a3a8783f2c538474990;hp=4aa3619ff8b81e6b09e1f5ba95fcdab3efaed368;hpb=5a7655772c47a694475c3e6296fbc0b63faca02c;p=gdcm.git diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index 4aa3619f..936e0dde 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmUtil.cxx,v $ Language: C++ - Date: $Date: 2005/10/27 18:14:01 $ - Version: $Revision: 1.171 $ + Date: $Date: 2005/11/29 13:02:46 $ + Version: $Revision: 1.179 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -18,7 +18,9 @@ #include "gdcmUtil.h" #include "gdcmDebug.h" + #include +#include // for va_list // For GetCurrentDate, GetCurrentTime #include @@ -110,7 +112,7 @@ std::string Util::GDCM_MAC_ADRESS = GetMACAddress(); /** * \brief Provide a better 'c++' approach for sprintf * For example c code is: - * char result[200]; // hope 200 is enough + * char result[2048]; // hope 2048 is enough * sprintf(result, "%04x|%04x", group , elem); * * c++ code is @@ -126,7 +128,7 @@ std::string Util::GDCM_MAC_ADRESS = GetMACAddress(); */ std::string Util::Format(const char *format, ...) { - char buffer[2048]; + char buffer[2048]; // hope 2048 is enough va_list args; va_start(args, format); vsprintf(buffer, format, args); //might be a security flaw @@ -195,7 +197,6 @@ bool Util::IsCleanString(std::string const &s) //std::cout<< std::endl << s << std::endl; for(unsigned int i=0; i 64 ) { - gdcmErrorMacro( "Size of UID is too long." ); + gdcmStaticErrorMacro( "Size of UID is too long." ); // we need a hash function to truncate this number // if only md5 was cross plateform // MD5(append); @@ -979,7 +980,7 @@ std::ostream &binary_write(std::ostream &os, const uint32_t &val) std::ostream &binary_write(std::ostream &os, const double &val) { #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION) - double swap; + double swap = val; char *beg = (char *)&swap; char *end = beg + 7; @@ -1027,7 +1028,6 @@ std::ostream &binary_write(std::ostream &os, std::string const &val) */ std::ostream &binary_write(std::ostream &os, const uint8_t *val, size_t len) { - gdcmDebugMacro( "binary_write " << len ); // We are writting sizeof(char) thus no need to swap bytes return os.write(reinterpret_cast(val), len); } @@ -1147,6 +1147,14 @@ std::string Util::GetIPAddress() return str; } +void Util::hfpswap(double *a, double *b) +{ + double tmp; + tmp=*a; + *a=*b; + *b=tmp; +} + //------------------------------------------------------------------------- } // end namespace gdcm