diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-04-17 15:41:02 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-04-17 15:41:02 -0500 |
commit | 126f22e0f8c11f656d6b715e241be1dfbe54f308 (patch) | |
tree | 51580589c5009b9e85207a0c09e34a9eaa02c432 | |
parent | 30786cf7b15806940b8bec7d1069353d97525176 (diff) | |
download | couchdb-126f22e0f8c11f656d6b715e241be1dfbe54f308.tar.gz |
Changes to backport to other PR
-rw-r--r-- | src/couch/priv/couch_js/60/main.cpp | 2 | ||||
-rw-r--r-- | src/couch/priv/couch_js/60/util.cpp | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/couch/priv/couch_js/60/main.cpp b/src/couch/priv/couch_js/60/main.cpp index ebdb1e61f..828b9dab5 100644 --- a/src/couch/priv/couch_js/60/main.cpp +++ b/src/couch/priv/couch_js/60/main.cpp @@ -21,8 +21,6 @@ #include <unistd.h> #endif -#include <sstream> - #include <jsapi.h> #include <js/Initialization.h> #include <js/Conversions.h> diff --git a/src/couch/priv/couch_js/60/util.cpp b/src/couch/priv/couch_js/60/util.cpp index 213f5d6c9..de25df51c 100644 --- a/src/couch/priv/couch_js/60/util.cpp +++ b/src/couch/priv/couch_js/60/util.cpp @@ -223,15 +223,15 @@ couch_readline(JSContext* cx, FILE* fp) bytes = static_cast<char*>(JS_malloc(cx, byteslen)); if(bytes == NULL) return NULL; - + while((readlen = couch_fgets(bytes+used, byteslen-used, fp)) > 0) { used += readlen; - + if(bytes[used-1] == '\n') { bytes[used-1] = '\0'; break; } - + // Double our buffer and read more. oldbyteslen = byteslen; byteslen *= 2; @@ -240,7 +240,7 @@ couch_readline(JSContext* cx, FILE* fp) JS_free(cx, bytes); return NULL; } - + bytes = tmp; } @@ -250,7 +250,7 @@ couch_readline(JSContext* cx, FILE* fp) return JS_NewStringCopyZ(cx, nullptr); } - // Shring the buffer to the actual data size + // Shrink the buffer to the actual data size tmp = static_cast<char*>(JS_realloc(cx, bytes, byteslen, used)); if(!tmp) { JS_free(cx, bytes); |