Improves search of EI (end of inlined image)
This commit is contained in:
		
							parent
							
								
									ce218d021f
								
							
						
					
					
						commit
						c68d125f17
					
				| @ -154,13 +154,22 @@ var Parser = (function ParserClosure() { | |||||||
|       var startPos = stream.pos; |       var startPos = stream.pos; | ||||||
| 
 | 
 | ||||||
|       // searching for the /EI\s/
 |       // searching for the /EI\s/
 | ||||||
|       var state = 0, ch; |       var state = 0, ch, i, ii; | ||||||
|       while (state != 4 && |       while (state != 4 && | ||||||
|              (ch = stream.getByte()) !== null && ch !== undefined) { |              (ch = stream.getByte()) !== null && ch !== undefined) { | ||||||
|         switch (ch) { |         switch (ch) { | ||||||
|           case 0x20: |           case 0x20: | ||||||
|           case 0x0D: |           case 0x0D: | ||||||
|           case 0x0A: |           case 0x0A: | ||||||
|  |             // let's check next five bytes to be ASCII... just be sure
 | ||||||
|  |             var followingBytes = stream.peekBytes(5); | ||||||
|  |             for (i = 0, ii = followingBytes.length; i < ii; i++) { | ||||||
|  |               ch = followingBytes[i]; | ||||||
|  |               if (ch !== 0x0A && ch != 0x0D && (ch < 0x20 || ch > 0x7F)) { | ||||||
|  |                 state = 0; | ||||||
|  |                 break; // some binary stuff found, resetting the state
 | ||||||
|  |               } | ||||||
|  |             } | ||||||
|             state = state === 3 ? 4 : 0; |             state = state === 3 ? 4 : 0; | ||||||
|             break; |             break; | ||||||
|           case 0x45: |           case 0x45: | ||||||
|  | |||||||
| @ -57,6 +57,11 @@ var Stream = (function StreamClosure() { | |||||||
|       this.pos = end; |       this.pos = end; | ||||||
|       return bytes.subarray(pos, end); |       return bytes.subarray(pos, end); | ||||||
|     }, |     }, | ||||||
|  |     peekBytes: function Stream_peekBytes(length) { | ||||||
|  |       var bytes = this.getBytes(length); | ||||||
|  |       this.pos -= bytes.length; | ||||||
|  |       return bytes; | ||||||
|  |     }, | ||||||
|     lookChar: function Stream_lookChar() { |     lookChar: function Stream_lookChar() { | ||||||
|       if (this.pos >= this.end) |       if (this.pos >= this.end) | ||||||
|         return null; |         return null; | ||||||
| @ -161,6 +166,11 @@ var DecodeStream = (function DecodeStreamClosure() { | |||||||
|       this.pos = end; |       this.pos = end; | ||||||
|       return this.buffer.subarray(pos, end); |       return this.buffer.subarray(pos, end); | ||||||
|     }, |     }, | ||||||
|  |     peekBytes: function DecodeStream_peekBytes(length) { | ||||||
|  |       var bytes = this.getBytes(length); | ||||||
|  |       this.pos -= bytes.length; | ||||||
|  |       return bytes; | ||||||
|  |     }, | ||||||
|     lookChar: function DecodeStream_lookChar() { |     lookChar: function DecodeStream_lookChar() { | ||||||
|       var pos = this.pos; |       var pos = this.pos; | ||||||
|       while (this.bufferLength <= pos) { |       while (this.bufferLength <= pos) { | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								test/pdfs/bug878194.pdf.link
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								test/pdfs/bug878194.pdf.link
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | https://bugzilla.mozilla.org/attachment.cgi?id=756735 | ||||||
| @ -1104,6 +1104,15 @@ | |||||||
|       "type": "eq", |       "type": "eq", | ||||||
|       "about": "True type font with encoding dict with no base encoding but with differences." |       "about": "True type font with encoding dict with no base encoding but with differences." | ||||||
|     }, |     }, | ||||||
|  |     {  "id": "bug878194", | ||||||
|  |        "file": "pdfs/bug878194.pdf", | ||||||
|  |        "md5": "c616b21fd2a1a65acc2de0f41e59a8b5", | ||||||
|  |        "link": "true", | ||||||
|  |        "rounds": 1, | ||||||
|  |        "firstPage": 4, | ||||||
|  |        "lastPage": 4, | ||||||
|  |        "type": "load" | ||||||
|  |     }, | ||||||
|     {  "id": "p020121130574743273239", |     {  "id": "p020121130574743273239", | ||||||
|       "file": "pdfs/P020121130574743273239.pdf", |       "file": "pdfs/P020121130574743273239.pdf", | ||||||
|       "md5": "271b65885d42d174cbc597ca89becb1a", |       "md5": "271b65885d42d174cbc597ca89becb1a", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user