Date:2016-08-23 02:25:44 (7 years 3 months ago)
Author:Werner Almesberger
Commit:417ddb16facc82c12aa309f4338997ca7bd658ee
Message:eeshow/gfx/pdftoc.c: use strbegins instead of local "begins"

Files: eeshow/gfx/pdftoc.c (2 diffs)

Change Details

eeshow/gfx/pdftoc.c
6969};
7070
7171
72static bool begins(const char *s, const char *pfx)
73{
74    return !strncmp(s, pfx, strlen(pfx));
75}
76
77
7872struct pdftoc *pdftoc_begin(const char *file)
7973{
8074    struct pdftoc *ctx;
...... 
149143            ctx->state = object;
150144            break;
151145        }
152        if (begins(s, "xref")) {
146        if (strbegins(s, "xref")) {
153147            ctx->state = xref;
154148            break;
155149        }
156150        break;
157151    case object:
158        if (begins(s, "endobj")) {
152        if (strbegins(s, "endobj")) {
159153            ctx->state = idle;
160154            break;
161155        }
162        if (begins(s, "<< /Type /Page")) {
156        if (strbegins(s, "<< /Type /Page")) {
163157            ctx->curr_obj->is_page = 1;
164158            break;
165159        }
166        if (begins(s, "<< /Type /Catalog")) {
160        if (strbegins(s, "<< /Type /Catalog")) {
167161            ctx->state = catalog;
168162            break;
169163        }
170164        break;
171165    case catalog:
172        if (begins(s, ">>")) {
166        if (strbegins(s, ">>")) {
173167            ctx->state = object;
174168            ctx->pos += fprintf(ctx->file,
175169                " /Outlines %u 0 R\n",

Archive Download the corresponding diff file

Branches:
master



interactive