summaryrefslogtreecommitdiffstats
path: root/src/libuemf
diff options
context:
space:
mode:
Diffstat (limited to 'src/libuemf')
-rw-r--r--src/libuemf/README150
-rw-r--r--src/libuemf/uemf.h9
2 files changed, 91 insertions, 68 deletions
diff --git a/src/libuemf/README b/src/libuemf/README
index a3dff9b4c..f65120c30 100644
--- a/src/libuemf/README
+++ b/src/libuemf/README
@@ -19,7 +19,7 @@ bit Solaris (BE).
libUEMF is released under the GPL 2 license, read the file 'COPYING' for more information
-Version 0.2.1, released April 23, 2015.
+Version 0.2.5, released Jan 03, 2017.
To report bugs or provide feedback send email to David Mathog, mathog@caltech.edu.
@@ -172,7 +172,7 @@ emf-inout.cpp,example
emf-inout.h.example
emf-print.cpp.example
emf-print.h.example
- Example code from Inkscape demonstrate how to integrate libUEMF with another program.
+ Example code from Inkscape, demonstrates how to integrate libUEMF with another program.
--------------------------------------------------------------------------------------------
How to Build:
@@ -181,69 +181,70 @@ In Linux/Unix like environments (omit -g flag for production versions):
Build and install a shared library (example, details may vary) and then build and link
the example programs to the shared library:
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf_print.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf_endian.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uemf_utf.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uwmf.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uwmf_print.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c uwmf_endian.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c upmf.c
- gcc -std=c99 -pedantic -Wall -fPIC -g -c upmf_print.c
+ export CFLAGS="-std=c99 -pedantic -Wall -fPIC -g -c"
+ gcc $CFLAGS uemf.c
+ gcc $CFLAGS uemf_print.c
+ gcc $CFLAGS uemf_endian.c
+ gcc $CFLAGS uemf_safe.c
+ gcc $CFLAGS uemf_utf.c
+ gcc $CFLAGS uwmf.c
+ gcc $CFLAGS uwmf_print.c
+ gcc $CFLAGS uwmf_endian.c
+ gcc $CFLAGS upmf.c
+ gcc $CFLAGS upmf_print.c
+ unset CFLAGS
gcc -shared -Wl,-soname,libuemf.so.0 \
- -o libuemf.so.0.0.3 uemf.o uemf_utf.o uemf_print.o uemf_endian.o uwmf.o uwmf_print.o uwmf_endian.o upmf.o upmf_print.o -lc
+ -o libuemf.so.0.0.3 uemf.o uemf_utf.o uemf_safe.o uemf_print.o uemf_endian.o uwmf.o uwmf_print.o uwmf_endian.o upmf.o upmf_print.o -lc
ln -s libuemf.so.0.0.3 libuemf.so.0
ln -s libuemf.so.0 libuemf.so
/bin/cp -f libuemf.so* /usr/local/lib
ldconfig
- gcc -std=c99 -pedantic -Wall -g -o cutemf cutemf.c -luemf -lm
- gcc -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c -luemf -lm
- gcc -std=c99 -pedantic -Wall -g -o reademf reademf.c -luemf -lm
- gcc -std=c99 -pedantic -Wall -g -o readwmf readwmf.c -luemf -lm
- gcc -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c -luemf -lm
- gcc -std=c99 -pedantic -Wall -g -o testbed_emf testbed_wmf.c -luemf -lm
- gcc -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c -luemf -lm
-
- For simple development work just build the example programs statically linked:
- gcc -std=c99 -pedantic -Wall -g -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c -lm
- gcc -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c -lm
- gcc -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm
- gcc -std=c99 -pedantic -Wall -g -o readwmf readwmf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c uwmf.c uwmf_endian.c uwmf_print.c upmf.c upmf_print.c -lm
- gcc -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_utf.c -lm
- gcc -std=c99 -pedantic -Wall -g -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_utf.c upmf.c upmf.h -lm
- gcc -std=c99 -pedantic -Wall -g -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_utf.c uwmf.c uwmf_endian.c -lm
- gcc -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_utf.c -lm
+ export CFLAGS="-std=c99 -pedantic -Wall -g"
+ export CLIBS="-luemf -lm"
+ gcc $CFLAGS -o cutemf cutemf.c $CLIBS
+ gcc $CFLAGS -o pmfdual2single pmfdual2single.c $CLIBS
+ gcc $CFLAGS -o reademf reademf.c $CLIBS
+ gcc $CFLAGS -o readwmf readwmf.c $CLIBS
+ gcc $CFLAGS -o testbed_emf testbed_emf.c $CLIBS
+ gcc $CFLAGS -o testbed_emf testbed_wmf.c $CLIBS
+ gcc $CFLAGS -o test_mapmodes_emf test_mapmodes_emf.c $CLIBS
+
+ For simple development work just build the example programs statically. Set these
+ two variables up first:
+
+ (linux)
+ export CFLAGS="-std=c99 -pedantic -Wall -g"
+ export CLIBS=-lm
+
+ (Sparc)[ Solaris 8 and 9 are Big Endian, and to work around some minor incompatibilities with more recent systems,
+ assuming gcc is installed in /opt/csw and PATH is set correctly to use it]
+ export CLIBS="-lm -L/opt/csw/lib -liconv"
+ export CFLAGS="-DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g"
+
+ (win32) [This uses _wfopen() instead of fopen(), with filename translation from UTF-8 to
+ UTF-16LE. This will allow file opens to utilize unicode names. If WIN32 is omitted on Windows
+ file names must be all ASCII. This works in mingw.]
+ export CLIBS="-lm -liconv"
+ export CFLAGS="-DWIN32 -std=c99 -pedantic -Wall -g"
+
+ Then compile with:
+
+ gcc $CFLAGS -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c $CLIBS
+ gcc $CFLAGS -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c $CLIBS
+ gcc $CFLAGS -o reademf reademf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c $CLIBS
+ gcc $CFLAGS -o readwmf readwmf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c uwmf.c uwmf_endian.c uwmf_print.c $CLIBS
+ gcc $CFLAGS -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c $CLIBS
+ gcc $CFLAGS -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_safe.c uemf_utf.c upmf.c $CLIBS
+ gcc $CFLAGS -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c uwmf.c uwmf_endian.c $CLIBS
+ gcc $CFLAGS -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_safe.c uemf_print.c uemf_utf.c upmf.c upmf_print.c $CLIBS
Extra debugging on linux may be enabled in testbed for use under Valgrind. To build that way do instead:
gcc -std=c99 -pedantic -Wall -g -DU_VALGRIND -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_print.c uemf_utf.c -lm
-Sparc Solaris 8 and 9 are Big Endian, and to work around some minor incompatibilities with more recent systems,
-assuming gcc is installed in /opt/csw and PATH is set correctly to use it:
-
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o readwmf readwmf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c uwmf.c uwmf_endian.c uwmf_print.c upmf.c upmf_print.c -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_utf.c upmf.c upmf.h -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_utf.c uwmf.c uwmf_endian.c -lm -L/opt/csw/lib -liconv
- gcc -DSOL8 -DWORDS_BIGENDIAN -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -L/opt/csw/lib -liconv
-
-(Note: WORDS_BIGENDIAN would also be produced by autconf's configure, if that was used.)
-
-Define WIN32 when compiling for Windows. This uses _wfopen() instead of fopen(), with
-filename translation from UTF-8 to UTF-16LE. This will allow file opens to utilize unicode
-names. If WIN32 is omitted on Windows file names must be all ASCII. To build on mingw use:
-
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o cutemf cutemf.c uemf.c uemf_endian.c uemf_utf.c -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o pmfdual2single pmfdual2single.c uemf.c uemf_endian.c uemf_utf.c upmf.c -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o readwmf readwmf.c uemf.c uemf_endian.c uemf_utf.c uemf_print.c uwmf.c uwmf_endian.c uwmf_print.c upmf.c upmf_print.c -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o testbed_emf testbed_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o testbed_pmf testbed_pmf.c uemf.c uemf_endian.c uemf_utf.c upmf.c upmf.h -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o testbed_wmf testbed_wmf.c uemf.c uemf_endian.c uemf_utf.c uwmf.c uwmf_endian.c -lm -liconv
- gcc -DWIN32 -std=c99 -pedantic -Wall -g -o test_mapmodes_emf test_mapmodes_emf.c uemf.c uemf_endian.c uemf_utf.c -lm -liconv
+
+and then compile as above for linux.
+
Dependencies:
libiconv (if not built into your compiler)
@@ -376,13 +377,36 @@ History
(Note, version numbers in files represent the libUEMF release where it was last modified, so not
all files will show the same version numbers in each release.)
-0.2.1.2015_04_23
+0.2.5 2017-01-03
+ Fixed a misplaced paren in uemf.h (thanks to Tavmjong Bah for noticing it)
+ Added more U_SIZE_* definitions in uemf.h for "cores" of record types with final
+ variable length arrays, such as U_SIZE_EMRNAMEDESCAPE
+ Removed redundant U_SIZE_BITMAPINFOHEADER definition from uwmf.h
+
+0.2.4 2016-01-26
+ Record EXTSELECTCLIPRGN is supposed to be valid when the RgnDataSize is 0 if the RegionMode
+ is "COPY". Modified safe and print routines so that they would handle this situation.
+ U_PMR_DrawDriverstring seen for the first time and it crashed reademf. Reason, there was a spurious
+ "Tension" value in the structure, which offset values in the record.
+0.2.3 2015-05-28
+ Fixed an assortment of warnings and a couple of bugs flagged by clang static analysis.
+0.2.2 2015-04-28
+ Added lu_crc32 sums to record information in print statements. Affects only reademf and readwmf.
+ The point of this exercise is to enable the detection of differences in binary fields
+ which are not expanded by the print functions. This (re)uses code from Alexander Peslyak.
+ lu_ in name because crc32 conflicts with other libraries, like png.
+ Minor changes to some wmf function parameter types.
+ Minor changes to upmf.c so that it compiles cleanly with clang.
+ Restrict IS_MEM_UNSAFE 2nd parameter to be int or larger and test for negative values.
+ Updated the examples from Inkscape.
+
+0.2.1 2015-04-23
Bug in safety check on EMREXTCREATEFONTINDIRECTW because it had alternative "standard" record sizes.
Changed warnings on unimplemented EMF record types encounterd in swap or safe from stdout to stderr.
Added memory checking for WMF polyline and polygon records, for the variable part and some others.
Note: U_WMRCREATEREGION_get does not check that the variable part stays within the record. Current
implementation seems to be broken since it does not show up in XP preview.
-0.2.0 2015_03_20
+0.2.0 2015-03-20
Added UEMF _safe functions to better handle corrupt records, where variable sizes fields might
have been specified to read past the end of memory. These are records with offsets, arrays
with counts, and bitmaps. Also any record which specifies a size smaller than the minimum
@@ -390,30 +414,30 @@ History
Added similar code for EMF+.
These changed the API so the minor version number was bumped by 1.
-0.1.18 2015_01_15
+0.1.18 2015-01-15
Pierre-Francois Carpentier sent some EMF examples which used U_EMR_EXTSELECTCLIPRGN, which had
not previously been encountered and showed that the handling of regions was broken.
Added tests for U_EMRFILLRGN, U_EMRFRAMERGN, U_EMRFRAMERGN, U_EMREXTSELECTCLIPRGN to testbed_emf.
-0.1.18 2014_04_28
+0.1.18 2014-04-28
Fixed typo in testbed_wmf.c. "include,include" in one place should have been
"exclude,exclude".
-0.1.17 2014_04_25
+0.1.17 2014-04-25
Added text clipping tests to testbed_emf.c, testbed_wmf.c, and testbed_pmf.c.
Added option to omit clipping tests in testbed's.
-0.1.16 2014_04_14
+0.1.16 2014-04-14
Fixed bug in U_WMRRESTOREDC_set.
Added clipping tests to testbed_wmf.c.
-0.1.15 2014_04_04
+0.1.15 2014-04-04
Changed record flags for U_EMRSELECTCLIPPATH record, it consumes a path but does not ALTER (which
forced a premature draw.)
Added U_EMROFFSETCLIPRGN test to testbed_emf.c.
Changed location on dist drawing where clipping appears.
-0.1.14 2014_03_27
+0.1.14 2014-03-27
Fixed bug, in U_PMF_RECTN_set() in upmf.c. Never tested.
Fixed a few potential bugs in upmf.c if a null pointer was passed for
certain function arguments. (Previously unhandled cases.)
diff --git a/src/libuemf/uemf.h b/src/libuemf/uemf.h
index 05566af06..3a51e39e2 100644
--- a/src/libuemf/uemf.h
+++ b/src/libuemf/uemf.h
@@ -95,11 +95,11 @@ these WMF enumerations is by referencing the following table:
/*
File: uemf.h
-Version: 0.0.33
-Date: 27-JAN-2016
+Version: 0.0.34
+Date: 03-JAN-2017
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
-Copyright: 2016 David Mathog and California Institute of Technology (Caltech)
+Copyright: 2017 David Mathog and California Institute of Technology (Caltech)
*/
#ifndef _UEMF_
@@ -168,7 +168,6 @@ extern "C" {
#define U_ROUND(A) ( (A) > 0 ? floor((A)+0.5) : ( (A) < 0 ? -floor(-(A)+0.5) : (A) ) )
#define MAKE_MIN_PTR(A,B) ( A < B ? A : B)
-
/* IS_MEM_UNSAFE takes 3 parameters:
A start address of a block of allocated memory
B offset into this block starting at A
@@ -185,7 +184,7 @@ extern "C" {
If B is a uint16_t gcc complains about the first test.
This Macro must not be used where B needs more than 32 bits!
*/
-#define IS_MEM_UNSAFE(A,B,C) ( (sizeof(B) < sizeof(int) || (int)(B) < 0) ? 1 : ((int8_t *)(A) > (int8_t *)(C) ? 1 : ((int8_t *)(C) - (int8_t *)(A) >= (int)(B) ? 0 : 1 )))
+#define IS_MEM_UNSAFE(A,B,C) ( (sizeof(B) < sizeof(int) || (int)(B) < 0) ? 1 : ((int8_t *)(A) > (int8_t *)(C) ? 1 : ((int8_t *)(C) - (int8_t *)(A) >= (int)(B) ? 0 : 1 ))) //!< Return 1 when a region of memory starting at A of B bytes extends beyond pointer C
/** @} */