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

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

Issue 18518006: pdfviewer: remove assert (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 | « no previous file | no next file » | 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 static unsigned char* skipPdfWhiteSpaces(unsigned char* start, unsigned char* en d) { 8 static unsigned char* skipPdfWhiteSpaces(unsigned char* start, unsigned char* en d) {
9 while (start < end && isPdfWhiteSpace(*start)) { 9 while (start < end && isPdfWhiteSpace(*start)) {
10 if (*start == kComment_PdfDelimiter) { 10 if (*start == kComment_PdfDelimiter) {
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 fUncompressedStreamStart = fUncompressedStream = (unsigned char*)fAllocator- >alloc(len); 685 fUncompressedStreamStart = fUncompressedStream = (unsigned char*)fAllocator- >alloc(len);
686 fUncompressedStreamEnd = fUncompressedStream + len; 686 fUncompressedStreamEnd = fUncompressedStream + len;
687 memcpy(fUncompressedStream, buffer, len); 687 memcpy(fUncompressedStream, buffer, len);
688 } 688 }
689 689
690 SkPdfNativeTokenizer::~SkPdfNativeTokenizer() { 690 SkPdfNativeTokenizer::~SkPdfNativeTokenizer() {
691 // free the unparsed stream, we don't need it. 691 // free the unparsed stream, we don't need it.
692 // the parsed one is locked as it contains the strings and keywords referenc ed in objects 692 // the parsed one is locked as it contains the strings and keywords referenc ed in objects
693 if (fUncompressedStream) { 693 if (fUncompressedStream) {
694 void* dummy = realloc(fUncompressedStreamStart, fUncompressedStream - fU ncompressedStreamStart); 694 void* dummy = realloc(fUncompressedStreamStart, fUncompressedStream - fU ncompressedStreamStart);
695 SkASSERT(dummy == fUncompressedStreamStart); 695 //SkASSERT(dummy == fUncompressedStreamStart);
696 fUncompressedStreamStart = (unsigned char*)dummy; // suporess compiler warning 696 fUncompressedStreamStart = (unsigned char*)dummy; // suppress compiler warning
697 } else { 697 } else {
698 SkASSERT(false); 698 SkASSERT(false);
699 } 699 }
700 } 700 }
701 701
702 bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) { 702 bool SkPdfNativeTokenizer::readTokenCore(PdfToken* token) {
703 token->fKeyword = NULL; 703 token->fKeyword = NULL;
704 token->fObject = NULL; 704 token->fObject = NULL;
705 705
706 fUncompressedStream = skipPdfWhiteSpaces(fUncompressedStream, fUncompressedS treamEnd); 706 fUncompressedStream = skipPdfWhiteSpaces(fUncompressedStream, fUncompressedS treamEnd);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 756
757 if (fEmpty) { 757 if (fEmpty) {
758 #ifdef PDF_TRACE 758 #ifdef PDF_TRACE
759 printf("EMPTY TOKENIZER\n"); 759 printf("EMPTY TOKENIZER\n");
760 #endif 760 #endif
761 return false; 761 return false;
762 } 762 }
763 763
764 return readTokenCore(token); 764 return readTokenCore(token);
765 } 765 }
OLDNEW
« 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