app, plug-ins: Use strcpy_s on Windows to fix CRT_INSECURE_DEPRECATE warnings
This commit is contained in:
parent
2066844166
commit
77682518b9
11 changed files with 100 additions and 0 deletions
|
|
@ -1944,7 +1944,13 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
|||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%.%df%%s%%.%df%%s",
|
||||
w_digits, h_digits);
|
||||
#ifndef _UCRT
|
||||
strcpy (statusbar->cursor_format_str_f, statusbar->cursor_format_str);
|
||||
#else
|
||||
strcpy_s (statusbar->cursor_format_str_f,
|
||||
sizeof (statusbar->cursor_format_str_f),
|
||||
statusbar->cursor_format_str);
|
||||
#endif
|
||||
g_snprintf (statusbar->length_format_str,
|
||||
sizeof (statusbar->length_format_str),
|
||||
"%%s%%.%df%%s", MAX (w_digits, h_digits));
|
||||
|
|
|
|||
|
|
@ -106,11 +106,19 @@ gimp_text_font_name_from_xlfd (const gchar *xlfd)
|
|||
switch (*fields[i])
|
||||
{
|
||||
case 'i':
|
||||
#ifndef _UCRT
|
||||
strcpy (buffers[i], "italic");
|
||||
#else
|
||||
strcpy_s (buffers[i], sizeof (buffers[i]), "italic");
|
||||
#endif
|
||||
i++;
|
||||
break;
|
||||
case 'o':
|
||||
#ifndef _UCRT
|
||||
strcpy (buffers[i], "oblique");
|
||||
#else
|
||||
strcpy_s (buffers[i], sizeof (buffers[i]), "oblique");
|
||||
#endif
|
||||
i++;
|
||||
break;
|
||||
case 'r':
|
||||
|
|
|
|||
|
|
@ -504,9 +504,17 @@ gimp_file_proc_view_pattern_from_extension (const gchar *extension,
|
|||
pattern = g_new (gchar, 6 + 4 * len);
|
||||
|
||||
if (is_meta)
|
||||
#ifndef _UCRT
|
||||
strcpy (pattern, "*.*.");
|
||||
#else
|
||||
strcpy_s (pattern, 6 + 4 * len, "*.*.");
|
||||
#endif
|
||||
else
|
||||
#ifndef _UCRT
|
||||
strcpy (pattern, "*.");
|
||||
#else
|
||||
strcpy_s (pattern, 6 + 4 * len, "*.");
|
||||
#endif
|
||||
|
||||
for (i = 0, p = pattern + 2; i < len; i++, p+= 4)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -332,7 +332,11 @@ xcf_save_image (XcfInfo *info,
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef _UCRT
|
||||
strcpy (version_tag, "gimp xcf file");
|
||||
#else
|
||||
strcpy_s (version_tag, sizeof (version_tag), "gimp xcf file");
|
||||
#endif
|
||||
}
|
||||
|
||||
xcf_write_int8_check_error (info, (guint8 *) version_tag, 14, ;);
|
||||
|
|
|
|||
|
|
@ -1372,7 +1372,11 @@ remove_disposal_tag (gchar *dest,
|
|||
|
||||
length = strlen (src);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (dest, src);
|
||||
#else
|
||||
strcpy_s (dest, length + 1, src);
|
||||
#endif
|
||||
|
||||
while (offset<=length)
|
||||
{
|
||||
|
|
@ -1400,7 +1404,11 @@ remove_ms_tag (gchar *dest,
|
|||
|
||||
length = strlen (src);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (dest, src);
|
||||
#else
|
||||
strcpy_s (dest, length + 1, src);
|
||||
#endif
|
||||
|
||||
while (offset<=length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1422,8 +1422,14 @@ compose_dialog (GimpProcedure *procedure,
|
|||
composevals.inputs[j].comp.val = composeint.selected[j].comp.val;
|
||||
}
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (composevals.compose_type,
|
||||
compose_dsc[compose_idx].compose_type);
|
||||
#else
|
||||
strcpy_s (composevals.compose_type,
|
||||
sizeof (composevals.compose_type),
|
||||
compose_dsc[compose_idx].compose_type);
|
||||
#endif
|
||||
}
|
||||
|
||||
return run;
|
||||
|
|
|
|||
|
|
@ -844,7 +844,11 @@ export_image (GFile *file,
|
|||
|
||||
/* Headers */
|
||||
memset (header, 0, 32);
|
||||
#ifndef _UCRT
|
||||
strcpy ((gchar *) header, "KiSS");
|
||||
#else
|
||||
strcpy_s ((gchar *) header, sizeof(header), "KiSS");
|
||||
#endif
|
||||
header[4]= 0x20;
|
||||
|
||||
/* Work out whether to save as 8bit or 4bit */
|
||||
|
|
|
|||
|
|
@ -444,7 +444,11 @@ load_image (GFile *file,
|
|||
element_length_chars[1] = value_rep[1];
|
||||
|
||||
/* Unknown value rep. It is not used right now anyhow */
|
||||
#ifndef _UCRT
|
||||
strcpy (value_rep, "??");
|
||||
#else
|
||||
strcpy_s (value_rep, sizeof (value_rep), "??");
|
||||
#endif
|
||||
|
||||
/* For implicit value_values the length is always four bytes,
|
||||
so we need to read another two. */
|
||||
|
|
|
|||
|
|
@ -474,7 +474,11 @@ browser_search (GimpBrowser *gimp_browser,
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef _UCRT
|
||||
strcpy (xtimestr, "");
|
||||
#else
|
||||
strcpy_s (xtimestr, sizeof (xtimestr), "");
|
||||
#endif
|
||||
}
|
||||
|
||||
pinfo = g_new0 (PInfo, 1);
|
||||
|
|
|
|||
|
|
@ -1377,13 +1377,21 @@ ani_export_image (GFile *file,
|
|||
}
|
||||
|
||||
/* Writing the .ani header data */
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "RIFF");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "RIFF");
|
||||
#endif
|
||||
size = 0;
|
||||
fwrite (id, 4, 1, fp);
|
||||
ofs_size_riff = ftell (fp);
|
||||
fwrite (&size, sizeof (size), 1, fp);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "ACON");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "ACON");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
|
||||
if ((ani_info->inam && strlen (ani_info->inam) > 0) ||
|
||||
|
|
@ -1391,16 +1399,28 @@ ani_export_image (GFile *file,
|
|||
{
|
||||
gint32 string_size;
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "LIST");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "LIST");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
ofs_size_info = ftell (fp);
|
||||
fwrite (&size, sizeof (size), 1, fp);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "INFO");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "INFO");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
if (ani_info->inam && strlen (ani_info->inam) > 0) /* Cursor name */
|
||||
{
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "INAM");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "INAM");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
string_size = strlen (ani_info->inam) + 1;
|
||||
fwrite (&string_size, 4, 1, fp);
|
||||
|
|
@ -1413,7 +1433,11 @@ ani_export_image (GFile *file,
|
|||
}
|
||||
if (ani_info->iart && strlen (ani_info->iart) > 0) /* Author name */
|
||||
{
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "IART");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "IART");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
string_size = strlen (ani_info->iart) + 1;
|
||||
fwrite (&string_size, 4, 1, fp);
|
||||
|
|
@ -1432,21 +1456,37 @@ ani_export_image (GFile *file,
|
|||
fseek (fp, 0L, SEEK_END);
|
||||
}
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "anih");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "anih");
|
||||
#endif
|
||||
size = sizeof (*header);
|
||||
fwrite (id, 4, 1, fp);
|
||||
fwrite (&size, sizeof (size), 1, fp);
|
||||
fwrite (header, sizeof (*header), 1, fp);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "LIST");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "LIST");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
ofs_size_list = ftell (fp);
|
||||
fwrite (&size, sizeof (size), 1, fp);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "fram");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "fram");
|
||||
#endif
|
||||
fwrite (id, 4, 1, fp);
|
||||
|
||||
#ifndef _UCRT
|
||||
strcpy (id, "icon");
|
||||
#else
|
||||
strcpy_s (id, sizeof (id), "icon");
|
||||
#endif
|
||||
for (i = 0; i < info.num_icons; i++ )
|
||||
{
|
||||
GimpPDBStatusType status;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,11 @@ input_port_struct_from_string (scheme *sc, char *start) {
|
|||
}
|
||||
|
||||
/* Assert strcpy writes NUL at end of buffer. */
|
||||
#ifndef _UCRT
|
||||
strcpy (copy, start);
|
||||
#else
|
||||
strcpy_s (copy, buffer_size_bytes, start);
|
||||
#endif
|
||||
|
||||
init_port_struct (port_struct, port_string | port_input, copy, buffer_size_bytes);
|
||||
|
||||
|
|
@ -296,7 +300,11 @@ output_port_expand_by_at_least (scheme *sc, port *p, size_t byte_count)
|
|||
memset (new_buffer, '\0', new_size);
|
||||
|
||||
/* This copies the terminating NUL. */
|
||||
#ifndef _UCRT
|
||||
strcpy (new_buffer, current_contents);
|
||||
#else
|
||||
strcpy_s (new_buffer, new_size, current_contents);
|
||||
#endif
|
||||
|
||||
reset_output_port_struct (p, new_buffer, new_size, new_curr);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue