Change Details
eeshow/gfx/pdftoc.c |
69 | 69 | }; |
70 | 70 | |
71 | 71 | |
72 | | static bool begins(const char *s, const char *pfx) |
73 | | { |
74 | | return !strncmp(s, pfx, strlen(pfx)); |
75 | | } |
76 | | |
77 | | |
78 | 72 | struct pdftoc *pdftoc_begin(const char *file) |
79 | 73 | { |
80 | 74 | struct pdftoc *ctx; |
... | ... | |
149 | 143 | ctx->state = object; |
150 | 144 | break; |
151 | 145 | } |
152 | | if (begins(s, "xref")) { |
| 146 | if (strbegins(s, "xref")) { |
153 | 147 | ctx->state = xref; |
154 | 148 | break; |
155 | 149 | } |
156 | 150 | break; |
157 | 151 | case object: |
158 | | if (begins(s, "endobj")) { |
| 152 | if (strbegins(s, "endobj")) { |
159 | 153 | ctx->state = idle; |
160 | 154 | break; |
161 | 155 | } |
162 | | if (begins(s, "<< /Type /Page")) { |
| 156 | if (strbegins(s, "<< /Type /Page")) { |
163 | 157 | ctx->curr_obj->is_page = 1; |
164 | 158 | break; |
165 | 159 | } |
166 | | if (begins(s, "<< /Type /Catalog")) { |
| 160 | if (strbegins(s, "<< /Type /Catalog")) { |
167 | 161 | ctx->state = catalog; |
168 | 162 | break; |
169 | 163 | } |
170 | 164 | break; |
171 | 165 | case catalog: |
172 | | if (begins(s, ">>")) { |
| 166 | if (strbegins(s, ">>")) { |
173 | 167 | ctx->state = object; |
174 | 168 | ctx->pos += fprintf(ctx->file, |
175 | 169 | " /Outlines %u 0 R\n", |
Download the corresponding diff file