diff options
| author | mathog <> | 2016-01-27 01:05:21 +0000 |
|---|---|---|
| committer | mathog <> | 2016-01-27 01:05:21 +0000 |
| commit | 81f350e17e3398c1a5f3fb5254acc5e0ad7caf23 (patch) | |
| tree | 894afb9b343bb3ebea8b29564188fd4144a41bf3 /src | |
| parent | Dutch translation update (diff) | |
| download | inkscape-81f350e17e3398c1a5f3fb5254acc5e0ad7caf23.tar.gz inkscape-81f350e17e3398c1a5f3fb5254acc5e0ad7caf23.zip | |
patch should fix bug 1480651
(bzr r14617)
Diffstat (limited to 'src')
| -rw-r--r-- | src/libuemf/uemf.c | 6 | ||||
| -rw-r--r-- | src/libuemf/uemf_print.c | 18 | ||||
| -rw-r--r-- | src/libuemf/uemf_safe.c | 8 | ||||
| -rw-r--r-- | src/libuemf/upmf.c | 16 | ||||
| -rw-r--r-- | src/libuemf/upmf.h | 11 | ||||
| -rw-r--r-- | src/libuemf/upmf_print.c | 14 |
6 files changed, 38 insertions, 35 deletions
diff --git a/src/libuemf/uemf.c b/src/libuemf/uemf.c index afa116e75..fa7689bb6 100644 --- a/src/libuemf/uemf.c +++ b/src/libuemf/uemf.c @@ -16,11 +16,11 @@ /* File: uemf.c -Version: 0.0.30 -Date: 20-MAR-2015 +Version: 0.0.31 +Date: 26-JAN-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus diff --git a/src/libuemf/uemf_print.c b/src/libuemf/uemf_print.c index 4bc9f0206..28fe0b7c3 100644 --- a/src/libuemf/uemf_print.c +++ b/src/libuemf/uemf_print.c @@ -6,11 +6,11 @@ /* File: uemf_print.c -Version: 0.0.20 -Date: 21-MAY-2015 +Version: 0.0.21 +Date: 26-JAN-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus @@ -1884,15 +1884,21 @@ void U_EMRPAINTRGN_print(const char *contents){ */ void U_EMREXTSELECTCLIPRGN_print(const char *contents){ PU_EMREXTSELECTCLIPRGN pEmr = (PU_EMREXTSELECTCLIPRGN) (contents); - if(pEmr->emr.nSize < sizeof(U_EMREXTSELECTCLIPRGN)){ + if(pEmr->emr.nSize < U_SIZE_EMREXTSELECTCLIPRGN){ printf(" record corruption HERE\n"); return; } const char *blimit = contents + pEmr->emr.nSize; printf(" cbRgnData: %u\n",pEmr->cbRgnData); printf(" iMode: %u\n",pEmr->iMode); - const char *minptr = MAKE_MIN_PTR(((const char *) &pEmr->RgnData + pEmr->cbRgnData),blimit); - printf(" RegionData: "); rgndata_print(pEmr->RgnData, minptr); printf("\n"); + if(pEmr->iMode == U_RGN_COPY && !pEmr->cbRgnData){ + printf(" RegionData: none (Clip region becomes NULL)\n"); + } + else { + const char *minptr = MAKE_MIN_PTR(((const char *) &pEmr->RgnData + pEmr->cbRgnData),blimit); + printf(" RegionData: "); rgndata_print(pEmr->RgnData, minptr); printf("\n"); + } + } // U_EMRBITBLT 76 diff --git a/src/libuemf/uemf_safe.c b/src/libuemf/uemf_safe.c index 36284d60e..a3e050282 100644 --- a/src/libuemf/uemf_safe.c +++ b/src/libuemf/uemf_safe.c @@ -15,11 +15,11 @@ /* File: uemf_safe.c -Version: 0.0.4 -Date: 23-APR-2015 +Version: 0.0.5 +Date: 26-JAN-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus @@ -740,6 +740,8 @@ int U_EMREXTSELECTCLIPRGN_safe(const char *record){ if(!core5_safe(record, U_SIZE_EMREXTSELECTCLIPRGN))return(0); PU_EMREXTSELECTCLIPRGN pEmr = (PU_EMREXTSELECTCLIPRGN)(record); int cbRgnData = pEmr->cbRgnData; + /* data size can be 0 with COPY mode, it means clear the clip region. */ + if(pEmr->iMode == U_RGN_COPY && !cbRgnData)return(1); const char *blimit = record + pEmr->emr.nSize; if(IS_MEM_UNSAFE(pEmr->RgnData, cbRgnData, blimit))return(0); return(rgndata_safe(pEmr->RgnData, cbRgnData)); diff --git a/src/libuemf/upmf.c b/src/libuemf/upmf.c index fe929e443..5cb558ac6 100644 --- a/src/libuemf/upmf.c +++ b/src/libuemf/upmf.c @@ -21,11 +21,11 @@ /* File: upmf.c -Version: 0.0.11 -Date: 28-MAY-2015 +Version: 0.0.12 +Date: 26-JAN-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus @@ -4125,7 +4125,6 @@ U_PSEUDO_OBJ *U_PMR_DRAWCURVE_set(uint32_t PenID, U_FLOAT Tension, uint32_t Offs \brief Create and set a U_PMR_DRAWDRIVERSTRING PseudoObject \return Pointer to PseudoObject, NULL on error \param FontID U_PMF_FONT object in the EMF+ object table (0-63, inclusive) - \param Tension Controls splines, 0 is straight line, >0 is curved \param BrushID U_PSEUDO_OBJ containing a U_PMF_ARGB or a U_PMF_4NUM. Color or U_PMF_BRUSH object in the EMF+ object table (0-63, inclusive) \param DSOFlags DriverStringOptions flags \param HasMatrix If 1 record contains a TransformMatrix field, if 0 it does not. @@ -4137,7 +4136,7 @@ U_PSEUDO_OBJ *U_PMR_DRAWCURVE_set(uint32_t PenID, U_FLOAT Tension, uint32_t Offs EMF+ manual 2.3.4.6, Microsoft name: EmfPlusDrawDriverString Record, Index 0x36 */ -U_PSEUDO_OBJ *U_PMR_DRAWDRIVERSTRING_set(uint32_t FontID, U_FLOAT Tension, const U_PSEUDO_OBJ *BrushID, +U_PSEUDO_OBJ *U_PMR_DRAWDRIVERSTRING_set(uint32_t FontID, const U_PSEUDO_OBJ *BrushID, uint32_t DSOFlags, uint32_t HasMatrix, uint32_t GlyphCount, const uint16_t *Glyphs, const U_PSEUDO_OBJ *Points, const U_PSEUDO_OBJ *Tm){ int btype; @@ -4163,7 +4162,6 @@ U_PSEUDO_OBJ *U_PMR_DRAWDRIVERSTRING_set(uint32_t FontID, U_FLOAT Tension, const U_PSEUDO_OBJ *ph = U_PMR_CMN_HDR_set(U_PMR_DRAWDRIVERSTRING,utmp16,Size); const U_SERIAL_DESC List[] = { {ph->Data,ph->Used, 1, U_XE}, - {&Tension, 4, 1, U_LE}, {BrushID->Data, BrushID->Used, 1, U_XE}, {&DSOFlags, 4, 1, U_LE}, {&HasMatrix, 4, 1, U_LE}, @@ -7469,7 +7467,6 @@ int U_PMR_DRAWCURVE_get(const char *contents, U_PMF_CMN_HDR *Header, \param Header Common header \param FontID U_PMF_FONT object in the EMF+ object table (0-63, inclusive) \param btype Set: BrushID is an U_PFM_ARGB; Clear: index of U_PMF_BRUSH object in EMF+ object table. - \param Tension Controls splines, 0 is straight line, >0 is curved \param BrushID Color or index of U_PMF_BRUSH object in the EMF+ object table, depends on Flags bit0 \param DSOFlags DriverStringOptions flags \param HasMatrix If 1 record contains a TransformMatrix field, if 0 it does not. @@ -7482,9 +7479,9 @@ int U_PMR_DRAWCURVE_get(const char *contents, U_PMF_CMN_HDR *Header, */ int U_PMR_DRAWDRIVERSTRING_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *FontID, int *btype, - U_FLOAT *Tension, uint32_t *BrushID, uint32_t *DSOFlags, uint32_t *HasMatrix, uint32_t *Elements, + uint32_t *BrushID, uint32_t *DSOFlags, uint32_t *HasMatrix, uint32_t *Elements, uint16_t **Glyphs, U_PMF_POINTF **Points, U_PMF_TRANSFORMMATRIX **Matrix){ - if(!contents || !FontID || !btype || !Tension || !BrushID || + if(!contents || !FontID || !btype || !BrushID || !DSOFlags || !HasMatrix || !Elements || !Glyphs || !Points || !Matrix){ return(0); } const char *blimit = contents; @@ -7496,7 +7493,6 @@ int U_PMR_DRAWDRIVERSTRING_get(const char *contents, U_PMF_CMN_HDR *Header, *btype = (lclHeader.Flags & U_PPF_B ? 1 : 0 ); *FontID = (lclHeader.Flags >> U_FF_SHFT_OID8) & U_FF_MASK_OID8; - U_PMF_SERIAL_get(&contents, Tension, 4, 1, U_LE); U_PMF_SERIAL_get(&contents, BrushID, 4, 1, (*btype ? U_XE : U_LE)); /* color is not byte swapped, ID integer is */ U_PMF_SERIAL_get(&contents, DSOFlags, 4, 1, U_LE); U_PMF_SERIAL_get(&contents, HasMatrix, 4, 1, U_LE); diff --git a/src/libuemf/upmf.h b/src/libuemf/upmf.h index dbda02ba7..4fb7ad492 100644 --- a/src/libuemf/upmf.h +++ b/src/libuemf/upmf.h @@ -27,11 +27,11 @@ /* File: upmf.h -Version: 0.0.4 -Date: 17-MAR-2015 +Version: 0.0.5 +Date: 26-JAN-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ #ifndef _UPMF_ @@ -2289,7 +2289,6 @@ typedef struct { */ typedef struct { U_PMF_CMN_HDR Header; //!< Common header - U_FLOAT Tension; //!< Controls splines, 0 is straight line, >0 is curved uint32_t BrushID; //!< Color or index to Brush object, depends on Flags bit0 uint32_t DSOFlags; //!< DriverStringOptions flags uint32_t HasMatrix; //!< If 1 record contains a TransformMatrix field, if 0 it does not. @@ -2987,7 +2986,7 @@ U_PSEUDO_OBJ *U_PMR_DRAWARC_set(uint32_t PenID, U_FLOAT Start, U_FLOAT Sweep, co U_PSEUDO_OBJ *U_PMR_DRAWBEZIERS_set(uint32_t PenID, const U_PSEUDO_OBJ *Points); U_PSEUDO_OBJ *U_PMR_DRAWCLOSEDCURVE_set(uint32_t PenID, U_FLOAT Tension, const U_PSEUDO_OBJ *Points); U_PSEUDO_OBJ *U_PMR_DRAWCURVE_set(uint32_t PenID, U_FLOAT Tension,uint32_t Offset, uint32_t NSegs, const U_PSEUDO_OBJ *Points); -U_PSEUDO_OBJ *U_PMR_DRAWDRIVERSTRING_set(uint32_t FontID, U_FLOAT Tension, const U_PSEUDO_OBJ *BrushID, +U_PSEUDO_OBJ *U_PMR_DRAWDRIVERSTRING_set(uint32_t FontID, const U_PSEUDO_OBJ *BrushID, uint32_t DSOFlags, uint32_t HasMatrix, uint32_t GlyphCount, const uint16_t *Glyphs, const U_PSEUDO_OBJ *Points, const U_PSEUDO_OBJ *Tm); U_PSEUDO_OBJ *U_PMR_DRAWELLIPSE_set(uint32_t PenID, const U_PSEUDO_OBJ *Rect); @@ -3125,7 +3124,7 @@ int U_PMR_DRAWARC_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *Pen int U_PMR_DRAWBEZIERS_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *PenID, int *ctype, int *RelAbs, uint32_t *Elements, U_PMF_POINTF **Points); int U_PMR_DRAWCLOSEDCURVE_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *PenID, int *ctype, int *RelAbs, U_FLOAT *Tension, uint32_t *Elements, U_PMF_POINTF **Points); int U_PMR_DRAWCURVE_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *PenID, int *ctype, U_FLOAT *Tension, uint32_t *Offset, uint32_t *NSegs, uint32_t *Elements, U_PMF_POINTF **Points); -int U_PMR_DRAWDRIVERSTRING_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *FontID, int *btype, U_FLOAT *Tension, uint32_t *BrushID, uint32_t *DSOFlags, uint32_t *HasMatrix, uint32_t *Elements, uint16_t **Glyphs, U_PMF_POINTF **Points, U_PMF_TRANSFORMMATRIX **Matrix); +int U_PMR_DRAWDRIVERSTRING_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *FontID, int *btype, uint32_t *BrushID, uint32_t *DSOFlags, uint32_t *HasMatrix, uint32_t *Elements, uint16_t **Glyphs, U_PMF_POINTF **Points, U_PMF_TRANSFORMMATRIX **Matrix); int U_PMR_DRAWELLIPSE_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *PenID, int *ctype, U_PMF_RECTF *Rect); int U_PMR_DRAWIMAGE_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *ImgID, int *ctype, uint32_t *ImgAttrID, int32_t *SrcUnit, U_PMF_RECTF *SrcRect, U_PMF_RECTF *DstRect); int U_PMR_DRAWIMAGEPOINTS_get(const char *contents, U_PMF_CMN_HDR *Header, uint32_t *ImgID, int *ctype, int *etype, int *RelAbs, uint32_t *ImgAttrID, int32_t *SrcUnit, U_PMF_RECTF *SrcRect, uint32_t *Elements, U_PMF_POINTF **Points); diff --git a/src/libuemf/upmf_print.c b/src/libuemf/upmf_print.c index 58ff4edd0..69fad3691 100644 --- a/src/libuemf/upmf_print.c +++ b/src/libuemf/upmf_print.c @@ -6,11 +6,11 @@ /* File: upmf_print.c -Version: 0.0.7 -Date: 21-MAY-2015 +Version: 0.0.8 +Date: 26-JAN-2016 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2015 David Mathog and California Institute of Technology (Caltech) +Copyright: 2016 David Mathog and California Institute of Technology (Caltech) */ /* compiler options: @@ -2379,19 +2379,19 @@ int U_PMR_DRAWDRIVERSTRING_print(const char *contents){ unsigned int i; uint32_t FontID; int btype; - U_FLOAT Tension; uint32_t BrushID, DSOFlags, HasMatrix, Elements; uint16_t *Glyphs; + uint16_t *GlyphsIter; U_PMF_POINTF *Points; U_PMF_TRANSFORMMATRIX *Matrix; int status = U_PMR_DRAWDRIVERSTRING_get(contents, NULL, &FontID, &btype, - &Tension, &BrushID, &DSOFlags, &HasMatrix, &Elements,&Glyphs, &Points, &Matrix); + &BrushID, &DSOFlags, &HasMatrix, &Elements,&Glyphs, &Points, &Matrix); if(status){ - printf(" + FontID:%u btype:%d Tension:%f BrushID:%u DSOFlags:%X Elements:%u\n", FontID,btype,Tension, BrushID, DSOFlags, Elements); + printf(" + FontID:%u btype:%d BrushID:%u DSOFlags:%X Elements:%u\n", FontID,btype, BrushID, DSOFlags, Elements); printf(" + Glyphs:"); if(*Glyphs){ - for(i=0; i<Elements;i++, Glyphs++){ printf(" %u",*Glyphs); } + for(GlyphsIter=Glyphs, i=0; i<Elements;i++, GlyphsIter++){ printf(" %u",*GlyphsIter); } free(Glyphs); } else { |
