summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-06-29 22:58:55 +0200
committerTor Andersson <tor@ghostscript.com>2010-06-29 22:58:55 +0200
commit47375231d93cc5158a5ea18a7868409c1d5c3686 (patch)
tree491d2efce6642edee823d47e4f8de8792236b384
parent7748021cc09a52fbb12fc33d7e84806890394249 (diff)
downloadmupdf-47375231d93cc5158a5ea18a7868409c1d5c3686.tar.xz
Reformat to remove all instances of double spaces (to easier spot indentation errors in the future).
-rw-r--r--apps/pdfclean.c10
-rw-r--r--apps/pdfdraw.c28
-rw-r--r--apps/pdfextract.c2
-rw-r--r--apps/pdfinfo.c16
-rw-r--r--apps/pdfshow.c6
-rw-r--r--apps/x11_main.c8
-rw-r--r--draw/archarm.c50
-rw-r--r--draw/archx86.c12
-rw-r--r--draw/porterduff.c137
-rw-r--r--fitz/base_cpudep.c4
-rw-r--r--fitz/base_matrix.c34
-rw-r--r--fitz/base_unicode.c77
-rw-r--r--fitz/crypt_arc4.c10
-rw-r--r--fitz/crypt_md5.c8
-rw-r--r--fitz/filt_faxdtab.c9
-rw-r--r--fitz/filt_jbig2d.c16
-rw-r--r--fitz/filt_predict.c6
-rw-r--r--fitz/res_font.c8
-rw-r--r--fitz/res_shade.c14
-rw-r--r--fitz/util_gettimeofday.c10
-rw-r--r--mupdf/cmapdump.c26
-rw-r--r--mupdf/glyphlist.txt8
-rwxr-xr-xmupdf/glyphmorf.py2
-rw-r--r--mupdf/pdf_cmap.c18
-rw-r--r--mupdf/pdf_debug.c6
-rw-r--r--mupdf/pdf_font.c36
-rw-r--r--mupdf/pdf_fontagl.c8
-rw-r--r--mupdf/pdf_function.c4
-rw-r--r--mupdf/pdf_open.c4
-rw-r--r--mupdf/pdf_shade.c45
-rw-r--r--mupdf/pdf_xref.c2
31 files changed, 304 insertions, 320 deletions
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 021eb2bc..0fd9512a 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -253,9 +253,9 @@ static void cleanusage(void)
{
fprintf(stderr,
"usage: pdfclean [options] input.pdf [outfile.pdf] [pages]\n"
- " -p -\tpassword for decryption\n"
- " -g \tgarbage collect unused objects\n"
- " -x \texpand compressed streams\n");
+ "\t-p -\tpassword for decryption\n"
+ "\t-g\tgarbage collect unused objects\n"
+ "\t-x\texpand compressed streams\n");
exit(1);
}
@@ -341,8 +341,8 @@ int main(int argc, char **argv)
fz_dropobj(pages);
/* Create a new kids array too add into pages dict
- since each element must be replaced to point to
- a retained page */
+ * since each element must be replaced to point to
+ * a retained page */
kids = fz_newarray(1);
count = 0;
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index 40faba0f..45079ffb 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -1,9 +1,9 @@
/*
* pdfdraw:
- * Draw pages to PPM bitmaps.
- * Dump parsed display list as XML.
- * Dump text content as UTF-8.
- * Benchmark rendering speed.
+ * Draw pages to PPM bitmaps.
+ * Dump parsed display list as XML.
+ * Dump text content as UTF-8.
+ * Benchmark rendering speed.
*/
#include "pdftool.h"
@@ -57,16 +57,16 @@ static void drawusage(void)
{
fprintf(stderr,
"usage: pdfdraw [options] [file.pdf pages ... ]\n"
- " -p -\tpassword for decryption\n"
- " -o -\tpattern (%%d for page number) for output file\n"
- " -r -\tresolution in dpi\n"
- " -m\tprint benchmark results\n"
- " -g\toutput a pgm rather than a pnm\n"
- " -s\tprint MD5 checksum of page pixel data\n"
- " -t\ttext extraction mode\n"
- " -x\txml trace mode\n"
- " example:\n"
- " pdfdraw -o output%%03d.pnm input.pdf 1-3,5,9-\n");
+ "\t-p -\tpassword for decryption\n"
+ "\t-o -\tpattern (%%d for page number) for output file\n"
+ "\t-r -\tresolution in dpi\n"
+ "\t-m\tprint benchmark results\n"
+ "\t-g\toutput a pgm rather than a pnm\n"
+ "\t-s\tprint MD5 checksum of page pixel data\n"
+ "\t-t\ttext extraction mode\n"
+ "\t-x\txml trace mode\n"
+ "example:\n"
+ "\tpdfdraw -o output%%03d.pnm input.pdf 1-3,5,9-\n");
exit(1);
}
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index 297fdbe5..9da182d7 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -7,7 +7,7 @@
static void showusage(void)
{
fprintf(stderr, "usage: pdfextract [-p password] <file> [object numbers]\n");
- fprintf(stderr, " -p \tpassword\n");
+ fprintf(stderr, "\t-p\tpassword\n");
exit(1);
}
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index 7702f25b..49b156ec 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -158,15 +158,13 @@ infousage(void)
{
fprintf(stderr,
"usage: pdfinfo [options] [file.pdf ... ]\n"
- " -d -\tpassword for decryption\n"
- " -f -\tlist fonts\n"
- " -i -\tlist images\n"
- " -m -\tlist dimensions\n"
- " -p -\tlist patterns\n"
- " -s -\tlist shadings\n"
- " -x -\tlist form and postscript xobjects\n"
- " example:\n"
- " pdfinfo -p mypassword a.pdf\n");
+ "\t-d -\tpassword for decryption\n"
+ "\t-f\tlist fonts\n"
+ "\t-i\tlist images\n"
+ "\t-m\tlist dimensions\n"
+ "\t-p\tlist patterns\n"
+ "\t-s\tlist shadings\n"
+ "\t-x\tlist form and postscript xobjects\n");
exit(1);
}
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index e73f0644..0e91a0af 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -11,9 +11,9 @@ static int showcolumn;
static void showusage(void)
{
fprintf(stderr, "usage: pdfshow [-bc] [-p password] <file> [xref] [trailer] [object numbers]\n");
- fprintf(stderr, " -b \tprint streams as binary data (don't pretty-print)\n");
- fprintf(stderr, " -c \tprint compressed streams (don't decompress)\n");
- fprintf(stderr, " -p \tpassword for encrypted files\n");
+ fprintf(stderr, "\t-b\tprint streams as binary data (don't pretty-print)\n");
+ fprintf(stderr, "\t-c\tprint compressed streams (don't decompress)\n");
+ fprintf(stderr, "\t-p\tpassword for encrypted files\n");
exit(1);
}
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 6368daaf..4692f16b 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -252,12 +252,6 @@ static void fillrect(int x, int y, int w, int h)
XFillRectangle(xdpy, xwin, xgc, x, y, w, h);
}
-void windrawrect(pdfapp_t *app, fz_bbox rect, int color)
-{
- XSetForeground(xdpy, xgc, WhitePixel(xdpy, xscr));
- XFillRectangle(xdpy, xwin, xgc, rect.x0, rect.y0, rect.x1 - rect.x0, rect.y1 - rect.y0);
-}
-
static void winblit(pdfapp_t *app)
{
int x0 = gapp.panx;
@@ -475,7 +469,7 @@ void winreloadfile(pdfapp_t *app)
fd = open(filename, O_BINARY | O_RDONLY, 0666);
if (fd < 0)
- winerror(app, fz_throw("cannot reload file '%s'", filename));
+ winerror(app, fz_throw("cannot reload file '%s'", filename));
pdfapp_open(app, filename, fd);
}
diff --git a/draw/archarm.c b/draw/archarm.c
index 2904ce00..c601a70c 100644
--- a/draw/archarm.c
+++ b/draw/archarm.c
@@ -16,11 +16,11 @@ extern void fz_scol4_arm(byte *src, byte *dst, int w, int denom);
static void
path_w4i1o4_arm(byte * restrict rgba, byte * restrict src, byte cov, int len, byte * restrict dst)
{
- /* The ARM code here is a hand coded implementation
- * of the optimized C version. */
+ /* The ARM code here is a hand coded implementation of the optimized C version. */
if (len <= 0)
return;
+
asm volatile(
"ldr %0, [%0] @ %0 = rgba \n"
"mov r11,#0 \n"
@@ -34,7 +34,7 @@ path_w4i1o4_arm(byte * restrict rgba, byte * restrict src, byte cov, int len, by
"bic %0, %0, r8 @ %0 = rb \n"
"mov r6, r6, LSR #8 @ r6 = ga \n"
"cmp r14,#256 @ if (alpha == 256) \n"
- "beq 4f @ no-alpha loop \n"
+ "beq 4f @ no-alpha loop \n"
"B 2f @ enter the loop \n"
"1: @ Loop used for when coverage*alpha == 0 \n"
"subs %3, %3, #1 @ len-- \n"
@@ -48,7 +48,7 @@ path_w4i1o4_arm(byte * restrict rgba, byte * restrict src, byte cov, int len, by
"beq 1b @ if coverage == 0 loop back \n"
"add r10,%2, %2, LSR #7 @ r10= ca = cov+(cov>>7) \n"
"mul r10,r14,r10 @ r10= ca *= alpha \n"
- "and r7, r8, r9 @ r7 = dga = drb & MASK \n"
+ "and r7, r8, r9 @ r7 = dga = drb & MASK \n"
"mov r10,r10,LSR #8 @ r10= ca >>= 8 \n"
"and r9, r8, r9, LSL #8 @ r9 = drb = (drb<<8) & MASK \n"
"sub r12,r6, r7, LSR #8 @ r12= cga = ga - (dga>>8) \n"
@@ -77,9 +77,9 @@ path_w4i1o4_arm(byte * restrict rgba, byte * restrict src, byte cov, int len, by
"ands %2, %2, #255 @ %2 = cov &= 255 \n"
"beq 4b @ if coverage == 0 loop back \n"
"cmp %2, #255 @ if coverage == solid \n"
- "beq 3b @ loop back \n"
+ "beq 3b @ loop back \n"
"add r10,%2, %2, LSR #7 @ r10= ca = cov+(cov>>7) \n"
- "and r7, r8, r9 @ r7 = dga = drb & MASK \n"
+ "and r7, r8, r9 @ r7 = dga = drb & MASK \n"
"and r9, r8, r9, LSL #8 @ r9 = dga = (drb<<8) & MASK \n"
"sub r12,r6, r7, LSR #8 @ r12= cga = ga - (dga>>8) \n"
"sub r5, %0, r9, LSR #8 @ r5 = crb = rb - (drb>>8) \n"
@@ -138,12 +138,12 @@ static void loadtile8_arm(byte * restrict src, int sw, byte * restrict dst, int
"SUBS %[h],%[h],#1 \n"
"BGT 1b \n"
:
- [src] "+r" (src),
- [sw] "+r" (sw),
- [dst] "+r" (dst),
- [dw] "+r" (dw),
- [h] "+r" (h),
- [w] "+r" (w)
+ [src] "+r" (src),
+ [sw] "+r" (sw),
+ [dst] "+r" (dst),
+ [dw] "+r" (dw),
+ [h] "+r" (h),
+ [w] "+r" (w)
:
:
"r4","r5","r11","memory","cc"
@@ -172,12 +172,12 @@ static void loadtile8_arm(byte * restrict src, int sw, byte * restrict dst, int
"SUBS %[h],%[h],#1 \n"
"BGT 1b \n"
:
- [src] "+r" (src),
- [sw] "+r" (sw),
- [dst] "+r" (dst),
- [dw] "+r" (dw),
- [h] "+r" (h),
- [w] "+r" (w)
+ [src] "+r" (src),
+ [sw] "+r" (sw),
+ [dst] "+r" (dst),
+ [dw] "+r" (dw),
+ [h] "+r" (h),
+ [w] "+r" (w)
:
:
"r4","r5","r6","r7","r8","r11","memory","cc"
@@ -205,13 +205,13 @@ static void loadtile8_arm(byte * restrict src, int sw, byte * restrict dst, int
"subs %[h], %[h], #1 \n"
"bgt 1b \n"
:
- [src] "+r" (src),
- [sw] "+r" (sw),
- [dst] "+r" (dst),
- [dw] "+r" (dw),
- [h] "+r" (h),
- [w] "+r" (w),
- [pad] "+r" (pad)
+ [src] "+r" (src),
+ [sw] "+r" (sw),
+ [dst] "+r" (dst),
+ [dw] "+r" (dw),
+ [h] "+r" (h),
+ [w] "+r" (w),
+ [pad] "+r" (pad)
:
:
"r7","r8","r9","r10","r14","memory","cc"
diff --git a/draw/archx86.c b/draw/archx86.c
index 5418e9f7..6bdb1f6b 100644
--- a/draw/archx86.c
+++ b/draw/archx86.c
@@ -15,14 +15,6 @@ shouldn't require anything */
static void duff_4i1o4mmx(byte *sp0, int sw, byte *mp0, int mw, byte *dp0, int dw, int w0, int h)
{
- /*
- rendering all pages of
- x11pdf ~/doc/OpenGL/Presentations/CEDEC2003_Venus_and_Vulcan.pdf
- % cumulative self self total
- time seconds seconds calls ms/call ms/call name
- 30.50 20.04 20.04 261 76.76 76.76 duff_4i1o4
- 21.67 22.02 10.95 221 49.55 49.55 duff_4i1o4mmx
- */
__m64 mzero = _mm_setzero_si64();
while (h--)
{
@@ -224,13 +216,13 @@ static void img_4o4mmx(FZ_PSRC, FZ_PDST, FZ_PCTM)
void
fz_acceleratearch(void)
{
-# ifdef HAVE_MMX
+#ifdef HAVE_MMX
if (fz_cpuflags & HAVE_MMX)
{
fz_duff_4i1o4 = duff_4i1o4mmx;
// TODO fz_img_4o4 = img_4o4mmx;
}
-# endif
+#endif
}
#endif
diff --git a/draw/porterduff.c b/draw/porterduff.c
index 05f00f63..d36dcfe6 100644
--- a/draw/porterduff.c
+++ b/draw/porterduff.c
@@ -1,73 +1,74 @@
#include "fitz.h"
/*
- * The functions in this file implement various flavours of Porter-Duff
- * blending.
- *
- * We take the following as definitions:
- *
- * Cx = Color (from plane x)
- * ax = Alpha (from plane x)
- * cx = Cx.ax = Premultiplied color (from plane x)
- *
- * The general PorterDuff blending equation is:
- *
- * Blend Z = X op Y cz = Fx.cx + Fy. cy where Fx and Fy depend on op
- *
- * The two operations we use in this file are: '(X in Y) over Z' and
- * 'S over Z'. The definitions of the 'over' and 'in' operations are as
- * follows:
- *
- * For S over Z, Fs = 1, Fz = 1-as
- * For X in Y, Fx = ay, Fy = 0
- *
- * We have 2 choices; we can either work with premultiplied data, or non
- * premultiplied data. Our
- *
- * First the premultiplied case:
- *
- * Let S = (X in Y)
- * Let R = (X in Y) over Z = S over Z
- *
- * cs = cx.Fx + cy.Fy (where Fx = ay, Fy = 0)
- * = cx.ay
- * as = ax.Fx + ay.Fy
- * = ax.ay
- *
- * cr = cs.Fs + cz.Fz (where Fs = 1, Fz = 1-as)
- * = cs + cz.(1-as)
- * = cx.ay + cz.(1-ax.ay)
- * ar = as.Fs + az.Fz
- * = as + az.(1-as)
- * = ax.ay + az.(1-ax.ay)
- *
- * This has various nice properties, like not needing any divisions, and
- * being symmetric in color and alpha, so this is what we use. Because we
- * went through the pain of deriving the non premultiplied forms, we list
- * them here too, though they are not used.
- *
- * Non Pre-multiplied case:
- *
- * Cs.as = Fx.Cx.ax + Fy.Cy.ay (where Fx = ay, Fy = 0)
- * = Cx.ay.ax
- * Cs = (Cx.ay.ax)/(ay.ax)
- * = Cx
- * Cr.ar = Fs.Cs.as + Fz.Cz.az (where Fs = 1, Fz = 1-as)
- * = Cs.as + (1-as).Cz.az
- * = Cx.ax.ay + Cz.az.(1-ax.ay)
- * Cr = (Cx.ax.ay + Cz.az.(1-ax.ay))/(ax.ay + az.(1-ax-ay))
- *
- * Much more complex, it seems. However, if we could restrict ourselves to
- * the case where we were always plotting onto an opaque background (i.e.
- * az = 1), then:
- *
- * Cr = Cx.(ax.ay) + Cz.(1-ax.ay)
- * = (Cx-Cz)*(1-ax.ay) + Cz (a single MLA operation)
- * ar = 1
- *
- * Sadly, this is not true in the general case, so we abandon this effort
- * and stick to using the premultiplied form.
- */
+
+The functions in this file implement various flavours of Porter-Duff blending.
+
+We take the following as definitions:
+
+ Cx = Color (from plane x)
+ ax = Alpha (from plane x)
+ cx = Cx.ax = Premultiplied color (from plane x)
+
+The general PorterDuff blending equation is:
+
+ Blend Z = X op Y cz = Fx.cx + Fy. cy where Fx and Fy depend on op
+
+The two operations we use in this file are: '(X in Y) over Z' and
+'S over Z'. The definitions of the 'over' and 'in' operations are as
+follows:
+
+ For S over Z, Fs = 1, Fz = 1-as
+ For X in Y, Fx = ay, Fy = 0
+
+We have 2 choices; we can either work with premultiplied data, or non
+premultiplied data. Our
+
+First the premultiplied case:
+
+ Let S = (X in Y)
+ Let R = (X in Y) over Z = S over Z
+
+ cs = cx.Fx + cy.Fy (where Fx = ay, Fy = 0)
+ = cx.ay
+ as = ax.Fx + ay.Fy
+ = ax.ay
+
+ cr = cs.Fs + cz.Fz (where Fs = 1, Fz = 1-as)
+ = cs + cz.(1-as)
+ = cx.ay + cz.(1-ax.ay)
+ ar = as.Fs + az.Fz
+ = as + az.(1-as)
+ = ax.ay + az.(1-ax.ay)
+
+This has various nice properties, like not needing any divisions, and
+being symmetric in color and alpha, so this is what we use. Because we
+went through the pain of deriving the non premultiplied forms, we list
+them here too, though they are not used.
+
+Non Pre-multiplied case:
+
+ Cs.as = Fx.Cx.ax + Fy.Cy.ay (where Fx = ay, Fy = 0)
+ = Cx.ay.ax
+ Cs = (Cx.ay.ax)/(ay.ax)
+ = Cx
+ Cr.ar = Fs.Cs.as + Fz.Cz.az (where Fs = 1, Fz = 1-as)
+ = Cs.as + (1-as).Cz.az
+ = Cx.ax.ay + Cz.az.(1-ax.ay)
+ Cr = (Cx.ax.ay + Cz.az.(1-ax.ay))/(ax.ay + az.(1-ax-ay))
+
+Much more complex, it seems. However, if we could restrict ourselves to
+the case where we were always plotting onto an opaque background (i.e.
+az = 1), then:
+
+ Cr = Cx.(ax.ay) + Cz.(1-ax.ay)
+ = (Cx-Cz)*(1-ax.ay) + Cz (a single MLA operation)
+ ar = 1
+
+Sadly, this is not true in the general case, so we abandon this effort
+and stick to using the premultiplied form.
+
+*/
typedef unsigned char byte;
@@ -115,7 +116,7 @@ duff_nimon(byte * restrict sp, int sw, int sn, byte * restrict mp, int mw, int m
int w = w0;
while (w--)
{
- int ma = mp[0];
+ int ma = mp[0];
int ssa = 255-fz_mul255(sp[sn-1], ma);
for (k = 0; k < sn; k++)
{
diff --git a/fitz/base_cpudep.c b/fitz/base_cpudep.c
index f17d6a25..586a478a 100644
--- a/fitz/base_cpudep.c
+++ b/fitz/base_cpudep.c
@@ -53,7 +53,7 @@ static void mmx(void)
static void m3dnow(void)
{ __asm__ ("pavgusb %mm0, %mm0\n\t"); }
-static void mmxext(void) /* aka Extended 3DNow! */
+static void mmxext(void) /* aka Extended 3DNow! */
{ __asm__ ("pmaxsw %mm0, %mm0\n\t"); }
static void sse(void)
@@ -73,7 +73,7 @@ static void mmx(void)
static void m3dnow(void)
{ __asm pavgusb mm0, mm0; }
-static void mmxext(void) /* aka Extended 3DNow! */
+static void mmxext(void) /* aka Extended 3DNow! */
{ __asm pmaxsw mm0, mm0; }
static void sse(void)
diff --git a/fitz/base_matrix.c b/fitz/base_matrix.c
index 7124ad0d..7fd6009b 100644
--- a/fitz/base_matrix.c
+++ b/fitz/base_matrix.c
@@ -22,17 +22,17 @@ void fz_invert3x3(float *dst, float *m)
det = 1;
det = 1 / det;
- M3(dst,0,0) = M3(m,1,1) * M3(m,2,2) - M3(m,1,2) * M3(m,2,1);
+ M3(dst,0,0) = M3(m,1,1) * M3(m,2,2) - M3(m,1,2) * M3(m,2,1);
M3(dst,0,1) = -M3(m,0,1) * M3(m,2,2) + M3(m,0,2) * M3(m,2,1);
- M3(dst,0,2) = M3(m,0,1) * M3(m,1,2) - M3(m,0,2) * M3(m,1,1);
+ M3(dst,0,2) = M3(m,0,1) * M3(m,1,2) - M3(m,0,2) * M3(m,1,1);
M3(dst,1,0) = -M3(m,1,0) * M3(m,2,2) + M3(m,1,2) * M3(m,2,0);
- M3(dst,1,1) = M3(m,0,0) * M3(m,2,2) - M3(m,0,2) * M3(m,2,0);
+ M3(dst,1,1) = M3(m,0,0) * M3(m,2,2) - M3(m,0,2) * M3(m,2,0);
M3(dst,1,2) = -M3(m,0,0) * M3(m,1,2) + M3(m,0,2) * M3(m,1,0);
- M3(dst,2,0) = M3(m,1,0) * M3(m,2,1) - M3(m,1,1) * M3(m,2,0);
+ M3(dst,2,0) = M3(m,1,0) * M3(m,2,1) - M3(m,1,1) * M3(m,2,0);
M3(dst,2,1) = -M3(m,0,0) * M3(m,2,1) + M3(m,0,1) * M3(m,2,0);
- M3(dst,2,2) = M3(m,0,0) * M3(m,1,1) - M3(m,0,1) * M3(m,1,0);
+ M3(dst,2,2) = M3(m,0,0) * M3(m,1,1) - M3(m,0,1) * M3(m,1,0);
for (i = 0; i < 9; i++)
dst[i] *= det;
@@ -55,9 +55,9 @@ fz_matrix
fz_identity(void)
{
fz_matrix m;
- m.a = 1; m.b = 0;
- m.c = 0; m.d = 1;
- m.e = 0; m.f = 0;
+ m.a = 1; m.b = 0;
+ m.c = 0; m.d = 1;
+ m.e = 0; m.f = 0;
return m;
}
@@ -65,9 +65,9 @@ fz_matrix
fz_scale(float sx, float sy)
{
fz_matrix m;
- m.a = sx; m.b = 0;
- m.c = 0; m.d = sy;
- m.e = 0; m.f = 0;
+ m.a = sx; m.b = 0;
+ m.c = 0; m.d = sy;
+ m.e = 0; m.f = 0;
return m;
}
@@ -109,9 +109,9 @@ fz_rotate(float theta)
c = cosf(theta * (float)M_PI / 180);
}
- m.a = c; m.b = s;
- m.c = -s; m.d = c;
- m.e = 0; m.f = 0;
+ m.a = c; m.b = s;
+ m.c = -s; m.d = c;
+ m.e = 0; m.f = 0;
return m;
}
@@ -119,9 +119,9 @@ fz_matrix
fz_translate(float tx, float ty)
{
fz_matrix m;
- m.a = 1; m.b = 0;
- m.c = 0; m.d = 1;
- m.e = tx; m.f = ty;
+ m.a = 1; m.b = 0;
+ m.c = 0; m.d = 1;
+ m.e = tx; m.f = ty;
return m;
}
diff --git a/fitz/base_unicode.c b/fitz/base_unicode.c
index a38dfb84..c7f8219a 100644
--- a/fitz/base_unicode.c
+++ b/fitz/base_unicode.c
@@ -2,39 +2,38 @@
enum
{
- UTFmax = 4, /* maximum bytes per rune */
- Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
- Runeself = 0x80, /* rune and UTF sequences are the same (<) */
- Runeerror = 0xFFFD, /* decoding error in UTF */
- Runemax = 0x10FFFF, /* maximum rune value */
+ UTFmax = 4, /* maximum bytes per rune */
+ Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
+ Runeself = 0x80, /* rune and UTF sequences are the same (<) */
+ Runeerror = 0xFFFD, /* decoding error in UTF */
+ Runemax = 0x10FFFF, /* maximum rune value */
};
enum
{
- Bit1 = 7,
- Bitx = 6,
- Bit2 = 5,
- Bit3 = 4,
- Bit4 = 3,
- Bit5 = 2,
-
- T1 = ((1<<(Bit1+1))-1) ^ 0xFF, /* 0000 0000 */
- Tx = ((1<<(Bitx+1))-1) ^ 0xFF, /* 1000 0000 */
- T2 = ((1<<(Bit2+1))-1) ^ 0xFF, /* 1100 0000 */
- T3 = ((1<<(Bit3+1))-1) ^ 0xFF, /* 1110 0000 */
- T4 = ((1<<(Bit4+1))-1) ^ 0xFF, /* 1111 0000 */
- T5 = ((1<<(Bit5+1))-1) ^ 0xFF, /* 1111 1000 */
-
- Rune1 = (1<<(Bit1+0*Bitx))-1, /* 0000 0000 0111 1111 */
- Rune2 = (1<<(Bit2+1*Bitx))-1, /* 0000 0111 1111 1111 */
- Rune3 = (1<<(Bit3+2*Bitx))-1, /* 1111 1111 1111 1111 */
- Rune4 = (1<<(Bit4+3*Bitx))-1,
- /* 0001 1111 1111 1111 1111 1111 */
-
- Maskx = (1<<Bitx)-1, /* 0011 1111 */
- Testx = Maskx ^ 0xFF, /* 1100 0000 */
-
- Bad = Runeerror,
+ Bit1 = 7,
+ Bitx = 6,
+ Bit2 = 5,
+ Bit3 = 4,
+ Bit4 = 3,
+ Bit5 = 2,
+
+ T1 = ((1<<(Bit1+1))-1) ^ 0xFF, /* 0000 0000 */
+ Tx = ((1<<(Bitx+1))-1) ^ 0xFF, /* 1000 0000 */
+ T2 = ((1<<(Bit2+1))-1) ^ 0xFF, /* 1100 0000 */
+ T3 = ((1<<(Bit3+1))-1) ^ 0xFF, /* 1110 0000 */
+ T4 = ((1<<(Bit4+1))-1) ^ 0xFF, /* 1111 0000 */
+ T5 = ((1<<(Bit5+1))-1) ^ 0xFF, /* 1111 1000 */
+
+ Rune1 = (1<<(Bit1+0*Bitx))-1, /* 0000 0000 0111 1111 */
+ Rune2 = (1<<(Bit2+1*Bitx))-1, /* 0000 0111 1111 1111 */
+ Rune3 = (1<<(Bit3+2*Bitx))-1, /* 1111 1111 1111 1111 */
+ Rune4 = (1<<(Bit4+3*Bitx))-1, /* 0001 1111 1111 1111 1111 1111 */
+
+ Maskx = (1<<Bitx)-1, /* 0011 1111 */
+ Testx = Maskx ^ 0xFF, /* 1100 0000 */
+
+ Bad = Runeerror,
};
int
@@ -45,7 +44,7 @@ chartorune(int *rune, char *str)
/*
* one character sequence
- * 00000-0007F => T1
+ * 00000-0007F => T1
*/
c = *(unsigned char*)str;
if(c < Tx) {
@@ -55,7 +54,7 @@ chartorune(int *rune, char *str)
/*
* two character sequence
- * 0080-07FF => T2 Tx
+ * 0080-07FF => T2 Tx
*/
c1 = *(unsigned char*)(str+1) ^ Tx;
if(c1 & Testx)
@@ -72,7 +71,7 @@ chartorune(int *rune, char *str)
/*
* three character sequence
- * 0800-FFFF => T3 Tx Tx
+ * 0800-FFFF => T3 Tx Tx
*/
c2 = *(unsigned char*)(str+2) ^ Tx;
if(c2 & Testx)
@@ -87,7 +86,7 @@ chartorune(int *rune, char *str)
/*
* four character sequence (21-bit value)
- * 10000-1FFFFF => T4 Tx Tx Tx
+ * 10000-1FFFFF => T4 Tx Tx Tx
*/
c3 = *(unsigned char*)(str+3) ^ Tx;
if (c3 & Testx)
@@ -121,7 +120,7 @@ runetochar(char *str, int *rune)
/*
* one character sequence
- * 00000-0007F => 00-7F
+ * 00000-0007F => 00-7F
*/
c = *rune;
if(c <= Rune1) {
@@ -131,7 +130,7 @@ runetochar(char *str, int *rune)
/*
* two character sequence
- * 0080-07FF => T2 Tx
+ * 0080-07FF => T2 Tx
*/
if(c <= Rune2) {
str[0] = T2 | (c >> 1*Bitx);
@@ -150,18 +149,18 @@ runetochar(char *str, int *rune)
/*
* three character sequence
- * 0800-FFFF => T3 Tx Tx
+ * 0800-FFFF => T3 Tx Tx
*/
if (c <= Rune3) {
- str[0] = T3 | (c >> 2*Bitx);
+ str[0] = T3 | (c >> 2*Bitx);
str[1] = Tx | ((c >> 1*Bitx) & Maskx);
- str[2] = Tx | (c & Maskx);
+ str[2] = Tx | (c & Maskx);
return 3;
}
/*
* four character sequence (21-bit value)
- * 10000-1FFFFF => T4 Tx Tx Tx
+ * 10000-1FFFFF => T4 Tx Tx Tx
*/
str[0] = T4 | (c >> 3*Bitx);
str[1] = Tx | ((c >> 2*Bitx) & Maskx);
diff --git a/fitz/crypt_arc4.c b/fitz/crypt_arc4.c
index f53505cf..475c5f89 100644
--- a/fitz/crypt_arc4.c
+++ b/fitz/crypt_arc4.c
@@ -1,7 +1,7 @@
-/* This code illustrates a sample implementation
- * of the Arcfour algorithm
- * Copyright (c) April 29, 1997 Kalle Kaukonen.
- * All Rights Reserved.
+/* This code illustrates a sample implementation
+ * of the Arcfour algorithm
+ * Copyright (c) April 29, 1997 Kalle Kaukonen.
+ * All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that this copyright
@@ -10,7 +10,7 @@
* THIS SOFTWARE IS PROVIDED BY KALLE KAUKONEN AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KALLE
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KALLE
* KAUKONEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
diff --git a/fitz/crypt_md5.c b/fitz/crypt_md5.c
index 37f0822a..0a2dc798 100644
--- a/fitz/crypt_md5.c
+++ b/fitz/crypt_md5.c
@@ -29,7 +29,7 @@ documentation and/or software.
enum
{
S11 = 7, S12 = 12, S13 = 17, S14 = 22,
- S21 = 5, S22 = 9, S23 = 14, S24 = 20,
+ S21 = 5, S22 = 9, S23 = 14, S24 = 20,
S31 = 4, S32 = 11, S33 = 16, S34 = 23,
S41 = 6, S42 = 10, S43 = 15, S44 = 21
};
@@ -138,7 +138,7 @@ static void transform(unsigned int state[4], const unsigned char block[64])
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
- GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
+ GG (d, a, b, c, x[10], S22, 0x02441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
@@ -162,7 +162,7 @@ static void transform(unsigned int state[4], const unsigned char block[64])
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
+ HH (b, c, d, a, x[ 6], S34, 0x04881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
@@ -225,7 +225,7 @@ void fz_md5update(fz_md5 *context, const unsigned char *input, const unsigned in
partlen = 64 - index;
- /* Transform as many times as possible. */
+ /* Transform as many times as possible. */
if (inlen >= partlen)
{
memcpy(context->buffer + index, input, partlen);
diff --git a/fitz/filt_faxdtab.c b/fitz/filt_faxdtab.c
index 6efcf053..b1ad0b25 100644
--- a/fitz/filt_faxdtab.c
+++ b/fitz/filt_faxdtab.c
@@ -1,8 +1,9 @@
/* Tables for CCITTFaxDecode filter. */
-
-/* This file was generated automatically. It is governed by the same terms */
-/* as the files scfetab.c and scfdgen.c from which it was derived. */
-/* Consult those files for the licensing terms and conditions. */
+/*
+This file was generated automatically. It is governed by the same terms
+as the files scfetab.c and scfdgen.c from which it was derived.
+Consult those files for the licensing terms and conditions.
+*/
#include "filt_faxd.h"
diff --git a/fitz/filt_jbig2d.c b/fitz/filt_jbig2d.c
index 39015279..100eba05 100644
--- a/fitz/filt_jbig2d.c
+++ b/fitz/filt_jbig2d.c
@@ -14,14 +14,14 @@
#ifdef _WIN32 /* Microsoft Visual C++ */
-typedef signed char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef __int64 int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
+typedef signed char int8_t;
+typedef short int int16_t;
+typedef int int32_t;
+typedef __int64 int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
#else
#include <inttypes.h>
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c
index 07470647..32a9c8d9 100644
--- a/fitz/filt_predict.c
+++ b/fitz/filt_predict.c
@@ -176,7 +176,7 @@ fz_predictpng(fz_predict *p, unsigned char *in, unsigned char *out, int predicto
}
for (i = p->stride - bpp; i > 0; i--)
{
- *out++ = *in++ + *ref++;
+ *out++ = *in++ + *ref++;
}
break;
case 3:
@@ -186,8 +186,8 @@ fz_predictpng(fz_predict *p, unsigned char *in, unsigned char *out, int predicto
}
for (i = p->stride - bpp; i > 0; i--)
{
- *out = *in++ + (out[-bpp] + *ref++)/2;
- out++;
+ *out = *in++ + (out[-bpp] + *ref++)/2;
+ out++;
}
break;
case 4:
diff --git a/fitz/res_font.c b/fitz/res_font.c
index 933b732e..448484c9 100644
--- a/fitz/res_font.c
+++ b/fitz/res_font.c
@@ -392,19 +392,19 @@ fz_debugfont(fz_font *font)
if (font->ftface)
{
- printf(" freetype face %p\n", font->ftface);
+ printf("\tfreetype face %p\n", font->ftface);
if (font->ftsubstitute)
- printf(" substitute font\n");
+ printf("\tsubstitute font\n");
}
if (font->t3procs)
{
- printf(" type3 matrix [%g %g %g %g]\n",
+ printf("\ttype3 matrix [%g %g %g %g]\n",
font->t3matrix.a, font->t3matrix.b,
font->t3matrix.c, font->t3matrix.d);
}
- printf(" bbox [%g %g %g %g]\n",
+ printf("\tbbox [%g %g %g %g]\n",
font->bbox.x0, font->bbox.y0,
font->bbox.x1, font->bbox.y1);
diff --git a/fitz/res_shade.c b/fitz/res_shade.c
index 4e646997..61b2f3a4 100644
--- a/fitz/res_shade.c
+++ b/fitz/res_shade.c
@@ -35,19 +35,19 @@ fz_debugshade(fz_shade *shade)
printf("shading {\n");
- printf(" bbox [%g %g %g %g]\n",
+ printf("\tbbox [%g %g %g %g]\n",
shade->bbox.x0, shade->bbox.y0,
shade->bbox.x1, shade->bbox.y1);
- printf(" colorspace %s\n", shade->cs->name);
+ printf("\tcolorspace %s\n", shade->cs->name);
- printf(" matrix [%g %g %g %g %g %g]\n",
+ printf("\tmatrix [%g %g %g %g %g %g]\n",
shade->matrix.a, shade->matrix.b, shade->matrix.c,
shade->matrix.d, shade->matrix.e, shade->matrix.f);
if (shade->usebackground)
{
- printf(" background [");
+ printf("\tbackground [");
for (i = 0; i < shade->cs->n; i++)
printf("%s%g", i == 0 ? "" : " ", shade->background[i]);
printf("]\n");
@@ -55,20 +55,20 @@ fz_debugshade(fz_shade *shade)
if (shade->usefunction)
{
- printf(" function\n");
+ printf("\tfunction\n");
n = 3;
}
else
n = 2 + shade->cs->n;
- printf(" triangles: %d\n", shade->meshlen);
+ printf("\ttriangles: %d\n", shade->meshlen);
vertex = shade->mesh;
triangle = 0;
i = 0;
while (i < shade->meshlen * 3)
{
- printf(" %d:(%g, %g): ", triangle, vertex[0], vertex[1]);
+ printf("\t%d:(%g, %g): ", triangle, vertex[0], vertex[1]);
for (j = 2; j < n; j++)
printf("%s%g", j == 2 ? "" : " ", vertex[j]);
diff --git a/fitz/util_gettimeofday.c b/fitz/util_gettimeofday.c
index 21f62f26..c016902e 100644
--- a/fitz/util_gettimeofday.c
+++ b/fitz/util_gettimeofday.c
@@ -5,15 +5,15 @@
#include <windows.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
-#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
-#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct timezone
{
- int tz_minuteswest; /* minutes W of Greenwich */
- int tz_dsttime; /* type of dst correction */
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct timezone *tz)
@@ -30,7 +30,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
- tmpres /= 10; /*convert into microseconds*/
+ tmpres /= 10; /*convert into microseconds*/
/*converting file time to unix epoch*/
tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long)(tmpres / 1000000UL);
diff --git a/mupdf/cmapdump.c b/mupdf/cmapdump.c
index 28f338c8..ed0b5531 100644
--- a/mupdf/cmapdump.c
+++ b/mupdf/cmapdump.c
@@ -111,12 +111,12 @@ main(int argc, char **argv)
fprintf(fo, "static const pdf_range pdf_cmap_%s_ranges[] =\n{\n", name);
if (cmap->rlen == 0)
{
- fprintf(fo, " /* dummy entry for non-c99 compilers */\n");
- fprintf(fo, " { 0x0, 0x0, PDF_CMAP_RANGE, 0 }\n");
+ fprintf(fo, "\t/* dummy entry for non-c99 compilers */\n");
+ fprintf(fo, "\t{ 0x0, 0x0, PDF_CMAP_RANGE, 0 }\n");
}
for (k = 0; k < cmap->rlen; k++)
{
- fprintf(fo, " { 0x%04x, 0x%04x, %s %d },\n",
+ fprintf(fo, "\t{ 0x%04x, 0x%04x, %s %d },\n",
cmap->ranges[k].low, cmap->ranges[k].high,
flagtoname(cmap->ranges[k].flag),
cmap->ranges[k].offset);
@@ -134,7 +134,7 @@ main(int argc, char **argv)
for (k = 0; k < cmap->tlen; k++)
{
if (k % 8 == 0)
- fprintf(fo, "\n ");
+ fprintf(fo, "\n\t");
fprintf(fo, "%d,", cmap->table[k]);
}
fprintf(fo, "\n};\n\n");
@@ -142,30 +142,30 @@ main(int argc, char **argv)
fprintf(fo, "pdf_cmap pdf_cmap_%s =\n", name);
fprintf(fo, "{\n");
- fprintf(fo, " -1, ");
+ fprintf(fo, "\t-1, ");
fprintf(fo, "\"%s\", ", cmap->cmapname);
fprintf(fo, "\"%s\", nil, ", cmap->usecmapname);
fprintf(fo, "%d,\n", cmap->wmode);
- fprintf(fo, " %d, /* codespace table */\n", cmap->ncspace);
- fprintf(fo, " {\n");
+ fprintf(fo, "\t%d, /* codespace table */\n", cmap->ncspace);
+ fprintf(fo, "\t{\n");
if (cmap->ncspace == 0)
{
- fprintf(fo, " /* dummy entry for non-c99 compilers */\n");
- fprintf(fo, " { 0, 0x0, 0x0 },\n");
+ fprintf(fo, "\t/* dummy entry for non-c99 compilers */\n");
+ fprintf(fo, "\t{ 0, 0x0, 0x0 },\n");
}
for (k = 0; k < cmap->ncspace; k++)
{
- fprintf(fo, "\t{ %d, 0x%04x, 0x%04x },\n",
+ fprintf(fo, "\t\t{ %d, 0x%04x, 0x%04x },\n",
cmap->cspace[k].n, cmap->cspace[k].low, cmap->cspace[k].high);
}
- fprintf(fo, " },\n");
+ fprintf(fo, "\t},\n");
- fprintf(fo, " %d, %d, (pdf_range*) pdf_cmap_%s_ranges,\n",
+ fprintf(fo, "\t%d, %d, (pdf_range*) pdf_cmap_%s_ranges,\n",
cmap->rlen, cmap->rlen, name);
- fprintf(fo, " %d, %d, (unsigned short*) pdf_cmap_%s_table,\n",
+ fprintf(fo, "\t%d, %d, (unsigned short*) pdf_cmap_%s_table,\n",
cmap->tlen, cmap->tlen, name);
fprintf(fo, "};\n\n");
diff --git a/mupdf/glyphlist.txt b/mupdf/glyphlist.txt
index 4835ef76..c7ab2905 100644
--- a/mupdf/glyphlist.txt
+++ b/mupdf/glyphlist.txt
@@ -1,12 +1,12 @@
-# Name: Adobe Glyph List
+# Name: Adobe Glyph List
# Table version: 2.0
-# Date: September 20, 2002
+# Date: September 20, 2002
#
# See http://partners.adobe.com/asn/developer/typeforum/unicodegn.html
#
# Format: Semicolon-delimited fields:
-# (1) glyph name
-# (2) Unicode scalar value
+# (1) glyph name
+# (2) Unicode scalar value
A;0041
AE;00C6
AEacute;01FC
diff --git a/mupdf/glyphmorf.py b/mupdf/glyphmorf.py
index 24954913..25b2afcc 100755
--- a/mupdf/glyphmorf.py
+++ b/mupdf/glyphmorf.py
@@ -75,7 +75,7 @@ int pdf_lookupagl(char *name)
int l = 0;
int r = nelem(aglcodes) - 1;
- strlcpy(buf, name, sizeof buf);
+ fz_strlcpy(buf, name, sizeof buf);
/* kill anything after first period and underscore */
p = strchr(buf, '.');
diff --git a/mupdf/pdf_cmap.c b/mupdf/pdf_cmap.c
index db7e411c..ba1680f1 100644
--- a/mupdf/pdf_cmap.c
+++ b/mupdf/pdf_cmap.c
@@ -114,24 +114,24 @@ pdf_debugcmap(pdf_cmap *cmap)
printf("cmap $%p /%s {\n", (void *) cmap, cmap->cmapname);
if (cmap->usecmapname[0])
- printf(" usecmap /%s\n", cmap->usecmapname);
+ printf("\tusecmap /%s\n", cmap->usecmapname);
if (cmap->usecmap)
- printf(" usecmap $%p\n", (void *) cmap->usecmap);
+ printf("\tusecmap $%p\n", (void *) cmap->usecmap);
- printf(" wmode %d\n", cmap->wmode);
+ printf("\twmode %d\n", cmap->wmode);
- printf(" codespaces {\n");
+ printf("\tcodespaces {\n");
for (i = 0; i < cmap->ncspace; i++)
{
- printf(" <%x> <%x>\n", cmap->cspace[i].low, cmap->cspace[i].high);
+ printf("\t\t<%x> <%x>\n", cmap->cspace[i].low, cmap->cspace[i].high);
}
- printf(" }\n");
+ printf("\t}\n");
- printf(" ranges (%d,%d) {\n", cmap->rlen, cmap->tlen);
+ printf("\tranges (%d,%d) {\n", cmap->rlen, cmap->tlen);
for (i = 0; i < cmap->rlen; i++)
{
pdf_range *r = &cmap->ranges[i];
- printf(" <%04x> <%04x> ", r->low, r->high);
+ printf("\t\t<%04x> <%04x> ", r->low, r->high);
if (r->flag == PDF_CMAP_TABLE)
{
printf("[ ");
@@ -150,7 +150,7 @@ pdf_debugcmap(pdf_cmap *cmap)
else
printf("%d\n", r->offset);
}
- printf(" }\n}\n");
+ printf("\t}\n}\n");
}
/*
diff --git a/mupdf/pdf_debug.c b/mupdf/pdf_debug.c
index 19d54308..881b6cce 100644
--- a/mupdf/pdf_debug.c
+++ b/mupdf/pdf_debug.c
@@ -3,8 +3,8 @@
/*
* Enable logging by setting environment variable MULOG to:
- * (a)ll or a combination of
- * (x)ref (r)src (f)ont (i)mage (s)hade (p)age
+ * (a)ll or a combination of
+ * (x)ref (r)src (f)ont (i)mage (s)hade (p)age
*
* eg. MULOG=fis ./x11pdf mytestfile.pdf
*/
@@ -59,7 +59,7 @@ static inline void pdflog(int tag, char *name, char *fmt, va_list ap)
{
printf("%s: ", name);
for (i = 0; i < level; i++)
- printf(" ");
+ printf("\t");
}
vprintf(fmt, ap);
diff --git a/mupdf/pdf_font.c b/mupdf/pdf_font.c
index 909d7286..7a53d9e7 100644
--- a/mupdf/pdf_font.c
+++ b/mupdf/pdf_font.c
@@ -121,7 +121,7 @@ static int ftwidth(pdf_fontdesc *fontdesc, int cid)
gid = ftcidtogid(fontdesc, cid);
fterr = FT_Load_Glyph(fontdesc->font->ftface, gid,
- FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM);
+ FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM);
if (fterr)
{
fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
@@ -233,7 +233,7 @@ pdf_newfontdesc(void)
* Simple fonts (Type1 and TrueType)
*/
-static fz_error
+ static fz_error
loadsimplefont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict)
{
fz_error error;
@@ -471,7 +471,7 @@ loadsimplefont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict)
}
else
{
- estrings[i] = pdf_winansi[i];
+ estrings[i] = (char*) pdf_winansi[i]; /* discard const */
}
}
}
@@ -536,7 +536,7 @@ cleanup:
* CID Fonts
*/
-static fz_error
+ static fz_error
loadcidfont(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *encoding, fz_obj *tounicode)
{
fz_error error;
@@ -811,7 +811,7 @@ cleanup:
return fz_rethrow(error, "cannot load cid font (%d %d R)", fz_tonum(dict), fz_togen(dict));
}
-static fz_error
+ static fz_error
loadtype0(pdf_fontdesc **fontdescp, pdf_xref *xref, fz_obj *dict)
{
fz_error error;
@@ -870,9 +870,7 @@ pdf_loadfontdescriptor(pdf_fontdesc *fontdesc, pdf_xref *xref, fz_obj *dict, cha
fontdesc->missingwidth = fz_toreal(fz_dictgets(dict, "MissingWidth"));
bbox = pdf_torect(fz_dictgets(dict, "FontBBox"));
- pdf_logfont("bbox [%g %g %g %g]\n",
- bbox.x0, bbox.y0,
- bbox.x1, bbox.y1);
+ pdf_logfont("bbox [%g %g %g %g]\n", bbox.x0, bbox.y0, bbox.x1, bbox.y1);
pdf_logfont("flags %d\n", fontdesc->flags);
@@ -1005,27 +1003,27 @@ pdf_debugfont(pdf_fontdesc *fontdesc)
printf("fontdesc {\n");
if (fontdesc->font->ftface)
- printf(" freetype font\n");
+ printf("\tfreetype font\n");
if (fontdesc->font->t3procs)
- printf(" type3 font\n");
+ printf("\ttype3 font\n");
- printf(" wmode %d\n", fontdesc->wmode);
- printf(" DW %d\n", fontdesc->dhmtx.w);
+ printf("\twmode %d\n", fontdesc->wmode);
+ printf("\tDW %d\n", fontdesc->dhmtx.w);
- printf(" W {\n");
+ printf("\tW {\n");
for (i = 0; i < fontdesc->nhmtx; i++)
- printf(" <%04x> <%04x> %d\n",
+ printf("\t\t<%04x> <%04x> %d\n",
fontdesc->hmtx[i].lo, fontdesc->hmtx[i].hi, fontdesc->hmtx[i].w);
- printf(" }\n");
+ printf("\t}\n");
if (fontdesc->wmode)
{
- printf(" DW2 [%d %d]\n", fontdesc->dvmtx.y, fontdesc->dvmtx.w);
- printf(" W2 {\n");
+ printf("\tDW2 [%d %d]\n", fontdesc->dvmtx.y, fontdesc->dvmtx.w);
+ printf("\tW2 {\n");
for (i = 0; i < fontdesc->nvmtx; i++)
- printf(" <%04x> <%04x> %d %d %d\n", fontdesc->vmtx[i].lo, fontdesc->vmtx[i].hi,
+ printf("\t\t<%04x> <%04x> %d %d %d\n", fontdesc->vmtx[i].lo, fontdesc->vmtx[i].hi,
fontdesc->vmtx[i].x, fontdesc->vmtx[i].y, fontdesc->vmtx[i].w);
- printf(" }\n");
+ printf("\t}\n");
}
}
diff --git a/mupdf/pdf_fontagl.c b/mupdf/pdf_fontagl.c
index 852223f2..c7754e87 100644
--- a/mupdf/pdf_fontagl.c
+++ b/mupdf/pdf_fontagl.c
@@ -1,13 +1,13 @@
/*
-# Name: Adobe Glyph List
+# Name: Adobe Glyph List
# Table version: 2.0
-# Date: September 20, 2002
+# Date: September 20, 2002
#
# See http://partners.adobe.com/asn/developer/typeforum/unicodegn.html
#
# Format: Semicolon-delimited fields:
-# (1) glyph name
-# (2) Unicode scalar value
+# (1) glyph name
+# (2) Unicode scalar value
#--end
*/
diff --git a/mupdf/pdf_function.c b/mupdf/pdf_function.c
index 7f819a69..2074fa6b 100644
--- a/mupdf/pdf_function.c
+++ b/mupdf/pdf_function.c
@@ -533,7 +533,7 @@ loadpostscriptfunc(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, in
return fz_okay;
}
-#define SAFE_RETHROW if (error) return fz_rethrow(error, "runtime error in calculator function")
+#define SAFE_RETHROW if (error) return fz_rethrow(error, "runtime error in calculator function")
#define SAFE_PUSHINT(st, a) { error = pspushint(st, a); SAFE_RETHROW; }
#define SAFE_PUSHREAL(st, a) { error = pspushreal(st, a); SAFE_RETHROW; }
#define SAFE_PUSHBOOL(st, a) { error = pspushbool(st, a); SAFE_RETHROW; }
@@ -1610,7 +1610,7 @@ pdf_debugindent(char *prefix, int level, char *suffix)
printf("%s", prefix);
for (i = 0; i < level; i++)
- printf(" ");
+ printf("\t");
printf("%s", suffix);
}
diff --git a/mupdf/pdf_open.c b/mupdf/pdf_open.c
index bd94e3dd..62149586 100644
--- a/mupdf/pdf_open.c
+++ b/mupdf/pdf_open.c
@@ -414,7 +414,7 @@ pdf_readnewxref(fz_obj **trailerp, pdf_xref *xref, char *buf, int cap)
}
}
- pdf_logxref(" num=%d gen=%d size=%d\n", num, gen, size);
+ pdf_logxref("\tnum=%d gen=%d size=%d\n", num, gen, size);
obj = fz_dictgets(trailer, "W");
if (!obj) {
@@ -573,7 +573,7 @@ pdf_loadxref(pdf_xref *xref, char *buf, int bufsize)
if (!size)
return fz_throw("trailer missing Size entry");
- pdf_logxref(" size %d at 0x%x\n", fz_toint(size), xref->startxref);
+ pdf_logxref("\tsize %d at 0x%x\n", fz_toint(size), xref->startxref);
xref->len = fz_toint(size);
xref->cap = xref->len + 1; /* for hack to allow broken pdf generators with off-by-one errors */
diff --git a/mupdf/pdf_shade.c b/mupdf/pdf_shade.c
index 1c9a9a3e..f1a6acb6 100644
--- a/mupdf/pdf_shade.c
+++ b/mupdf/pdf_shade.c
@@ -82,7 +82,8 @@ pdf_addtriangle(fz_shade *shade,
}
/* adds quad triangles (x0, y0) -> (x1, y1) -> (x3, y3) and
- (x1, y1) -> (x3, y3) -> (x2, y2) to mesh */
+ * (x1, y1) -> (x3, y3) -> (x2, y2) to mesh
+ */
static void
pdf_addquad(fz_shade *shade,
float x0, float y0, float *color0,
@@ -140,12 +141,14 @@ midpoint(float a, float b)
static inline void
split_curve(fz_point *pole, fz_point *q0, fz_point *q1, int pole_step)
{
- /* split bezier curve given by control points pole[0]..pole[3]
- using de casteljau algo at midpoint and build two new
- bezier curves q0[0]..q0[3] and q1[0]..q1[3]. all indices
- should be multiplies by pole_step == 1 for vertical bezier
- curves in patch and == 4 for horizontal bezier curves due
- to C's multi-dimensional matrix memory layout. */
+ /*
+ split bezier curve given by control points pole[0]..pole[3]
+ using de casteljau algo at midpoint and build two new
+ bezier curves q0[0]..q0[3] and q1[0]..q1[3]. all indices
+ should be multiplies by pole_step == 1 for vertical bezier
+ curves in patch and == 4 for horizontal bezier curves due
+ to C's multi-dimensional matrix memory layout.
+ */
float x12 = midpoint(pole[1 * pole_step].x, pole[2 * pole_step].x);
float y12 = midpoint(pole[1 * pole_step].y, pole[2 * pole_step].y);
@@ -174,15 +177,14 @@ split_curve(fz_point *pole, fz_point *q0, fz_point *q1, int pole_step)
static inline void
split_stripe(pdf_tensorpatch *p, pdf_tensorpatch *s0, pdf_tensorpatch *s1)
{
- /* split all horizontal bezier curves in patch, creating
- two new patches with half the width. */
+ /* split all horizontal bezier curves in patch,
+ * creating two new patches with half the width. */
split_curve(&p->pole[0][0], &s0->pole[0][0], &s1->pole[0][0], 4);
split_curve(&p->pole[0][1], &s0->pole[0][1], &s1->pole[0][1], 4);
split_curve(&p->pole[0][2], &s0->pole[0][2], &s1->pole[0][2], 4);
split_curve(&p->pole[0][3], &s0->pole[0][3], &s1->pole[0][3], 4);
- /* bilinear interpolation to find color values of corners of
- the two new patches. */
+ /* bilinear interpolation to find color values of corners of the two new patches. */
copycolor(s0->color[0], p->color[0]);
copycolor(s0->color[1], p->color[1]);
midcolor(s0->color[2], p->color[1], p->color[2]);
@@ -220,15 +222,14 @@ drawstripe(pdf_tensorpatch *p, fz_shade *shade, int ncomp, int depth)
static inline void
split_patch(pdf_tensorpatch *p, pdf_tensorpatch *s0, pdf_tensorpatch *s1)
{
- /* split all vertical bezier curves in patch, creating
- two new patches with half the height. */
+ /* split all vertical bezier curves in patch,
+ * creating two new patches with half the height. */
split_curve(p->pole[0], s0->pole[0], s1->pole[0], 1);
split_curve(p->pole[1], s0->pole[1], s1->pole[1], 1);
split_curve(p->pole[2], s0->pole[2], s1->pole[2], 1);
split_curve(p->pole[3], s0->pole[3], s1->pole[3], 1);
- /* bilinear interpolation to find color values of corners of
- the two new patches. */
+ /* bilinear interpolation to find color values of corners of the two new patches. */
copycolor(s0->color[0], p->color[0]);
midcolor(s0->color[1], p->color[0], p->color[1]);
midcolor(s0->color[2], p->color[2], p->color[3]);
@@ -278,17 +279,17 @@ pdf_computetensorinterior(
/* see equations at page 330 in pdf 1.7 */
- pt.x = -4 * a.x;
- pt.x += 6 * (b.x + c.x);
+ pt.x = -4 * a.x;
+ pt.x += 6 * (b.x + c.x);
pt.x += -2 * (d.x + e.x);
- pt.x += 3 * (f.x + g.x);
+ pt.x += 3 * (f.x + g.x);
pt.x += -1 * h.x;
pt.x /= 9;
- pt.y = -4 * a.y;
- pt.y += 6 * (b.y + c.y);
+ pt.y = -4 * a.y;
+ pt.y += 6 * (b.y + c.y);
pt.y += -2 * (d.y + e.y);
- pt.y += 3 * (f.y + g.y);
+ pt.y += 3 * (f.y + g.y);
pt.y += -1 * h.y;
pt.y /= 9;
@@ -681,7 +682,7 @@ pdf_loadtype3shade(fz_shade *shade, pdf_xref *xref,
y1 = coords[4];
r1 = coords[5];
- pdf_logshade("coords %g %g %g %g %g %g\n", x0, y0, r0, x1, y1, r1);
+ pdf_logshade("coords %g %g %g -> %g %g %g\n", x0, y0, r0, x1, y1, r1);
t0 = domain[0];
t1 = domain[1];
diff --git a/mupdf/pdf_xref.c b/mupdf/pdf_xref.c
index f60d8d72..161bf6e8 100644
--- a/mupdf/pdf_xref.c
+++ b/mupdf/pdf_xref.c
@@ -113,7 +113,7 @@ pdf_loadobjstm(pdf_xref *xref, int num, int gen, char *buf, int cap)
count = fz_toint(fz_dictgets(objstm, "N"));
first = fz_toint(fz_dictgets(objstm, "First"));
- pdf_logxref(" count %d\n", count);
+ pdf_logxref("\tcount %d\n", count);
numbuf = fz_malloc(count * sizeof(int));
ofsbuf = fz_malloc(count * sizeof(int));