From 996498742cfd19ea7130d6fc68f9df3a07d3fbf3 Mon Sep 17 00:00:00 2001 From: Nathan Johansen Date: Sun, 15 Jan 2023 18:07:02 +0000 Subject: [PATCH] Update wmf-inout.cpp to replace deprecated instances of sprintf with snprintf --- src/extension/internal/wmf-inout.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 048295dae6..3ef8d51aea 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -254,14 +254,14 @@ uint32_t Wmf::add_hatch(PWMF_CALLBACK_DATA d, uint32_t hatchType, U_COLORREF hat switch(hatchType){ case U_HS_SOLIDTEXTCLR: case U_HS_DITHEREDTEXTCLR: - sprintf(tmpcolor,"%6.6X",sethexcolor(d->dc[d->level].textColor)); + snprintf(tmpcolor,"%6.6X",sethexcolor(d->dc[d->level].textColor)); break; case U_HS_SOLIDBKCLR: case U_HS_DITHEREDBKCLR: - sprintf(tmpcolor,"%6.6X",sethexcolor(d->dc[d->level].bkColor)); + snprintf(tmpcolor,"%6.6X",sethexcolor(d->dc[d->level].bkColor)); break; default: - sprintf(tmpcolor,"%6.6X",sethexcolor(hatchColor)); + snprintf(tmpcolor,"%6.6X",sethexcolor(hatchColor)); break; } auto & defs = d->defs; @@ -271,7 +271,7 @@ uint32_t Wmf::add_hatch(PWMF_CALLBACK_DATA d, uint32_t hatchType, U_COLORREF hat This will be used late to compose, or recompose the transparent or opaque final hatch.*/ std::string refpath; // used to reference later the path pieces which are about to be created - sprintf(hpathname,"WMFhpath%d_%s",hatchType,tmpcolor); + snprintf(hpathname,"WMFhpath%d_%s",hatchType,tmpcolor); idx = in_hatches(d,hpathname); if(!idx){ // add path/color if not already present if(d->hatches.count == d->hatches.size){ enlarge_hatches(d); } @@ -369,8 +369,8 @@ uint32_t Wmf::add_hatch(PWMF_CALLBACK_DATA d, uint32_t hatchType, U_COLORREF hat } if(d->dc[d->level].bkMode == U_TRANSPARENT || hatchType >= U_HS_SOLIDCLR){ - sprintf(hatchname,"WMFhatch%d_%s",hatchType,tmpcolor); - sprintf(hpathname,"WMFhpath%d_%s",hatchType,tmpcolor); + snprintf(hatchname,"WMFhatch%d_%s",hatchType,tmpcolor); + snprintf(hpathname,"WMFhpath%d_%s",hatchType,tmpcolor); idx = in_hatches(d,hatchname); if(!idx){ // add it if not already present if(d->hatches.count == d->hatches.size){ enlarge_hatches(d); } @@ -386,8 +386,8 @@ uint32_t Wmf::add_hatch(PWMF_CALLBACK_DATA d, uint32_t hatchType, U_COLORREF hat } else { // bkMode==U_OPAQUE /* Set up an object in the defs for this background, if there is not one already there */ - sprintf(bkcolor,"%6.6X",sethexcolor(d->dc[d->level].bkColor)); - sprintf(hbkname,"WMFhbkclr_%s",bkcolor); + snprintf(bkcolor,"%6.6X",sethexcolor(d->dc[d->level].bkColor)); + snprintf(hbkname,"WMFhbkclr_%s",bkcolor); idx = in_hatches(d,hbkname); if(!idx){ // add path/color if not already present. Hatchtype is not needed in the name. if(d->hatches.count == d->hatches.size){ enlarge_hatches(d); } @@ -402,7 +402,7 @@ uint32_t Wmf::add_hatch(PWMF_CALLBACK_DATA d, uint32_t hatchType, U_COLORREF hat } // this is the pattern, its name will show up in Inkscape's pattern selector - sprintf(hatchname,"WMFhatch%d_%s_%s",hatchType,tmpcolor,bkcolor); + snprintf(hatchname,"WMFhatch%d_%s_%s",hatchType,tmpcolor,bkcolor); idx = in_hatches(d,hatchname); if(!idx){ // add it if not already present if(d->hatches.count == d->hatches.size){ enlarge_hatches(d); } @@ -503,8 +503,8 @@ uint32_t Wmf::add_dib_image(PWMF_CALLBACK_DATA d, const char *dib, uint32_t iUsa idx = d->images.count; d->images.strings[d->images.count++]=strdup(base64String); - sprintf(imagename,"WMFimage%d",idx++); - sprintf(xywh," x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" ",width,height); // reuse this buffer + snprintf(imagename,"WMFimage%d",idx++); + snprintf(xywh," x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" ",width,height); // reuse this buffer defs += "\n"; defs += " images.count; d->images.strings[d->images.count++]=g_strdup(base64String); - sprintf(imagename,"WMFimage%d",idx++); - sprintf(xywh," x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" ",width,height); // reuse this buffer + snprintf(imagename,"WMFimage%d",idx++); + snprintf(xywh," x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" ",width,height); // reuse this buffer defs += "\n"; defs += "