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

Side by Side Diff: experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp

Issue 18293012: pdf viewer: fix a few warnings, and enable warning as errors (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | gyp/pdfviewer.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 #include "SkPdfNativeTokenizer.h" 2 #include "SkPdfNativeTokenizer.h"
3 #include "SkPdfObject.h" 3 #include "SkPdfObject.h"
4 #include "SkPdfConfig.h" 4 #include "SkPdfConfig.h"
5 5
6 #include "SkPdfStreamCommonDictionary_autogen.h" 6 #include "SkPdfStreamCommonDictionary_autogen.h"
7 7
8 unsigned char* skipPdfWhiteSpaces(unsigned char* start, unsigned char* end) { 8 unsigned char* skipPdfWhiteSpaces(unsigned char* start, unsigned char* end) {
9 while (start < end && isPdfWhiteSpace(*start)) { 9 while (start < end && isPdfWhiteSpace(*start)) {
10 if (*start == kComment_PdfDelimiter) { 10 if (*start == kComment_PdfDelimiter) {
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 SkPdfNativeTokenizer::SkPdfNativeTokenizer(unsigned char* buffer, int len, const SkPdfMapper* mapper, SkPdfAllocator* allocator) : fMapper(mapper), fAllocator(a llocator), fEmpty(false), fHasPutBack(false) { 693 SkPdfNativeTokenizer::SkPdfNativeTokenizer(unsigned char* buffer, int len, const SkPdfMapper* mapper, SkPdfAllocator* allocator) : fMapper(mapper), fAllocator(a llocator), fEmpty(false), fHasPutBack(false) {
694 fUncompressedStreamStart = fUncompressedStream = (unsigned char*)fAllocator- >alloc(len); 694 fUncompressedStreamStart = fUncompressedStream = (unsigned char*)fAllocator- >alloc(len);
695 fUncompressedStreamEnd = fUncompressedStream + len; 695 fUncompressedStreamEnd = fUncompressedStream + len;
696 memcpy(fUncompressedStream, buffer, len); 696 memcpy(fUncompressedStream, buffer, len);
697 } 697 }
698 698
699 SkPdfNativeTokenizer::~SkPdfNativeTokenizer() { 699 SkPdfNativeTokenizer::~SkPdfNativeTokenizer() {
700 // free the unparsed stream, we don't need it. 700 // free the unparsed stream, we don't need it.
701 // the parsed one is locked as it contains the strings and keywords referenc ed in objects 701 // the parsed one is locked as it contains the strings and keywords referenc ed in objects
702 if (fUncompressedStream) { 702 if (fUncompressedStream) {
703 realloc(fUncompressedStreamStart, fUncompressedStream - fUncompressedStr eamStart); 703 void* dummy = realloc(fUncompressedStreamStart, fUncompressedStream - fU ncompressedStreamStart);
704 SkASSERT(dummy == fUncompressedStreamStart);
705 fUncompressedStreamStart = (unsigned char*)dummy; // suporess compiler warning
704 } else { 706 } else {
705 SkASSERT(false); 707 SkASSERT(false);
706 } 708 }
707 } 709 }
708 710
709 bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) { 711 bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) {
710 token->fKeyword = NULL; 712 token->fKeyword = NULL;
711 token->fObject = NULL; 713 token->fObject = NULL;
712 714
713 fUncompressedStream = skipPdfWhiteSpaces(fUncompressedStream, fUncompressedS treamEnd); 715 fUncompressedStream = skipPdfWhiteSpaces(fUncompressedStream, fUncompressedS treamEnd);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 765
764 if (fEmpty) { 766 if (fEmpty) {
765 #ifdef PDF_TRACE 767 #ifdef PDF_TRACE
766 printf("EMPTY TOKENIZER\n"); 768 printf("EMPTY TOKENIZER\n");
767 #endif 769 #endif
768 return false; 770 return false;
769 } 771 }
770 772
771 return readTokenCore(token); 773 return readTokenCore(token);
772 } 774 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | gyp/pdfviewer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698