X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmUtil.cxx;h=05c33b49f23f319226ead6b018e18cef60ca503c;hb=e51a044cdd1df9c7313926d66e2b999e5d98388b;hp=fcaf873afc2f330b5c2b9f6c2757756915e7ddae;hpb=3a295a448c7579e6ad5d574d4a28614588d5f05c;p=gdcm.git diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index fcaf873a..05c33b49 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/02/14 14:34:27 $ - Version: $Revision: 1.141 $ + Date: $Date: 2005/02/14 15:52:39 $ + Version: $Revision: 1.143 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -871,7 +871,6 @@ std::ostream &binary_write(std::ostream &os, const char *val) * \brief * @param os ostream to write to * @param val val - * @param len length of the 'value' to be written */ std::ostream &binary_write(std::ostream &os, std::string const &val) { @@ -881,7 +880,8 @@ std::ostream &binary_write(std::ostream &os, std::string const &val) /** * \brief binary_write binary_write * @param os ostream to write to - * @param val val + * @param val value + * @param len length of the 'value' to be written */ std::ostream &binary_write(std::ostream &os, const uint8_t *val, size_t len) { @@ -904,7 +904,7 @@ std::ostream &binary_write(std::ostream &os, const uint16_t *val, size_t len) #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION) const int BUFFER_SIZE = 4096; uint16_t *binArea16 = (uint16_t*)val; - uint16_t *buffer = new uint16_t[BUFFER_SIZE/2]; + static uint16_t buffer[BUFFER_SIZE/2]; uint16_t *pbuffer = buffer; // how many BUFFER_SIZE long pieces in binArea ? @@ -922,7 +922,7 @@ std::ostream &binary_write(std::ostream &os, const uint16_t *val, size_t len) // 1) Save 1 affectation and 2 AND operations // buffer[i] = (binArea16[i] >> 8) | (binArea16[i] << 8); // 2) Replace * operations by + operations using pointers - *pbuffer = *binArea16 >> 8 | *binArea16 >> 8; + *pbuffer = *binArea16 >> 8 | *binArea16 << 8; pbuffer++; binArea16++; } @@ -941,7 +941,6 @@ std::ostream &binary_write(std::ostream &os, const uint16_t *val, size_t len) } os.write ( (char*)buffer, remainingSize ); } - delete[] buffer; return os; #else return os.write(reinterpret_cast(val), len);