Skip to content

Commit

Permalink
[memorystream] remove unneeded eof handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dbluelle committed May 29, 2016
1 parent 8801ca5 commit ee679b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
21 changes: 1 addition & 20 deletions src/parsing/streams.h
Expand Up @@ -101,14 +101,13 @@ class memorystream
const char* const code;
unsigned int len;
unsigned int pos;
bool read_past_end;
public:
lightspark::method_body_info_cache* codecache;
// Create a stream from a buffer b.
//
// The buffer is not copied, so b must continue to exists for
// the life-time of this memorystream instance.
memorystream(const char* const b, unsigned int l,lightspark::method_body_info_cache* cc): code(b), len(l), pos(0), read_past_end(false),codecache(cc) {};
memorystream(const char* const b, unsigned int l,lightspark::method_body_info_cache* cc): code(b), len(l), pos(0),codecache(cc) {};
static void handleError(const char *msg);
inline unsigned int size() const
{
Expand All @@ -134,7 +133,6 @@ class memorystream
{
memcpy(out, code+pos, len-pos);
pos = len;
read_past_end = true;
}
else
{
Expand All @@ -153,7 +151,6 @@ class memorystream
else
{
pos = len;
read_past_end = true;
return 0;
}
}
Expand All @@ -163,11 +160,6 @@ class memorystream
if (codecache[currpos].type == lightspark::method_body_info_cache::CACHE_TYPE_UINTEGER)
{
pos = codecache[currpos].nextpos;
if (pos > len)
{
pos = len;
read_past_end = true;
}
return codecache[currpos].uvalue;
}
uint32_t val = readu32();
Expand Down Expand Up @@ -212,11 +204,6 @@ class memorystream
if (codecache[currpos].type == lightspark::method_body_info_cache::CACHE_TYPE_INTEGER)
{
pos = codecache[currpos].nextpos;
if (pos > len)
{
pos = len;
read_past_end = true;
}
return codecache[currpos].ivalue;
}
uint32_t val=0;
Expand All @@ -227,11 +214,5 @@ class memorystream
codecache[currpos].nextpos = pos;
return ret;
}

inline bool eof() const
{
return read_past_end;
}

};
#endif /* PARSING_STREAMS_H */
2 changes: 0 additions & 2 deletions src/scripting/abc_interpreter.cpp
Expand Up @@ -66,8 +66,6 @@ ASObject* ABCVm::executeFunction(const SyntheticFunction* function, call_context
uint32_t instructionPointer=code.tellg();
#endif
opcode = code.readbyte();
if(code.eof())
throw ParseException("End of code in interpreter");

//Save ip for exception handling in SyntheticFunction::callImpl
context->exec_pos = code.tellg();
Expand Down

0 comments on commit ee679b7

Please sign in to comment.