* [PATCH v2 1/5] w32: define new jpeglib-version var in order to load the correct DLL at runtime
[not found] <cover.1383136381.git.claudio.bley@gmail.com>
@ 2013-10-30 12:43 ` Claudio Bley
2013-11-01 9:16 ` Eli Zaretskii
2013-10-30 12:43 ` [PATCH v2 2/5] w32: add support for recent PNG library version >= 1.5 Claudio Bley
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Claudio Bley @ 2013-10-30 12:43 UTC (permalink / raw
To: Emacs-devel
All jpeglib versions from 7 to 9 are binary incompatible with earlier
ones.
---
lisp/term/w32-win.el | 4 +++-
src/image.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 9690a5a..b1e7d9b 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -221,8 +221,10 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
'(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll"
;; these are libpng 1.2.8 from GTK+
"libpng13d.dll" "libpng13.dll"))
- '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
'(tiff "libtiff3.dll" "libtiff.dll")
+ (if (> jpeglib-version 0)
+ (list 'jpeg (format "libjpeg-%d.dll" (/ jpeglib-version 10)))
+ '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll"))
;; Versions of giflib 5.0.0 and later changed signatures of
;; several functions used by Emacs, which makes those versions
;; incompatible with previous ones. We select the correct
diff --git a/src/image.c b/src/image.c
index 6691cfc..dea3d35 100644
--- a/src/image.c
+++ b/src/image.c
@@ -92,6 +92,12 @@ typedef struct w32_bitmap_record Bitmap_Record;
to correctly set up the alist used to search for the respective
image libraries. */
Lisp_Object Qlibpng_version, Qlibgif_version;
+
+/* Version of jpeglib that we were compiled with, or -1 if no JPEG
+ support was compiled in. This is tested by w32-win.el to correctly
+ set up the alist used to search for JPEG libraries. */
+Lisp_Object Qjpeglib_version;
+
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
@@ -9411,6 +9417,14 @@ non-numeric, there is no explicit limit on the size of images. */);
#else
make_number (-1)
#endif
+ );
+ DEFSYM (Qjpeglib_version, "jpeglib-version");
+ Fset (Qjpeglib_version,
+#if HAVE_JPEG
+ make_number (JPEG_LIB_VERSION)
+#else
+ make_number (-1)
+#endif
);
#endif
--
1.8.4.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/5] w32: define new jpeglib-version var in order to load the correct DLL at runtime
2013-10-30 12:43 ` [PATCH v2 1/5] w32: define new jpeglib-version var in order to load the correct DLL at runtime Claudio Bley
@ 2013-11-01 9:16 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2013-11-01 9:16 UTC (permalink / raw
To: Claudio Bley; +Cc: emacs-devel
> Date: Wed, 30 Oct 2013 13:43:08 +0100
> From: Claudio Bley <claudio.bley@googlemail.com>
>
> All jpeglib versions from 7 to 9 are binary incompatible with earlier
> ones.
> ---
> lisp/term/w32-win.el | 4 +++-
> src/image.c | 14 ++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
I installed this with minor changes:
. renamed jpeglib-version to libjpeg-version, for consistency with
other image libraries;
. changed the comparison in w32-win.el to compare against 62, not 0,
because jpeg6 does define JPEG_LIB_VERSION; the comparison says
now
(if (> libjpeg-version 62)
. added a comment in w32-win.el explaining the reasons for the binary
incompatibilities
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/5] w32: add support for recent PNG library version >= 1.5
[not found] <cover.1383136381.git.claudio.bley@gmail.com>
2013-10-30 12:43 ` [PATCH v2 1/5] w32: define new jpeglib-version var in order to load the correct DLL at runtime Claudio Bley
@ 2013-10-30 12:43 ` Claudio Bley
2013-11-01 9:16 ` Eli Zaretskii
2013-10-30 12:43 ` [PATCH v2 3/5] w32: add support for default library names for libtiff Claudio Bley
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Claudio Bley @ 2013-10-30 12:43 UTC (permalink / raw
To: Emacs-devel
The naming scheme of the libpng library on w32 is either libpngXY.dll
or libpngXY-XY.dll where X being the major version, Y the minor
version number, respectively.
---
lisp/term/w32-win.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index b1e7d9b..ff3729d 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -216,8 +216,15 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
;; the version we were compiled against. (If we were compiled
;; without PNG support, libpng-version's value is -1.)
(if (>= libpng-version 10400)
- ;; libpng14-14.dll is libpng 1.4.3 from GTK+
- '(png "libpng14-14.dll" "libpng14.dll")
+ (let ((major (/ libpng-version 10000))
+ (minor (mod (/ libpng-version 100) 10)))
+ (list 'png
+ ;; libpngXY.dll is the default name when building
+ ;; with CMake or from a lpngXYY tarball on w32,
+ ;; libpngXY-XY.dll is the DLL name when building
+ ;; with libtool / autotools
+ (format "libpng%d%d.dll" major minor)
+ (format "libpng%d%d-%d%d.dll" major minor major minor)))
'(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll"
;; these are libpng 1.2.8 from GTK+
"libpng13d.dll" "libpng13.dll"))
--
1.8.4.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/5] w32: add support for default library names for libtiff
[not found] <cover.1383136381.git.claudio.bley@gmail.com>
2013-10-30 12:43 ` [PATCH v2 1/5] w32: define new jpeglib-version var in order to load the correct DLL at runtime Claudio Bley
2013-10-30 12:43 ` [PATCH v2 2/5] w32: add support for recent PNG library version >= 1.5 Claudio Bley
@ 2013-10-30 12:43 ` Claudio Bley
2013-11-01 9:19 ` Eli Zaretskii
2013-10-30 12:43 ` [PATCH v2 4/5] Fix parsing of NetPBM file comments Claudio Bley
2013-10-30 12:44 ` [PATCH v2 5/5] Fix file magic for pbm files with comments Claudio Bley
4 siblings, 1 reply; 9+ messages in thread
From: Claudio Bley @ 2013-10-30 12:43 UTC (permalink / raw
To: Emacs-devel
---
lisp/term/w32-win.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index ff3729d..f7c8c9a 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -228,7 +228,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
'(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll"
;; these are libpng 1.2.8 from GTK+
"libpng13d.dll" "libpng13.dll"))
- '(tiff "libtiff3.dll" "libtiff.dll")
+ '(tiff "libtiff-5.dll" "libtiff3.dll" "libtiff.dll")
(if (> jpeglib-version 0)
(list 'jpeg (format "libjpeg-%d.dll" (/ jpeglib-version 10)))
'(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll"))
--
1.8.4.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/5] Fix parsing of NetPBM file comments
[not found] <cover.1383136381.git.claudio.bley@gmail.com>
` (2 preceding siblings ...)
2013-10-30 12:43 ` [PATCH v2 3/5] w32: add support for default library names for libtiff Claudio Bley
@ 2013-10-30 12:43 ` Claudio Bley
2013-11-01 9:19 ` Eli Zaretskii
2013-10-30 12:44 ` [PATCH v2 5/5] Fix file magic for pbm files with comments Claudio Bley
4 siblings, 1 reply; 9+ messages in thread
From: Claudio Bley @ 2013-10-30 12:43 UTC (permalink / raw
To: Emacs-devel
Comments in NetPBM headers can occur in the middle of a token.
(see http://netpbm.sourceforge.net/doc/pbm.html)
---
src/image.c | 51 ++++++++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/src/image.c b/src/image.c
index dea3d35..afd54ac 100644
--- a/src/image.c
+++ b/src/image.c
@@ -5111,6 +5111,27 @@ pbm_image_p (Lisp_Object object)
}
+/* Get next char skipping comments in Netpbm header. Returns -1 at
+ end of input. */
+
+static int
+pbm_next_char (unsigned char **s, unsigned char *end)
+{
+ int c = -1;
+
+ while (*s < end && (c = *(*s)++, c == '#'))
+ {
+ /* Skip to the next line break */
+ while (*s < end && (c = *(*s)++, c != '\n' && c != '\r'))
+ ;
+
+ c = -1;
+ }
+
+ return c;
+}
+
+
/* Scan a decimal number from *S and return it. Advance *S while
reading the number. END is the end of the string. Value is -1 at
end of input. */
@@ -5120,28 +5141,16 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
{
int c = 0, val = -1;
- while (*s < end)
- {
- /* Skip white-space. */
- while (*s < end && (c = *(*s)++, c_isspace (c)))
- ;
+ /* Skip white-space. */
+ while ((c = pbm_next_char (s, end)) != -1 && c_isspace (c))
+ ;
- if (c == '#')
- {
- /* Skip comment to end of line. */
- while (*s < end && (c = *(*s)++, c != '\n'))
- ;
- }
- else if (c_isdigit (c))
- {
- /* Read decimal number. */
- val = c - '0';
- while (*s < end && (c = *(*s)++, c_isdigit (c)))
- val = 10 * val + c - '0';
- break;
- }
- else
- break;
+ if (c_isdigit (c))
+ {
+ /* Read decimal number. */
+ val = c - '0';
+ while ((c = pbm_next_char (s, end)) != -1 && c_isdigit (c))
+ val = 10 * val + c - '0';
}
return val;
--
1.8.4.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/5] Fix file magic for pbm files with comments
[not found] <cover.1383136381.git.claudio.bley@gmail.com>
` (3 preceding siblings ...)
2013-10-30 12:43 ` [PATCH v2 4/5] Fix parsing of NetPBM file comments Claudio Bley
@ 2013-10-30 12:44 ` Claudio Bley
4 siblings, 0 replies; 9+ messages in thread
From: Claudio Bley @ 2013-10-30 12:44 UTC (permalink / raw
To: Emacs-devel
Comments in NetPBM files are allowed to occur in the middle of a
token.
---
lisp/image.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/image.el b/lisp/image.el
index 6ce5b82..69d8907 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -34,7 +34,10 @@
(defconst image-type-header-regexps
`(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
- ("\\`P[1-6][[:space:]]+\\(?:#.*[[:space:]]+\\)*[0-9]+[[:space:]]+[0-9]+" . pbm)
+ ("\\`P[1-6]\\\(?:\
+\\(?:\\(?:#[^\r\n]*[\r\n]\\)?[[:space:]]\\)+\
+\\(?:\\(?:#[^\r\n]*[\r\n]\\)?[0-9]\\)+\
+\\)\\{2\\}" . pbm)
("\\`GIF8[79]a" . gif)
("\\`\x89PNG\r\n\x1a\n" . png)
("\\`[\t\n\r ]*#define \\([a-z0-9_]+\\)_width [0-9]+\n\
--
1.8.4.msysgit.0
^ permalink raw reply related [flat|nested] 9+ messages in thread