X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinaryparser.cpp;h=b55c7af3e1a8c76bc8f6c2c0855a4cea6fea7e17;hb=08576b49c8bfb6cd841724dc5124d40af9475eb8;hp=298770a50f3ccbf2b02d3113f0163daea0dfefa7;hpb=27630d44298cb67e075c166f4421288cc8ca117e;p=libs%2Fdatafile.git diff --git a/source/binaryparser.cpp b/source/binaryparser.cpp index 298770a..b55c7af 100644 --- a/source/binaryparser.cpp +++ b/source/binaryparser.cpp @@ -19,7 +19,7 @@ BinaryParser::BinaryParser(Input &i, const string &s): ParserMode(i, s), first(true) { - dict[1]=DictEntry("__kw", "iss"); + dict[1]=DictEntry("__st", "iss"); dict[2]=DictEntry("__enum", "is"); } @@ -28,7 +28,7 @@ Statement BinaryParser::parse() while(1) { Statement st=parse_statement(); - if(st.keyword=="__kw") + if(st.keyword=="__st") { if(st.args.size()!=3) throw TypeError(src+": Keyword definition must have three arguments"); @@ -87,7 +87,7 @@ Statement BinaryParser::parse_statement() result.args.push_back(parse_bool()); break; case 'e': - result.args.push_back(parse_enum()); + result.args.push_back(Value(ENUM, parse_enum())); break; } } @@ -110,7 +110,7 @@ long long BinaryParser::parse_int() { int c=in.get(); - result=result<<7 | c&0x7F; + result=(result<<7) | (c&0x7F); bits+=7; if(!(c&0x80)) @@ -132,7 +132,7 @@ float BinaryParser::parse_float() }; #if BYTE_ORDER == LITTLE_ENDIAN - for(unsigned i=sizeof(float)-1; i--;) + for(unsigned i=sizeof(float); i--;) d[i]=in.get(); #else for(unsigned i=0; isecond; }