moonbridge

changeset 193:d338068fad0d

Bugfix in moonbridge_io.c regarding reading without terminator char
author jbe
date Fri Jun 19 20:20:48 2015 +0200 (2015-06-19)
parents 5adfc36ca73f
children 822ccaeccccb
files moonbridge_io.c
line diff
     1.1 --- a/moonbridge_io.c	Fri Jun 19 19:47:03 2015 +0200
     1.2 +++ b/moonbridge_io.c	Fri Jun 19 20:20:48 2015 +0200
     1.3 @@ -168,7 +168,7 @@
     1.4    lua_Integer maxread;
     1.5    const char *terminatorstr;
     1.6    size_t terminatorlen;
     1.7 -  char terminator = 0;  /* initialize to avoid compiler warning */
     1.8 +  char terminator;
     1.9    luaL_Buffer luabuf;
    1.10    size_t luabufcnt = 0;
    1.11    int remaining;
    1.12 @@ -206,11 +206,13 @@
    1.13        handle->readbufin - handle->readbufout >= (size_t)maxread - luabufcnt
    1.14      ) {
    1.15        remaining = (size_t)maxread - luabufcnt;
    1.16 -      terminatorpos = memchr(
    1.17 -        handle->readbuf + handle->readbufout,
    1.18 -        terminator,
    1.19 -        remaining
    1.20 -      );
    1.21 +      if (terminatorlen) {
    1.22 +        terminatorpos = memchr(
    1.23 +          handle->readbuf + handle->readbufout,
    1.24 +          terminator,
    1.25 +          remaining
    1.26 +        );
    1.27 +      }
    1.28      } else if (terminatorlen) {
    1.29        terminatorpos = memchr(
    1.30          handle->readbuf + handle->readbufout,

Impressum / About Us