Skip to content

Commit e06e3d0

Browse files
committed
fixed several windows incompatibilities
1 parent 5d5650e commit e06e3d0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

vdwreader.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ class BlobSection : public Section {
603603
ReadWriter_ptr B= ReadWriter_ptr(new MemoryReader(getptr(_pblob)+blobofs+4, chunksize));
604604
ReadWriter_ptr Z= ReadWriter_ptr(new CompressedReader(B));
605605

606-
std::string result(char(0), itemsize);
606+
std::string result; result.resize(itemsize);
607607
Z->setpos(streamofs);
608608
Z->read((uint8_t*)&result[0], itemsize);
609609

@@ -749,7 +749,7 @@ class IndexSection : public Section {
749749

750750
ReadWriter_ptr wrd= makexorreader(_pwords, _lwords);
751751

752-
std::string result(char(0), eofs-wofs);
752+
std::string result; result.resize(eofs-wofs);
753753
wrd->setpos(wofs+2);
754754
wrd->read((uint8_t*)&result[0], eofs-wofs);
755755

@@ -915,8 +915,8 @@ class IndexSection : public Section {
915915

916916
class iterator {
917917
protected:
918-
ReadWriter_ptr _tab;
919-
ReadWriter_ptr _words;
918+
mutable ReadWriter_ptr _tab;
919+
mutable ReadWriter_ptr _words;
920920
uint32_t _ix;
921921
public:
922922
typedef std::string& reference;
@@ -988,14 +988,14 @@ class IndexSection : public Section {
988988
{
989989
}
990990
stringiterator() { }
991-
std::string operator*()
991+
std::string operator*() const
992992
{
993993
_tab->setpos(4*_ix);
994994
uint32_t wofs= _tab->read32le();
995995
_words->setpos(wofs);
996996
uint16_t wlen= _words->read16le();
997997

998-
std::string word(char(0), wlen);
998+
std::string word; word.resize(wlen);
999999
_words->read((uint8_t*)&word[0], wlen);
10001000
//printf("striter[%08x->%08x]=%04x:%s\n", _ix, wofs, wlen, word.c_str());
10011001
return word;
@@ -1020,15 +1020,15 @@ class IndexSection : public Section {
10201020
{
10211021
}
10221022
substriterator() { }
1023-
std::string operator*()
1023+
std::string operator*() const
10241024
{
10251025
_tab->setpos(6*_ix);
10261026
uint32_t wofs= _tab->read32le();
10271027
uint16_t strofs= _tab->read16le();
10281028
_words->setpos(wofs);
10291029
uint16_t wlen= _words->read16le();
10301030

1031-
std::string result(char(0), wlen-strofs);
1031+
std::string result; result.resize(wlen-strofs);
10321032
_words->setpos(wofs+2+strofs);
10331033
_words->read((uint8_t*)&result[0], wlen-strofs);
10341034

@@ -1156,7 +1156,7 @@ class VdwFile : public Section {
11561156

11571157
ReadWriter_ptr cpr= makexorreader(2*_cplen+0x3e, 2*_cplen);
11581158

1159-
std::Wstring cp2(uint16_t(0), _cplen);
1159+
std::Wstring cp2; cp2.resize(_cplen);
11601160
// .. ignoring bigendian platforms
11611161
cpr->read((uint8_t*)&cp2[0], _cplen*2);
11621162

0 commit comments

Comments
 (0)