fix: don't use plain strings in vars as printf formats

This commit is contained in:
Stéphane Lesimple
2021-01-15 19:41:17 +01:00
parent e8eb7824aa
commit 66cf0d25ee
11 changed files with 25 additions and 25 deletions

View File

@@ -62,7 +62,7 @@ guint64 SwapBytes64(guint64 in)
*/
void print_hex(char *label, guint8 *values, int n)
{ PrintCLI(label);
{ PrintCLI("%s", label);
while(n--)
PrintCLI("%02x ",*values++);

View File

@@ -707,7 +707,7 @@ void AboutTextWithLink(GtkWidget *parent, char *text, char *action)
g_free(utf);
}
}
else AboutText(parent, head);
else AboutText(parent, "%s", head);
if(end_of_line) head = end_of_line+1;
else break;
@@ -739,7 +739,7 @@ void AboutDialog()
text = g_strdup_printf("<span weight=\"bold\" size=\"xx-large\">dvdisaster</span><i> "
"Version %s</i>",
Closure->cookedVersion);
AboutText(vbox, text);
AboutText(vbox, "%s", text);
g_free(text);
#ifdef MODIFIED_SOURCE

View File

@@ -1339,7 +1339,7 @@ void fill_gap(read_closure *rc)
ChangeSpiralCursor(Closure->readAdaptiveSpiral, -1);
}
#endif
PrintCLI(t);
PrintCLI("%s", t);
g_free(t);
/*** Seek to end of image */
@@ -1615,7 +1615,7 @@ reopen_image:
{ char *t = _("\nSufficient data for reconstructing the image is available.\n");
if(rc->readMode != IMAGE_ONLY)
{ PrintLog(t);
{ PrintLog("%s", t);
#ifndef CLI
if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->greenText);
@@ -1947,7 +1947,7 @@ reread:
print_progress(rc, TRUE);
if(rc->readMode != IMAGE_ONLY)
{ PrintLog(t);
{ PrintLog("%s", t);
#ifndef CLI
if(Closure->guiMode && rc->ei)
SetAdaptiveReadFootline(t, Closure->foreground);
@@ -2128,7 +2128,7 @@ finished:
if(rc->readMode == IMAGE_ONLY)
{ if(rc->readable == rc->expectedSectors)
{ char *t = _("\nGood! All sectors have been read.\n");
PrintLog(t);
PrintLog("%s", t);
#ifndef CLI
if(Closure->guiMode)
SetAdaptiveReadFootline(t, Closure->foreground);

View File

@@ -1087,7 +1087,7 @@ reread:
g_mutex_lock(rc->mutex);
if(rc->workerError) /* something went wrong in the worker thread */
{ g_mutex_unlock(rc->mutex);
Stop(rc->workerError);
Stop("%s", rc->workerError);
}
while(rc->bufState[rc->readPtr] != BUF_EMPTY)
{ g_cond_wait(rc->canRead, rc->mutex);
@@ -1240,7 +1240,7 @@ reread:
g_mutex_lock(rc->mutex);
if(rc->workerError) /* something went wrong in the worker thread */
{ g_mutex_unlock(rc->mutex);
Stop(rc->workerError);
Stop("%s", rc->workerError);
}
while(rc->bufState[rc->readPtr] != BUF_EMPTY)

View File

@@ -322,8 +322,8 @@ void RS01Fix(Image *image)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, NULL,
_("Image file appears to be truncated.\n"
"Consider completing it with another reading pass before going on.\n"), NULL);
"%s",_("Image file appears to be truncated.\n"
"Consider completing it with another reading pass before going on.\n"));
if(!answer)
{
#ifndef CLI

View File

@@ -946,7 +946,7 @@ skip_ecc:
#ifndef CLI
if(Closure->guiMode)
{ if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), ecc_advice);
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);
g_free(ecc_advice);
}
else SetLabelText(GTK_LABEL(wl->cmpEccResult),

View File

@@ -1143,8 +1143,8 @@ void RS02Create(void)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Using redundancies below 20%% may not give\n"
"the expected data loss protection.\n"), NULL);
"%s", _("Using redundancies below 20% may not give\n"
"the expected data loss protection.\n"));
if(!answer)
abort_encoding(ec, FALSE);

View File

@@ -917,7 +917,7 @@ void RS02Verify(Image *image)
SetLabelText(GTK_LABEL(wl->cmpImageMd5Sum), "%s", data_missing ? "-" : data_digest);
if(img_advice)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), img_advice);
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), "%s", img_advice);
g_free(img_advice);
}
else
@@ -935,7 +935,7 @@ void RS02Verify(Image *image)
#endif
{
if(img_advice)
{ PrintLog(img_advice);
{ PrintLog("%s", img_advice);
}
}
@@ -1170,7 +1170,7 @@ continue_with_ecc:
#ifndef CLI
if(Closure->guiMode)
{ if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), ecc_advice);
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);
g_free(ecc_advice);
}
else
@@ -1190,7 +1190,7 @@ continue_with_ecc:
else
#endif
{ if(ecc_advice)
{ PrintLog(ecc_advice);
{ PrintLog("%s", ecc_advice);
g_free(ecc_advice);
}
}

View File

@@ -1406,8 +1406,8 @@ void RS03Create(void)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("Using redundancies below 20%% may not give\n"
"the expected data loss protection.\n"), NULL);
"%s", _("Using redundancies below 20% may not give\n"
"the expected data loss protection.\n"));
if(!answer)
abort_encoding(ec, FALSE);
@@ -1422,8 +1422,8 @@ void RS03Create(void)
{ int answer;
answer = ModalWarningOrCLI(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, NULL,
_("BD-R size with no defect management enabled,\n"
"remember it should you need to repair this image later!\n"), NULL);
"%s", _("BD-R size with no defect management enabled,\n"
"remember it should you need to repair this image later!\n"));
if(!answer)
abort_encoding(ec, FALSE);

View File

@@ -945,7 +945,7 @@ void RS03Verify(Image *image)
#ifndef CLI
if(Closure->guiMode)
{ if(ecc_advice)
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), ecc_advice);
{ SetLabelText(GTK_LABEL(wl->cmpEccResult), "%s", ecc_advice);
g_free(ecc_advice);
}
else SetLabelText(GTK_LABEL(wl->cmpEccResult),
@@ -1379,7 +1379,7 @@ void RS03Verify(Image *image)
if(Closure->guiMode)
{
if(img_advice)
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), img_advice);
{ SetLabelText(GTK_LABEL(wl->cmpImageResult), "%s", img_advice);
g_free(img_advice);
}
else

View File

@@ -2009,7 +2009,7 @@ static gint64 query_size(Image *image)
}
g_string_append_printf(warning, _("Final decision: %s\n\n"), decision_msg);
LogWarning(warning->str);
LogWarning("%s", warning->str);
g_string_free(warning, TRUE);