Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2005/10/27 17:04:36 $
- Version: $Revision: 1.170 $
+ Date: $Date: 2005/11/07 09:51:35 $
+ Version: $Revision: 1.175 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \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
*/
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
*/
bool Util::IsCleanString(std::string const &s)
{
- std::cout<< std::endl << s << std::endl;
+ //std::cout<< std::endl << s << std::endl;
for(unsigned int i=0; i<s.size(); i++)
{
- //std::cout<< std::endl << i << " : " << (unsigned char)s[i] << std::endl;
if (!isprint((unsigned char)s[i]) )
{
return false;
close(sd);
#endif
// Not implemented platforms (or no cable !)
- perror("in Get MAC Adress (internal) : There was a configuration problem on your plateform");
+ perror("in Get MAC Adress (internal) : There was a configuration problem (or no cable !) on your plateform");
memset(addr,0,6);
return -1;
#endif //__sun
}
/**
- * \brief Creates a new UID. As stipulate in the DICOM ref
- * each time a DICOM image is create it should have
+ * \brief Creates a new UID. As stipulated in the DICOM ref
+ * each time a DICOM image is created it should have
* a unique identifier (URI)
* @param root is the DICOM prefix assigned by IOS group
*/
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;
*/
std::ostream &binary_write(std::ostream &os, const uint8_t *val, size_t len)
{
-std::cout << "binary_write " << len << std::endl;
// We are writting sizeof(char) thus no need to swap bytes
return os.write(reinterpret_cast<const char*>(val), len);
}