OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |