Loading

Paste #p0srbplas

  1. Index: src/3rdparty/squirrel/squirrel/sqapi.cpp
  2. ===================================================================
  3. --- src/3rdparty/squirrel/squirrel/sqapi.cpp    (revision 27218)
  4. +++ src/3rdparty/squirrel/squirrel/sqapi.cpp    (working copy)
  5. @@ -1262,9 +1262,17 @@
  6.  WChar buf_lexfeed(SQUserPointer file)
  7.  {
  8.     BufState *buf=(BufState*)file;
  9. -   if(buf->size<(buf->ptr+1))
  10. -       return 0;
  11. -   return buf->buf[buf->ptr++];
  12. +
  13. +   if (buf->size < buf->ptr + 1) return 0;
  14. +
  15. +   int len = Utf8EncodedCharLen(buf->buf[buf->ptr]);
  16. +   if (buf->size < buf->ptr + len) return 0;
  17. +
  18. +   WChar result;
  19. +   Utf8Decode(&result, buf->buf + buf->ptr);
  20. +   buf->ptr += len;
  21. +
  22. +   return result;
  23.  }
  24.  
  25.  SQRESULT sq_compilebuffer(HSQUIRRELVM v,const SQChar *s,SQInteger size,const SQChar *sourcename,SQBool raiseerror) {
  26.  

Comments