diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2013-09-01 17:12:20 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2013-09-01 17:12:20 +0000 |
| commit | 106c4d110dc42d10e10c575aa5175e7ad71c15cc (patch) | |
| tree | 1deaf361660653513d08b18728e9ba04c94cd59f /src | |
| parent | extensions. simplestyle.py. allow spaces at end of style attribute (Bug 1216859) (diff) | |
| download | inkscape-106c4d110dc42d10e10c575aa5175e7ad71c15cc.tar.gz inkscape-106c4d110dc42d10e10c575aa5175e7ad71c15cc.zip | |
Fix compilation warnings in libuemf
(bzr r12497)
Diffstat (limited to 'src')
| -rw-r--r-- | src/libuemf/uemf.h | 9 | ||||
| -rw-r--r-- | src/libuemf/uemf_print.c | 61 | ||||
| -rw-r--r-- | src/libuemf/uwmf_print.c | 10 |
3 files changed, 57 insertions, 23 deletions
diff --git a/src/libuemf/uemf.h b/src/libuemf/uemf.h index 4d620b424..f1211d63d 100644 --- a/src/libuemf/uemf.h +++ b/src/libuemf/uemf.h @@ -1063,7 +1063,7 @@ extern "C" { @{ */ #define U_NONE 0 //!< Generic for nothing selected for all flag fields -#define U_PI 3.14159265358979323846 //!< pi +#define U_PI 3.14159265358979323846 //!< pi #define U_READ 1 #define U_WRITE 0 #define U_ENHMETA_VERSION 0x00010000 //!< U_EMRHEADER nVersion field @@ -1114,8 +1114,11 @@ extern "C" { // These are used in EMF structures and the byte order must be the same in memory or on disk. // These MAY be used in PNG and other libraries if these enforce byte order in memory,otherwise // U_swap4 may need to also be employed. -#define U_RGB(r,g,b) (U_COLORREF){r,g,b,0} //!< Set any RGB color with an {r,g,b} triplet -#define U_RGBA(r,g,b,a) (U_COLORREF){r,g,b,a} //!< Set any RGBA color with an {r,g,b,a} quad + +/// Set any RGB color with an {r,g,b} triplet +#define U_RGB(r,g,b) (U_COLORREF){(uint8_t)(r), (uint8_t)(g), (uint8_t)(b), 0} +/// Set any RGBA color with an {r,g,b,a} quad +#define U_RGBA(r,g,b,a) (U_COLORREF){(uint8_t)(r), (uint8_t)(g), (uint8_t)(b), (uint8_t)(a)} #define U_RGBAGetR(rgb) ((U_COLORREF)rgb).Red //!< Color RGB Get Red Macro. #define U_RGBAGetG(rgb) ((U_COLORREF)rgb).Green //!< Color RGB Get Green Macro. #define U_RGBAGetB(rgb) ((U_COLORREF)rgb).Blue //!< Color RGB Get Blue Macro. diff --git a/src/libuemf/uemf_print.c b/src/libuemf/uemf_print.c index 1d6bebc40..4ea9620cf 100644 --- a/src/libuemf/uemf_print.c +++ b/src/libuemf/uemf_print.c @@ -395,7 +395,7 @@ void blend_print( void extlogpen_print( PU_EXTLOGPEN elp ){ - int i; + unsigned i; U_STYLEENTRY *elpStyleEntry; printf("elpPenStyle:0x%8.8X " ,elp->elpPenStyle ); printf("elpWidth:%u " ,elp->elpWidth ); @@ -478,7 +478,7 @@ void rgndataheader_print( void rgndata_print( PU_RGNDATA rd ){ - int i; + unsigned i; PU_RECTL rects; printf("rdh:"); rgndataheader_print(rd->rdh ); if(rd->rdh.nCount){ @@ -556,7 +556,7 @@ void emrtext_print( const char *record, int type ){ - int i,off; + unsigned i, off; char *string; PU_EMRTEXT pemt = (PU_EMRTEXT) emt; // constant part @@ -609,7 +609,8 @@ by end user code and to further that end prototypes are NOT provided and they ar // Functions with the same form starting with U_EMRPOLYBEZIER_print void core1_print(const char *name, const char *contents){ - int i; + unsigned i; + (void) name; PU_EMRPOLYLINETO pEmr = (PU_EMRPOLYLINETO) (contents); printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" cptl: %d\n",pEmr->cptl ); @@ -622,7 +623,8 @@ void core1_print(const char *name, const char *contents){ // Functions with the same form starting with U_EMRPOLYPOLYLINE_print void core2_print(const char *name, const char *contents){ - int i; + unsigned i; + (void) name; PU_EMRPOLYPOLYGON pEmr = (PU_EMRPOLYPOLYGON) (contents); printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" nPolys: %d\n",pEmr->nPolys ); @@ -644,6 +646,7 @@ void core2_print(const char *name, const char *contents){ // Functions with the same form starting with U_EMRSETMAPMODE_print void core3_print(const char *name, const char *label, const char *contents){ PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents); + (void) name; if(!strcmp(label,"crColor:")){ printf(" %-15s ",label); colorref_print(*(U_COLORREF *)&(pEmr->iMode)); printf("\n"); } @@ -658,12 +661,14 @@ void core3_print(const char *name, const char *label, const char *contents){ // Functions taking a single U_RECT or U_RECTL, starting with U_EMRELLIPSE_print, also U_EMRFILLPATH_print, void core4_print(const char *name, const char *contents){ PU_EMRELLIPSE pEmr = (PU_EMRELLIPSE)( contents); + (void) name; printf(" rclBox: "); rectl_print(pEmr->rclBox); printf("\n"); } // Functions with the same form starting with U_EMRPOLYBEZIER16_print void core6_print(const char *name, const char *contents){ - int i; + unsigned i; + (void) name; PU_EMRPOLYBEZIER16 pEmr = (PU_EMRPOLYBEZIER16) (contents); printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" cpts: %d\n",pEmr->cpts ); @@ -682,6 +687,7 @@ void core6_print(const char *name, const char *contents){ // empty the values are printed as a pair {x,y}, otherwise each is printed with its own label on a separate line. void core7_print(const char *name, const char *field1, const char *field2, const char *contents){ PU_EMRGENERICPAIR pEmr = (PU_EMRGENERICPAIR) (contents); + (void) name; if(*field2){ printf(" %-15s %d\n",field1,pEmr->pair.x); printf(" %-15s %d\n",field2,pEmr->pair.y); @@ -694,6 +700,7 @@ void core7_print(const char *name, const char *field1, const char *field2, const // For U_EMREXTTEXTOUTA and U_EMREXTTEXTOUTW, type=0 for the first one void core8_print(const char *name, const char *contents, int type){ PU_EMREXTTEXTOUTA pEmr = (PU_EMREXTTEXTOUTA) (contents); + (void) name; printf(" iGraphicsMode: %u\n",pEmr->iGraphicsMode ); printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" exScale: %f\n",pEmr->exScale ); @@ -706,6 +713,7 @@ void core8_print(const char *name, const char *contents, int type){ // Functions that take a rect and a pair of points, starting with U_EMRARC_print void core9_print(const char *name, const char *contents){ PU_EMRARC pEmr = (PU_EMRARC) (contents); + (void) name; printf(" rclBox: "); rectl_print(pEmr->rclBox); printf("\n"); printf(" ptlStart: "); pointl_print(pEmr->ptlStart); printf("\n"); printf(" ptlEnd: "); pointl_print(pEmr->ptlEnd); printf("\n"); @@ -713,8 +721,9 @@ void core9_print(const char *name, const char *contents){ // Functions with the same form starting with U_EMRPOLYPOLYLINE16_print void core10_print(const char *name, const char *contents){ - int i; + unsigned i; PU_EMRPOLYPOLYLINE16 pEmr = (PU_EMRPOLYPOLYLINE16) (contents); + (void) name; printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" nPolys: %d\n",pEmr->nPolys ); printf(" cpts: %d\n",pEmr->cpts ); @@ -734,8 +743,9 @@ void core10_print(const char *name, const char *contents){ // Functions with the same form starting with U_EMRINVERTRGN_print and U_EMRPAINTRGN_print, void core11_print(const char *name, const char *contents){ - int i,roff; + unsigned i,roff; PU_EMRINVERTRGN pEmr = (PU_EMRINVERTRGN) (contents); + (void) name; printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" cbRgnData: %d\n",pEmr->cbRgnData); // This one is a pain since each RGNDATA may be a different size, so it isn't possible to index through them. @@ -754,6 +764,7 @@ void core11_print(const char *name, const char *contents){ // common code for U_EMRCREATEMONOBRUSH_print and U_EMRCREATEDIBPATTERNBRUSHPT_print, void core12_print(const char *name, const char *contents){ PU_EMRCREATEMONOBRUSH pEmr = (PU_EMRCREATEMONOBRUSH) (contents); + (void) name; printf(" ihBrush: %u\n",pEmr->ihBrush ); printf(" iUsage : %u\n",pEmr->iUsage ); printf(" offBmi : %u\n",pEmr->offBmi ); @@ -770,6 +781,7 @@ void core12_print(const char *name, const char *contents){ // common code for U_EMRALPHABLEND_print and U_EMRTRANSPARENTBLT_print, void core13_print(const char *name, const char *contents){ PU_EMRALPHABLEND pEmr = (PU_EMRALPHABLEND) (contents); + (void) name; printf(" rclBounds: "); rectl_print( pEmr->rclBounds); printf("\n"); printf(" Dest: "); pointl_print(pEmr->Dest); printf("\n"); printf(" cDest: "); pointl_print(pEmr->cDest); printf("\n"); @@ -802,6 +814,8 @@ They are listed in order by the corresponding U_EMR_* index number. \param contents pointer to a buffer holding all EMR records */ void U_EMRNOTIMPLEMENTED_print(const char *name, const char *contents){ + (void) name; + (void) contents; printf(" Not Implemented!\n"); } @@ -1114,6 +1128,7 @@ void U_EMRMOVETOEX_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRSETMETARGN_print(const char *contents){ + (void) contents; } // U_EMREXCLUDECLIPRECT 29 @@ -1159,6 +1174,7 @@ void U_EMRSCALEWINDOWEXTEX_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRSAVEDC_print(const char *contents){ + (void) contents; } // U_EMRRESTOREDC 34 @@ -1337,7 +1353,7 @@ void U_EMRCREATEPALETTE_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRSETPALETTEENTRIES_print(const char *contents){ - int i; + unsigned i; PU_EMRSETPALETTEENTRIES pEmr = (PU_EMRSETPALETTEENTRIES)(contents); printf(" ihPal: %u\n",pEmr->ihPal); printf(" iStart: %u\n",pEmr->iStart); @@ -1367,6 +1383,7 @@ void U_EMRRESIZEPALETTE_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRREALIZEPALETTE_print(const char *contents){ + (void) contents; } // U_EMREXTFLOODFILL 53 @@ -1405,7 +1422,7 @@ void U_EMRARCTO_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRPOLYDRAW_print(const char *contents){ - int i; + unsigned i; PU_EMRPOLYDRAW pEmr = (PU_EMRPOLYDRAW)(contents); printf(" rclBounds: "); rectl_print( pEmr->rclBounds); printf("\n"); printf(" cptl: %d\n",pEmr->cptl ); @@ -1447,6 +1464,7 @@ void U_EMRSETMITERLIMIT_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRBEGINPATH_print(const char *contents){ + (void) contents; } // U_EMRENDPATH 60 @@ -1455,6 +1473,7 @@ void U_EMRBEGINPATH_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRENDPATH_print(const char *contents){ + (void) contents; } // U_EMRCLOSEFIGURE 61 @@ -1463,6 +1482,7 @@ void U_EMRENDPATH_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRCLOSEFIGURE_print(const char *contents){ + (void) contents; } // U_EMRFILLPATH 62 @@ -1498,6 +1518,7 @@ void U_EMRSTROKEPATH_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRFLATTENPATH_print(const char *contents){ + (void) contents; } // U_EMRWIDENPATH 66 @@ -1506,6 +1527,7 @@ void U_EMRFLATTENPATH_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRWIDENPATH_print(const char *contents){ + (void) contents; } // U_EMRSELECTCLIPPATH 67 @@ -1523,6 +1545,7 @@ void U_EMRSELECTCLIPPATH_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRABORTPATH_print(const char *contents){ + (void) contents; } // U_EMRUNDEF69 69 @@ -1543,9 +1566,9 @@ void U_EMRCOMMENT_print(const char *contents){ cbData = pEmr->cbData; printf(" cbData: %d\n",cbData ); - src = (char *)&(pEmr->Data); // default + src = (char *)(&pEmr->Data); // default if(cbData >= 4){ - cIdent = *(uint32_t *)&(pEmr->Data); + cIdent = *(uint32_t *)(src); if( cIdent == U_EMR_COMMENT_PUBLIC ){ printf(" cIdent: Public\n"); PU_EMRCOMMENT_PUBLIC pEmrp = (PU_EMRCOMMENT_PUBLIC) pEmr; @@ -1586,7 +1609,7 @@ void U_EMRCOMMENT_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRFILLRGN_print(const char *contents){ - int i,roff; + unsigned i,roff; PU_EMRFILLRGN pEmr = (PU_EMRFILLRGN)(contents); printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" cbRgnData: %u\n",pEmr->cbRgnData); @@ -1607,7 +1630,7 @@ void U_EMRFILLRGN_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRFRAMERGN_print(const char *contents){ - int i,roff; + unsigned i,roff; PU_EMRFRAMERGN pEmr = (PU_EMRFRAMERGN)(contents); printf(" rclBounds: "); rectl_print(pEmr->rclBounds); printf("\n"); printf(" cbRgnData: %u\n",pEmr->cbRgnData); @@ -1647,7 +1670,7 @@ void U_EMRPAINTRGN_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMREXTSELECTCLIPRGN_print(const char *contents){ - int i,roff; + unsigned i,roff; PU_EMREXTSELECTCLIPRGN pEmr = (PU_EMREXTSELECTCLIPRGN) (contents); printf(" cbRgnData: %u\n",pEmr->cbRgnData); printf(" iMode: %u\n",pEmr->iMode); @@ -1944,7 +1967,7 @@ void U_EMRPOLYPOLYGON16_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRPOLYDRAW16_print(const char *contents){ - int i; + unsigned i; PU_EMRPOLYDRAW16 pEmr = (PU_EMRPOLYDRAW16)(contents); printf(" rclBounds: "); rectl_print( pEmr->rclBounds); printf("\n"); printf(" cpts: %d\n",pEmr->cpts ); @@ -2141,7 +2164,7 @@ void U_EMRTRANSPARENTBLT_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRGRADIENTFILL_print(const char *contents){ - int i; + unsigned i; PU_EMRGRADIENTFILL pEmr = (PU_EMRGRADIENTFILL)(contents); printf(" rclBounds: "); rectl_print( pEmr->rclBounds); printf("\n"); printf(" nTriVert: %u\n", pEmr->nTriVert ); @@ -2186,7 +2209,7 @@ void U_EMRGRADIENTFILL_print(const char *contents){ \param contents pointer to a buffer holding all EMR records */ void U_EMRCREATECOLORSPACEW_print(const char *contents){ - int i; + unsigned i; PU_EMRCREATECOLORSPACEW pEmr = (PU_EMRCREATECOLORSPACEW)(contents); printf(" ihCS: %u\n", pEmr->ihCS ); printf(" ColorSpace: "); logcolorspacew_print(pEmr->lcs); printf("\n"); @@ -2211,7 +2234,7 @@ void U_EMRCREATECOLORSPACEW_print(const char *contents){ */ int U_emf_onerec_print(const char *contents, const char *blimit, int recnum, size_t off){ PU_ENHMETARECORD lpEMFR = (PU_ENHMETARECORD)(contents + off); - int size; + unsigned size; printf("%-30srecord:%5d type:%3d offset:%8d size:%8d\n",U_emr_names(lpEMFR->iType),recnum,lpEMFR->iType,(int) off,lpEMFR->nSize); size = lpEMFR->nSize; diff --git a/src/libuemf/uwmf_print.c b/src/libuemf/uwmf_print.c index bb9f3eb36..d044cf9b6 100644 --- a/src/libuemf/uwmf_print.c +++ b/src/libuemf/uwmf_print.c @@ -43,6 +43,7 @@ extern "C" { void brush_print( U_BRUSH b ){ + uint16_t hatch; U_COLORREF Color; switch(b.Style){ case U_BS_SOLID: @@ -59,7 +60,8 @@ void brush_print( printf("DIBPattern:(not shown)"); break; case U_BS_HATCHED: - printf("Hatch:0x%4.4X ", *(uint16_t *)(b.Data)); + memcpy(&hatch, b.Data, 2); + printf("Hatch:0x%4.4X ", hatch); break; } } @@ -406,10 +408,12 @@ They are listed in order by the corresponding U_WMR_* index number. \param contents pointer to a buffer holding a WMR record */ void U_WMRNOTIMPLEMENTED_print(const char *contents){ + (void) contents; printf(" Not Implemented!\n"); } void U_WMREOF_print(const char *contents){ + (void) contents; } void U_WMRSETBKCOLOR_print(const char *contents){ @@ -445,6 +449,7 @@ void U_WMRSETROP2_print(const char *contents){ } void U_WMRSETRELABS_print(const char *contents){ + (void) contents; /* This record type has only the common 6 bytes, so nothing (else) to print */ } @@ -680,6 +685,7 @@ void U_WMRPATBLT_print(const char *contents){ } void U_WMRSAVEDC_print(const char *contents){ + (void) contents; /* This record type has only the common 6 bytes, so nothing (else) to print */ } @@ -784,6 +790,7 @@ void U_WMRESCAPE_print(const char *contents){ } void U_WMRRESTOREDC_print(const char *contents){ + (void) contents; /* This record type has only the common 6 bytes, so nothing (else) to print */ } @@ -926,6 +933,7 @@ void U_WMRSELECTPALETTE_print(const char *contents){ } void U_WMRREALIZEPALETTE_print(const char *contents){ + (void) contents; /* This record type has only the common 6 bytes, so nothing (else) to print */ } |
