Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1761)

Unified Diff: experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp

Issue 19773002: pdfviewer: fix warning in release (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
===================================================================
--- experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp (revision 10010)
+++ experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp (working copy)
@@ -75,11 +75,16 @@
FILE* file = fopen(path, "r");
fContentLength = getFileSize(path);
fFileContent = new unsigned char[fContentLength + 1];
- fread(fFileContent, fContentLength, 1, file);
+ bool ok = (0 != fread(fFileContent, fContentLength, 1, file));
fFileContent[fContentLength] = '\0';
fclose(file);
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* xrefByteOffsetLine = previousLineHome(fFileContent, eofLine);
unsigned char* xrefstartKeywordLine = previousLineHome(fFileContent, xrefByteOffsetLine);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698