Mercurial > hg > orthanc
comparison Core/Compression/ZlibCompressor.cpp @ 221:e7432706b354
accessors to storage
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2012 18:01:06 +0100 |
parents | fe180eae201d |
children | bdd72233b105 |
comparison
equal
deleted
inserted
replaced
220:bb8c260c0092 | 221:e7432706b354 |
---|---|
108 throw OrthancException("Zlib: The compressed buffer is ill-formed"); | 108 throw OrthancException("Zlib: The compressed buffer is ill-formed"); |
109 } | 109 } |
110 | 110 |
111 size_t uncompressedLength; | 111 size_t uncompressedLength; |
112 memcpy(&uncompressedLength, compressed, sizeof(size_t)); | 112 memcpy(&uncompressedLength, compressed, sizeof(size_t)); |
113 uncompressed.resize(uncompressedLength); | 113 |
114 try | |
115 { | |
116 uncompressed.resize(uncompressedLength); | |
117 } | |
118 catch (...) | |
119 { | |
120 throw OrthancException("Zlib: Corrupted compressed buffer"); | |
121 } | |
114 | 122 |
115 uLongf tmp = uncompressedLength; | 123 uLongf tmp = uncompressedLength; |
116 int error = uncompress | 124 int error = uncompress |
117 (reinterpret_cast<uint8_t*>(&uncompressed[0]), | 125 (reinterpret_cast<uint8_t*>(&uncompressed[0]), |
118 &tmp, | 126 &tmp, |