Skip to content

Commit

Permalink
Remove _parse_ from the segment decode routines.
Browse files Browse the repository at this point in the history
Our use wasn't consistent here; some decoders were jbig2_foo() and
others were jbig2_parse_bar(). Prefer the shorter names and keep
_parse_ only for the header and dispatch routines which don't themselves
decode the segment bodies.
  • Loading branch information
Ralph Giles committed Oct 28, 2009
1 parent d2849e9 commit fe50e62
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions jbig2_metadata.c
Expand Up @@ -104,7 +104,7 @@ int jbig2_metadata_add(Jbig2Ctx *ctx, Jbig2Metadata *md,


/* decode an ascii comment segment 7.4.15.1 */
int jbig2_parse_comment_ascii(Jbig2Ctx *ctx, Jbig2Segment *segment,
int jbig2_comment_ascii(Jbig2Ctx *ctx, Jbig2Segment *segment,
const uint8_t *segment_data)
{
char *s = (char *)(segment_data + 4);
Expand Down Expand Up @@ -147,7 +147,7 @@ int jbig2_parse_comment_ascii(Jbig2Ctx *ctx, Jbig2Segment *segment,
}

/* decode a UCS-16 comment segement 7.4.15.2 */
int jbig2_parse_comment_unicode(Jbig2Ctx *ctx, Jbig2Segment *segment,
int jbig2_comment_unicode(Jbig2Ctx *ctx, Jbig2Segment *segment,
const uint8_t *segment_data)
{
return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
Expand Down
4 changes: 2 additions & 2 deletions jbig2_metadata.h
Expand Up @@ -40,9 +40,9 @@ struct _Jbig2Metadata {
};

/* these bits can go to jbig2_priv.h */
int jbig2_parse_comment_ascii(Jbig2Ctx *ctx, Jbig2Segment *segment,
int jbig2_comment_ascii(Jbig2Ctx *ctx, Jbig2Segment *segment,
const uint8_t *segment_data);
int jbig2_parse_comment_unicode(Jbig2Ctx *ctx, Jbig2Segment *segment,
int jbig2_comment_unicode(Jbig2Ctx *ctx, Jbig2Segment *segment,
const uint8_t *segment_data);

#endif /* _JBIG2_METADATA_H */
18 changes: 9 additions & 9 deletions jbig2_page.c
Expand Up @@ -54,14 +54,14 @@ dump_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, Jbig2Page *page)
}

/**
* jbig2_read_page_info: parse page info segment
* jbig2_page_info: parse page info segment
*
* parse the page info segment data and fill out a corresponding
* Jbig2Page struct is returned, including allocating an image
* buffer for the page (or the first stripe)
* Parse the page info segment data and fill out a corresponding
* Jbig2Page struct and ready it for subsequent rendered data,
* including allocating an image buffer for the page (or the first stripe)
**/
int
jbig2_parse_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
jbig2_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
{
Jbig2Page *page;

Expand Down Expand Up @@ -160,10 +160,10 @@ jbig2_parse_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segm
}

/**
* jbig2_parse_end_of_stripe: parse an end of stripe segment
* jbig2_end_of_stripe: parse and implement an end of stripe segment
**/
int
jbig2_parse_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
{
Jbig2Page page = ctx->pages[ctx->current_page];
int end_row;
Expand Down Expand Up @@ -219,10 +219,10 @@ jbig2_complete_page (Jbig2Ctx *ctx)
}

/**
* jbig2_parse_end_of_page: parse an end of page segment
* jbig2_end_of_page: parse and implement an end of page segment
**/
int
jbig2_parse_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
{
uint32_t page_number = ctx->pages[ctx->current_page].number;

Expand Down
10 changes: 5 additions & 5 deletions jbig2_priv.h
Expand Up @@ -117,10 +117,10 @@ struct _Jbig2Page {
Jbig2Image *image;
};

int jbig2_parse_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_parse_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_parse_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_parse_extension_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_extension_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);

typedef enum {
JBIG2_COMPOSE_OR = 0,
Expand All @@ -145,7 +145,7 @@ typedef struct {
} Jbig2RegionSegmentInfo;

void jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const uint8_t *segment_data);
int jbig2_parse_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
int jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);

/* 7.4 */
int jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
Expand Down
12 changes: 6 additions & 6 deletions jbig2_segment.c
Expand Up @@ -207,8 +207,8 @@ int jbig2_parse_extension_segment(Jbig2Ctx *ctx, Jbig2Segment *segment,
}

switch (type) {
case 0x20000000: return jbig2_parse_comment_ascii(ctx, segment, segment_data);
case 0x20000002: return jbig2_parse_comment_unicode(ctx, segment, segment_data);
case 0x20000000: return jbig2_comment_ascii(ctx, segment, segment_data);
case 0x20000002: return jbig2_comment_unicode(ctx, segment, segment_data);
default:
if (necessary) {
return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
Expand Down Expand Up @@ -237,7 +237,7 @@ int jbig2_parse_segment (Jbig2Ctx *ctx, Jbig2Segment *segment,
case 4: /* intermediate text region */
case 6: /* immediate text region */
case 7: /* immediate lossless text region */
return jbig2_parse_text_region(ctx, segment, segment_data);
return jbig2_text_region(ctx, segment, segment_data);
#ifdef JBIG2_HALFTONE
case 16:
return jbig2_pattern_dictionary(ctx, segment, segment_data);
Expand Down Expand Up @@ -270,11 +270,11 @@ int jbig2_parse_segment (Jbig2Ctx *ctx, Jbig2Segment *segment,
case 43: /* immediate lossless generic refinement region */
return jbig2_refinement_region(ctx, segment, segment_data);
case 48:
return jbig2_parse_page_info(ctx, segment, segment_data);
return jbig2_page_info(ctx, segment, segment_data);
case 49:
return jbig2_parse_end_of_page(ctx, segment, segment_data);
return jbig2_end_of_page(ctx, segment, segment_data);
case 50:
return jbig2_parse_end_of_stripe(ctx, segment, segment_data);
return jbig2_end_of_stripe(ctx, segment, segment_data);
case 51:
ctx->state = JBIG2_FILE_EOF;
return jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number,
Expand Down
4 changes: 2 additions & 2 deletions jbig2_text.c
Expand Up @@ -402,10 +402,10 @@ jbig2_decode_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
}

/**
* jbig2_parse_text_region: read a text region segment header
* jbig2_text_region: read a text region segment header
**/
int
jbig2_parse_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data)
jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data)
{
int offset = 0;
Jbig2RegionSegmentInfo region_info;
Expand Down

0 comments on commit fe50e62

Please sign in to comment.