aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/PdfViewer/pdfparser
diff options
context:
space:
mode:
authorGravatar edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-18 13:03:03 +0000
committerGravatar edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-18 13:03:03 +0000
commit620edc503938e3bfb7621923c2f50e77451fecae (patch)
treec523495e106b9d9ed947c48f527b9e408b877384 /experimental/PdfViewer/pdfparser
parent016a30d1e59c5c7e894a2945ab678023f82c35ab (diff)
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
Diffstat (limited to 'experimental/PdfViewer/pdfparser')
-rw-r--r--experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
index dd8ec442b5..fe5d0ee830 100644
--- a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
+++ b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
@@ -75,11 +75,16 @@ SkNativeParsedPDF::SkNativeParsedPDF(const char* path)
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);