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

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

Issue 22407005: pdfviewer: fix font rotation issues (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | « experimental/PdfViewer/SkPdfRenderer.cpp ('k') | 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 10588)
+++ experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp (working copy)
@@ -90,21 +90,22 @@
, fRootCatalog(NULL) {
gDoc = this;
FILE* file = fopen(path, "r");
- size_t size = getFileSize(path);
- void* content = sk_malloc_throw(size);
- bool ok = (0 != fread(content, size, 1, file));
- fclose(file);
- file = NULL;
+ // TODO(edisonn): put this in a function that can return NULL
+ if (file) {
+ size_t size = getFileSize(path);
+ void* content = sk_malloc_throw(size);
+ bool ok = (0 != fread(content, size, 1, file));
+ fclose(file);
+ if (!ok) {
+ sk_free(content);
+ // TODO(edisonn): report read error
+ // TODO(edisonn): not nice to return like this from constructor, create a static
+ // function that can report NULL for failures.
+ return; // Doc will have 0 pages
+ }
- if (!ok) {
- sk_free(content);
- // TODO(edisonn): report read error
- // TODO(edisonn): not nice to return like this from constructor, create a static
- // function that can report NULL for failures.
- return; // Doc will have 0 pages
+ init(content, size);
}
-
- init(content, size);
}
void SkNativeParsedPDF::init(const void* bytes, size_t length) {
« no previous file with comments | « experimental/PdfViewer/SkPdfRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698