[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Swftools-common] Bugfix: pdf2swf: page numbering wraps to negative afte
From: |
Gareth Williams |
Subject: |
[Swftools-common] Bugfix: pdf2swf: page numbering wraps to negative after 128 pages one-file-per-page output |
Date: |
Thu, 31 Jul 2008 17:16:57 +0300 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080724) |
Hi everyone,
This is my first time posting here - I hope this is the right place to
post this.
I love the new feature in pdf2swf to allow one .swf file to be created
for each page in the pdf.
But I found a small bug with it: for documents with more than 128 pages,
the page numbering wraps around to negative numbers.
This is because the page number is stored in a signed char. In order to
fix this I changed the page number variable to be an unsigned int (I
presume page numbers can never be negative).
I also adjusted the --help output to make it more obvious that this
useful feature exists :)
Attached is a unified diff against swftools-2008-07-27-1136 if you're
interested. Let me know what you think.
Cheers,
Gareth
ps. whoops - forgot the attachment!
diff -wru swftools-2008-07-27-1136.orig/src/pdf2swf.c
swftools-2008-07-27-1136/src/pdf2swf.c
--- swftools-2008-07-27-1136.orig/src/pdf2swf.c 2008-06-20 00:05:34.000000000
+0300
+++ swftools-2008-07-27-1136/src/pdf2swf.c 2008-07-31 13:43:51.000000000
+0300
@@ -497,7 +497,7 @@
printf("\n");
printf("-h , --help Print short help message and
exit\n");
printf("-V , --version Print version info and exit\n");
- printf("-o , --output file.swf Direct output to file.swf. If
file.swf contains '%d' (file%d.swf), then each page \n");
+ printf("-o , --output file.swf Direct output to file.swf. Use a
'%%' in the filename (eg. file-%%.swf) to get one file per page.\n");
printf("-p , --pages range Convert only pages in range with
range e.g. 1-20 or 1,4,6,9-11 or\n");
printf("-P , --password password Use password for deciphering the
pdf.\n");
printf("-v , --verbose Be verbose. Use more than one -v
for greater effect.\n");
@@ -600,7 +600,7 @@
int nup_pos = 0;
int x,y;
char* installPath = getInstallationPath();
- char one_file_per_page = 0;
+ unsigned int one_file_per_page = 0;
initLog(0,-1,0,0,-1,loglevel);
@@ -679,11 +679,11 @@
if((u = strchr(outputname, '%'))) {
if(strchr(u+1, '%') ||
strchr(outputname, '%')!=u) {
- msg("<error> only one %%d allowed in filename\n");
+ msg("<error> only one %% allowed in filename\n");
return 1;
}
if(preloader || viewer) {
- msg("<error> -b/-l/-B/-L not supported together with %%d in
filename\n");
+ msg("<error> -b/-l/-B/-L not supported together with %% in
filename\n");
return 1;
}
msg("<notice> outputting one file per page");