Showing the changes to string.c (1 of 8 files). Show all
Unified · Split
| @@ -62,7 +62,7 @@ pdfstring(Biobuf *b) · 61 unmodified lines | ||
| 62 | 62 | return nil; |
| 63 | 63 | |
| 64 | 64 | for(paren = sz = 0;;){ |
| 65 | − if((c = Bgetc(b)) <= 0) | |
| 65 | + if((c = Bgetc(b)) < 0) | |
| 66 | 66 | break; |
| 67 | 67 | |
| 68 | 68 | switch(c){ |
| @@ -81,7 +81,7 @@ pdfstring(Biobuf *b) · 12 unmodified lines | ||
| 81 | 81 | paren--; |
| 82 | 82 | if(paren < 1){ |
| 83 | 83 | c = 0; |
| 84 | − break; | |
| 84 | + goto end; | |
| 85 | 85 | } |
| 86 | 86 | continue; |
| 87 | 87 | |
| @@ -99,7 +99,7 @@ pdfstring(Biobuf *b) · 11 unmodified lines | ||
| 99 | 99 | oct[i] = 0; |
| 100 | 100 | c = strtol(oct, nil, 8); |
| 101 | 101 | }else if(c >= nelem(esc) || (c = esc[c]) == 0){ |
| 102 | − werrstr("unknown escape char %c", c); | |
| 102 | + werrstr("unknown escape char '%c'", c); | |
| 103 | 103 | goto err; |
| 104 | 104 | }else if(c < 0){ |
| 105 | 105 | continue; |
| @@ -108,13 +108,13 @@ pdfstring(Biobuf *b) · 2 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | default: |
| 110 | 110 | if(paren < 1){ |
| 111 | − werrstr("unexpected char '%c'", c); | |
| 111 | + werrstr("unexpected char %02x '%c'", (u8int)c, c); | |
| 112 | 112 | goto err; |
| 113 | 113 | } |
| 114 | 114 | break; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | − if(c <= 0) | |
| 117 | + if(c < 0) | |
| 118 | 118 | break; |
| 119 | 119 | if(sz+1 > maxsz){ |
| 120 | 120 | maxsz *= 2; |
| @@ -124,7 +124,7 @@ pdfstring(Biobuf *b) · 3 unmodified lines | ||
| 124 | 124 | } |
| 125 | 125 | s[sz++] = c; |
| 126 | 126 | } |
| 127 | − | |
| 127 | +end: | |
| 128 | 128 | if(paren != 0){ |
| 129 | 129 | werrstr("bad paren"); |
| 130 | 130 | goto err; |