pdfviewer: fix warning in release

Review URL: https://codereview.chromium.org/19773002

git-svn-id: http://skia.googlecode.com/svn/trunk@10137 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
edisonn@google.com 2013-07-18 13:03:03 +00:00
parent 016a30d1e5
commit 620edc5039

View File

@ -75,11 +75,16 @@ SkNativeParsedPDF::SkNativeParsedPDF(const char* path)
FILE* file = fopen(path, "r"); FILE* file = fopen(path, "r");
fContentLength = getFileSize(path); fContentLength = getFileSize(path);
fFileContent = new unsigned char[fContentLength + 1]; fFileContent = new unsigned char[fContentLength + 1];
fread(fFileContent, fContentLength, 1, file); bool ok = (0 != fread(fFileContent, fContentLength, 1, file));
fFileContent[fContentLength] = '\0'; fFileContent[fContentLength] = '\0';
fclose(file); fclose(file);
file = NULL; file = NULL;
if (!ok) {
// TODO(edisonn): report read error
return; // Doc will have 0 pages
}
unsigned char* eofLine = lineHome(fFileContent, fFileContent + fContentLength - 1); unsigned char* eofLine = lineHome(fFileContent, fFileContent + fContentLength - 1);
unsigned char* xrefByteOffsetLine = previousLineHome(fFileContent, eofLine); unsigned char* xrefByteOffsetLine = previousLineHome(fFileContent, eofLine);
unsigned char* xrefstartKeywordLine = previousLineHome(fFileContent, xrefByteOffsetLine); unsigned char* xrefstartKeywordLine = previousLineHome(fFileContent, xrefByteOffsetLine);