diff --git a/test/unittest/encodedstreamtest.cpp b/test/unittest/encodedstreamtest.cpp index 26bfc32..03415aa 100644 --- a/test/unittest/encodedstreamtest.cpp +++ b/test/unittest/encodedstreamtest.cpp @@ -47,8 +47,8 @@ protected: *outLength = (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); char* buffer = (char*)malloc(*outLength + 1); - fread(buffer, 1, *outLength, fp); - buffer[*outLength] = '\0'; + size_t readLength = fread(buffer, 1, *outLength, fp); + buffer[readLength] = '\0'; fclose(fp); return buffer; } diff --git a/test/unittest/filestreamtest.cpp b/test/unittest/filestreamtest.cpp index c653537..20a8438 100644 --- a/test/unittest/filestreamtest.cpp +++ b/test/unittest/filestreamtest.cpp @@ -20,8 +20,8 @@ public: length_ = (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); json_ = (char*)malloc(length_ + 1); - fread(json_, 1, length_, fp); - json_[length_] = '\0'; + size_t readLength = fread(json_, 1, length_, fp); + json_[readLength] = '\0'; fclose(fp); }