summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_cmap.c4
-rw-r--r--pdf/pdf_form.c19
-rw-r--r--pdf/pdf_interpret.c2
-rw-r--r--pdf/pdf_js.c24
-rw-r--r--pdf/pdf_object.c3
-rw-r--r--pdf/pdf_write.c77
6 files changed, 67 insertions, 62 deletions
diff --git a/pdf/pdf_cmap.c b/pdf/pdf_cmap.c
index d6cb3103..67626b31 100644
--- a/pdf/pdf_cmap.c
+++ b/pdf/pdf_cmap.c
@@ -306,8 +306,8 @@ static int cmprange(const void *va, const void *vb)
void
pdf_sort_cmap(fz_context *ctx, pdf_cmap *cmap)
{
- pdf_range *a; /* last written range on output */
- pdf_range *b; /* current range examined on input */
+ pdf_range *a; /* last written range on output */
+ pdf_range *b; /* current range examined on input */
if (cmap->rlen == 0)
return;
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c
index 0d08c215..872e02ad 100644
--- a/pdf/pdf_form.c
+++ b/pdf/pdf_form.c
@@ -56,8 +56,8 @@ enum
enum
{
- Q_Left = 0,
- Q_Cent = 1,
+ Q_Left = 0,
+ Q_Cent = 1,
Q_Right = 2
};
@@ -203,7 +203,7 @@ static int get_field_flags(pdf_document *doc, pdf_obj *obj)
int pdf_field_type(pdf_document *doc, pdf_obj *obj)
{
char *type = get_field_type_name(doc, obj);
- int flags = get_field_flags(doc, obj);
+ int flags = get_field_flags(doc, obj);
if (!strcmp(type, "Btn"))
{
@@ -514,8 +514,7 @@ static fz_buffer *create_aligned_text_buffer(pdf_document *doc, fz_rect *clip, t
{
fz_rect rect = measure_text(doc, &info->font_rec, tm, text);
- atm.e -= info->q == Q_Right ? rect.x1
- : (rect.x1 - rect.x0) / 2;
+ atm.e -= info->q == Q_Right ? rect.x1 : (rect.x1 - rect.x0) / 2;
}
return create_text_buffer(ctx, clip, info, &atm, text);
@@ -793,7 +792,7 @@ static fz_buffer *create_text_appearance(pdf_document *doc, fz_rect *bbox, fz_ma
fz_var(fztmp);
fz_try(ctx)
{
- float ascent, descent;
+ float ascent, descent;
fz_matrix tm;
variable = (info->font_rec.da_rec.font_size == 0);
@@ -941,7 +940,7 @@ static void update_marked_content(pdf_document *doc, pdf_xobject *form, fz_buffe
fz_stream *str_outer = NULL;
fz_stream *str_inner = NULL;
unsigned char *buf;
- int len;
+ int len;
fz_buffer *newbuf = NULL;
pdf_lexbuf_init(ctx, &lbuf, PDF_LEXBUF_SMALL);
@@ -1546,7 +1545,7 @@ void pdf_field_reset(pdf_document *doc, pdf_obj *field)
* FIXME: we assume for now that V has not been set unequal
* to DV higher in the hierarchy than "field".
*
- * At the bottom of the hierarchy we may find widget annotations
+ * At the bottom of the hierarchy we may find widget annotations
* that aren't also fields, but DV and V will not be present in their
* dictionaries, and attempts to remove V will be harmless. */
pdf_obj *dv = pdf_dict_gets(field, "DV");
@@ -1943,7 +1942,7 @@ static void toggle_check_box(pdf_document *doc, pdf_obj *obj)
}
else
{
- pdf_obj *n, *key = NULL;
+ pdf_obj *n, *key = NULL;
int len, i;
n = pdf_dict_getp(obj, "AP/N");
@@ -2020,7 +2019,7 @@ int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event)
{
pdf_annot *annot;
pdf_hotspot *hp = &doc->hotspot;
- fz_point *pt = &(ui_event->event.pointer.pt);
+ fz_point *pt = &(ui_event->event.pointer.pt);
int changed = 0;
for (annot = page->annots; annot; annot = annot->next)
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c
index b4593126..1acef7df 100644
--- a/pdf/pdf_interpret.c
+++ b/pdf/pdf_interpret.c
@@ -264,7 +264,7 @@ pdf_is_hidden_ocg(pdf_obj *ocg, pdf_csi *csi, pdf_obj *rdb)
{
combine = 3;
}
- else /* Assume it's the default (AnyOn) */
+ else /* Assume it's the default (AnyOn) */
{
combine = 0;
}
diff --git a/pdf/pdf_js.c b/pdf/pdf_js.c
index 6d72121c..6e71f528 100644
--- a/pdf/pdf_js.c
+++ b/pdf/pdf_js.c
@@ -15,7 +15,7 @@ struct pdf_js_s
static pdf_jsimp_obj *app_alert(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[])
{
- pdf_js *js = (pdf_js *)jsctx;
+ pdf_js *js = (pdf_js *)jsctx;
fz_context *ctx = js->doc->ctx;
pdf_jsimp_obj *cMsg_obj = NULL;
pdf_jsimp_obj *nIcon_obj = NULL;
@@ -186,9 +186,9 @@ static pdf_obj *load_color(fz_context *ctx, pdf_jsimp *imp, pdf_jsimp_obj *val)
static pdf_jsimp_obj *field_buttonSetCaption(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[])
{
- pdf_js *js = (pdf_js *)jsctx;
+ pdf_js *js = (pdf_js *)jsctx;
pdf_obj *field = (pdf_obj *)obj;
- char *name;
+ char *name;
if (argc != 1)
return NULL;
@@ -448,7 +448,7 @@ static char *utf8_to_pdf(fz_context *ctx, char *utf8)
static pdf_jsimp_obj *doc_getField(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[])
{
- pdf_js *js = (pdf_js *)jsctx;
+ pdf_js *js = (pdf_js *)jsctx;
fz_context *ctx = js->doc->ctx;
pdf_obj *dict = NULL;
char *utf8;
@@ -513,7 +513,7 @@ static void reset_field(pdf_js *js, pdf_jsimp_obj *item)
static pdf_jsimp_obj *doc_resetForm(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[])
{
- pdf_js *js = (pdf_js *)jsctx;
+ pdf_js *js = (pdf_js *)jsctx;
fz_context *ctx = js->doc->ctx;
pdf_jsimp_obj *arr = NULL;
pdf_jsimp_obj *elem = NULL;
@@ -581,7 +581,7 @@ static pdf_jsimp_obj *doc_resetForm(void *jsctx, void *obj, int argc, pdf_jsimp_
static pdf_jsimp_obj *doc_print(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[])
{
- pdf_js *js = (pdf_js *)jsctx;
+ pdf_js *js = (pdf_js *)jsctx;
pdf_event_issue_print(js->doc);
@@ -590,7 +590,7 @@ static pdf_jsimp_obj *doc_print(void *jsctx, void *obj, int argc, pdf_jsimp_obj
static pdf_jsimp_obj *doc_mailDoc(void *jsctx, void *obj, int argc, pdf_jsimp_obj *args[])
{
- pdf_js *js = (pdf_js *)jsctx;
+ pdf_js *js = (pdf_js *)jsctx;
fz_context *ctx = js->doc->ctx;
pdf_jsimp_obj *bUI_obj = NULL;
pdf_jsimp_obj *cTo_obj = NULL;
@@ -689,8 +689,8 @@ static pdf_jsimp_obj *doc_mailDoc(void *jsctx, void *obj, int argc, pdf_jsimp_ob
}
static void declare_dom(pdf_js *js)
-{
- pdf_jsimp *imp = js->imp;
+
+ pdf_jsimp *imp = js->imp;
/* Create the document type */
js->doctype = pdf_jsimp_new_type(imp, NULL);
@@ -748,7 +748,7 @@ static void preload_helpers(pdf_js *js)
pdf_js *pdf_new_js(pdf_document *doc)
{
fz_context *ctx = doc->ctx;
- pdf_js *js = NULL;
+ pdf_js *js = NULL;
fz_var(js);
fz_try(ctx)
@@ -784,7 +784,7 @@ void pdf_js_load_document_level(pdf_js *js)
{
pdf_document *doc = js->doc;
fz_context *ctx = doc->ctx;
- pdf_obj *javascript = NULL;
+ pdf_obj *javascript = NULL;
char *codebuf = NULL;
fz_var(javascript);
@@ -896,4 +896,4 @@ void pdf_js_execute_count(pdf_js *js, char *code, int count)
int pdf_js_supported()
{
return 1;
-} \ No newline at end of file
+}
diff --git a/pdf/pdf_object.c b/pdf/pdf_object.c
index a28743d1..ab6968c6 100644
--- a/pdf/pdf_object.c
+++ b/pdf/pdf_object.c
@@ -1193,7 +1193,8 @@ static inline int iswhite(int ch)
static inline int isdelim(int ch)
{
- return ch == '(' || ch == ')' ||
+ return
+ ch == '(' || ch == ')' ||
ch == '<' || ch == '>' ||
ch == '[' || ch == ']' ||
ch == '{' || ch == '}' ||
diff --git a/pdf/pdf_write.c b/pdf/pdf_write.c
index d00e154a..a674db9c 100644
--- a/pdf/pdf_write.c
+++ b/pdf/pdf_write.c
@@ -8,23 +8,25 @@
typedef struct pdf_write_options_s pdf_write_options;
-/* As part of linearization, we need to keep a list of what objects are used
- * by what page. We do this by recording the objects used in a given page
- * in a page_objects structure. We have a list of these structures (one per
- * page) in the page_objects_list structure.
- *
- * The page_objects structure maintains a heap in the object array, so
- * insertion takes log n time, and we can heapsort and dedupe at the end for
- * a total worse case n log n time.
- *
- * The magic heap invariant is that:
- * entry[n] >= entry[(n+1)*2-1] & entry[n] >= entry[(n+1)*2]
- * or equivalently:
- * entry[(n-1)>>1] >= entry[n]
- *
- * For a discussion of the heap data structure (and heapsort) see Kingston,
- * "Algorithms and Data Structures".
- */
+/*
+ As part of linearization, we need to keep a list of what objects are used
+ by what page. We do this by recording the objects used in a given page
+ in a page_objects structure. We have a list of these structures (one per
+ page) in the page_objects_list structure.
+
+ The page_objects structure maintains a heap in the object array, so
+ insertion takes log n time, and we can heapsort and dedupe at the end for
+ a total worse case n log n time.
+
+ The magic heap invariant is that:
+ entry[n] >= entry[(n+1)*2-1] & entry[n] >= entry[(n+1)*2]
+ or equivalently:
+ entry[(n-1)>>1] >= entry[n]
+
+ For a discussion of the heap data structure (and heapsort) see Kingston,
+ "Algorithms and Data Structures".
+*/
+
typedef struct {
int num_shared;
int page_object_number;
@@ -249,23 +251,26 @@ page_objects_sort(fz_context *ctx, page_objects *po)
static int
order_ge(int ui, int uj)
{
- /* For linearization, we need to order the sections as follows:
- * Remaining pages
- * Shared objects
- * Objects not associated with any page
- * (Linearization params)
- * Catalogue (and other document level objects)
- * First page
- * (Primary Hint stream) (*)
- * Any free objects
- * Note, this is NOT the same order they appear in
- * the final file!
- *
- * The PDF reference gives us the option of putting the hint stream
- * after the first page, and we take it, for simplicity.
- */
- /* If the 2 objects are in the same section, then page object comes
- * first. */
+ /*
+ For linearization, we need to order the sections as follows:
+
+ Remaining pages
+ Shared objects
+ Objects not associated with any page
+ (Linearization params)
+ Catalogue (and other document level objects)
+ First page
+ (Primary Hint stream) (*)
+ Any free objects
+
+ Note, this is NOT the same order they appear in
+ the final file!
+
+ The PDF reference gives us the option of putting the hint stream
+ after the first page, and we take it, for simplicity.
+ */
+
+ /* If the 2 objects are in the same section, then page object comes first. */
if (((ui ^ uj) & ~USE_PAGE_OBJECT) == 0)
return ((ui & USE_PAGE_OBJECT) == 0);
/* Put unused objects last */
@@ -463,7 +468,7 @@ page_objects_dump(pdf_write_options *opts)
for (j = 0; j < p->len; j++)
{
int o = p->object[j];
- fprintf(stderr, " Object %d: use=%x\n", o, opts->use_list[o]);
+ fprintf(stderr, "\tObject %d: use=%x\n", o, opts->use_list[o]);
}
fprintf(stderr, "Byte range=%d->%d\n", p->min_ofs, p->max_ofs);
fprintf(stderr, "Number of objects=%d, Number of shared objects=%d\n", p->num_objects, p->num_shared);
@@ -1536,7 +1541,7 @@ static void expandstream(pdf_document *xref, pdf_write_options *opts, pdf_obj *o
static int is_image_filter(char *s)
{
- if ( !strcmp(s, "CCITTFaxDecode") || !strcmp(s, "CCF") ||
+ if (!strcmp(s, "CCITTFaxDecode") || !strcmp(s, "CCF") ||
!strcmp(s, "DCTDecode") || !strcmp(s, "DCT") ||
!strcmp(s, "RunLengthDecode") || !strcmp(s, "RL") ||
!strcmp(s, "JBIG2Decode") ||