From 0815f0560a9a33085ffea804c9a6ebcaf43b20fc Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Thu, 3 Jul 2014 01:17:58 +0800 Subject: [PATCH] Fixes a warning about unused fread() return value --- test/unittest/jsoncheckertest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unittest/jsoncheckertest.cpp b/test/unittest/jsoncheckertest.cpp index 7033856..91e6262 100644 --- a/test/unittest/jsoncheckertest.cpp +++ b/test/unittest/jsoncheckertest.cpp @@ -15,8 +15,8 @@ static char* ReadFile(const char* filename, size_t& length) { length = (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); char* 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); return json; }