diff --git a/src/file.cc b/src/file.cc index 368068cbfa..cfabaa9278 100644 --- a/src/file.cc +++ b/src/file.cc @@ -285,7 +285,8 @@ AfterRawRead(eio_req *req) size_t len = req->result; Local array = Array::New(len); for (unsigned int i = 0; i < len; i++) { - array->Set(Integer::New(i), Integer::New(buf[i])); + unsigned char val = reinterpret_cast(buf)[i]; + array->Set(Integer::New(i), Integer::New(val)); } argv[0] = array; argv[1] = Integer::New(req->result); diff --git a/src/http.cc b/src/http.cc index 945d98856b..0958b5a2fa 100644 --- a/src/http.cc +++ b/src/http.cc @@ -196,7 +196,7 @@ HTTPConnection::on_body (http_parser *parser, const char *buf, size_t len) // raw encoding Local array = Array::New(len); for (size_t i = 0; i < len; i++) { - char val = static_cast(buf)[i]; + unsigned char val = reinterpret_cast(buf)[i]; array->Set(Integer::New(i), Integer::New(val)); } argv[0] = array;