@@ -603,7 +603,7 @@ class BlobSection : public Section {
603
603
ReadWriter_ptr B= ReadWriter_ptr (new MemoryReader (getptr (_pblob)+blobofs+4 , chunksize));
604
604
ReadWriter_ptr Z= ReadWriter_ptr (new CompressedReader (B));
605
605
606
- std::string result ( char ( 0 ), itemsize);
606
+ std::string result; result. resize ( itemsize);
607
607
Z->setpos (streamofs);
608
608
Z->read ((uint8_t *)&result[0 ], itemsize);
609
609
@@ -749,7 +749,7 @@ class IndexSection : public Section {
749
749
750
750
ReadWriter_ptr wrd= makexorreader (_pwords, _lwords);
751
751
752
- std::string result ( char ( 0 ), eofs-wofs);
752
+ std::string result; result. resize ( eofs-wofs);
753
753
wrd->setpos (wofs+2 );
754
754
wrd->read ((uint8_t *)&result[0 ], eofs-wofs);
755
755
@@ -915,8 +915,8 @@ class IndexSection : public Section {
915
915
916
916
class iterator {
917
917
protected:
918
- ReadWriter_ptr _tab;
919
- ReadWriter_ptr _words;
918
+ mutable ReadWriter_ptr _tab;
919
+ mutable ReadWriter_ptr _words;
920
920
uint32_t _ix;
921
921
public:
922
922
typedef std::string& reference;
@@ -988,14 +988,14 @@ class IndexSection : public Section {
988
988
{
989
989
}
990
990
stringiterator () { }
991
- std::string operator *()
991
+ std::string operator *() const
992
992
{
993
993
_tab->setpos (4 *_ix);
994
994
uint32_t wofs= _tab->read32le ();
995
995
_words->setpos (wofs);
996
996
uint16_t wlen= _words->read16le ();
997
997
998
- std::string word ( char ( 0 ), wlen);
998
+ std::string word; word. resize ( wlen);
999
999
_words->read ((uint8_t *)&word[0 ], wlen);
1000
1000
// printf("striter[%08x->%08x]=%04x:%s\n", _ix, wofs, wlen, word.c_str());
1001
1001
return word;
@@ -1020,15 +1020,15 @@ class IndexSection : public Section {
1020
1020
{
1021
1021
}
1022
1022
substriterator () { }
1023
- std::string operator *()
1023
+ std::string operator *() const
1024
1024
{
1025
1025
_tab->setpos (6 *_ix);
1026
1026
uint32_t wofs= _tab->read32le ();
1027
1027
uint16_t strofs= _tab->read16le ();
1028
1028
_words->setpos (wofs);
1029
1029
uint16_t wlen= _words->read16le ();
1030
1030
1031
- std::string result ( char ( 0 ), wlen-strofs);
1031
+ std::string result; result. resize ( wlen-strofs);
1032
1032
_words->setpos (wofs+2 +strofs);
1033
1033
_words->read ((uint8_t *)&result[0 ], wlen-strofs);
1034
1034
@@ -1156,7 +1156,7 @@ class VdwFile : public Section {
1156
1156
1157
1157
ReadWriter_ptr cpr= makexorreader (2 *_cplen+0x3e , 2 *_cplen);
1158
1158
1159
- std::Wstring cp2 ( uint16_t ( 0 ), _cplen);
1159
+ std::Wstring cp2; cp2. resize ( _cplen);
1160
1160
// .. ignoring bigendian platforms
1161
1161
cpr->read ((uint8_t *)&cp2[0 ], _cplen*2 );
1162
1162
0 commit comments