app, libgimp*, plug-ins: Use strncpy_s on Windows to fix CRT_INSECURE_DEPRECATE
This commit is contained in:
parent
fe185577e2
commit
ed3611efa6
5 changed files with 39 additions and 1 deletions
|
|
@ -237,7 +237,7 @@ gimp_backtrace_exception_handler (PEXCEPTION_POINTERS info)
|
||||||
|
|
||||||
if (info->ExceptionRecord != NULL &&
|
if (info->ExceptionRecord != NULL &&
|
||||||
info->ExceptionRecord->ExceptionCode == EXCEPTION_SET_THREAD_NAME &&
|
info->ExceptionRecord->ExceptionCode == EXCEPTION_SET_THREAD_NAME &&
|
||||||
info->ExceptionRecord->NumberParameters *
|
info->ExceptionRecord->NumberParameters *
|
||||||
sizeof (ULONG_PTR) == sizeof (THREADNAME_INFO))
|
sizeof (ULONG_PTR) == sizeof (THREADNAME_INFO))
|
||||||
{
|
{
|
||||||
THREADNAME_INFO name_info;
|
THREADNAME_INFO name_info;
|
||||||
|
|
@ -644,7 +644,11 @@ utf8_copy_sized (char *dest,
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (dest, src, size);
|
strncpy (dest, src, size);
|
||||||
|
#else
|
||||||
|
strncpy_s (dest, sizeof (dest), src, size);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (dest[size - 1] != 0)
|
if (dest[size - 1] != 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -864,7 +864,11 @@ gimp_thumb_png_name (const gchar *uri)
|
||||||
name[i * 2 + 1] = (n > 9) ? 'a' + n - 10 : '0' + n;
|
name[i * 2 + 1] = (n > 9) ? 'a' + n - 10 : '0' + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (name + 32, ".png", 5);
|
strncpy (name + 32, ".png", 5);
|
||||||
|
#else
|
||||||
|
strncpy_s (name + 32, 8, ".png", 5);
|
||||||
|
#endif
|
||||||
|
|
||||||
return (const gchar *) name;
|
return (const gchar *) name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,12 @@ gimp_eevl_quantity (GimpEevl *eva)
|
||||||
|
|
||||||
identifier = g_newa (gchar, consumed_token.value.size + 1);
|
identifier = g_newa (gchar, consumed_token.value.size + 1);
|
||||||
|
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (identifier, consumed_token.value.c, consumed_token.value.size);
|
strncpy (identifier, consumed_token.value.c, consumed_token.value.size);
|
||||||
|
#else
|
||||||
|
strncpy_s (identifier, consumed_token.value.size + 1,
|
||||||
|
consumed_token.value.c, consumed_token.value.size);
|
||||||
|
#endif
|
||||||
identifier[consumed_token.value.size] = '\0';
|
identifier[consumed_token.value.size] = '\0';
|
||||||
|
|
||||||
if (eva->options.unit_resolver_proc (identifier,
|
if (eva->options.unit_resolver_proc (identifier,
|
||||||
|
|
|
||||||
|
|
@ -1925,7 +1925,12 @@ export_image (GFile *file,
|
||||||
if (save_comment && comment && strlen (comment))
|
if (save_comment && comment && strlen (comment))
|
||||||
{
|
{
|
||||||
parameters.cp_comment = g_malloc0 (strlen (comment) + 1);
|
parameters.cp_comment = g_malloc0 (strlen (comment) + 1);
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (parameters.cp_comment, comment, strlen (comment));
|
strncpy (parameters.cp_comment, comment, strlen (comment));
|
||||||
|
#else
|
||||||
|
strncpy_s (parameters.cp_comment, sizeof (parameters.cp_comment),
|
||||||
|
comment, strlen (comment));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! cmyk)
|
if (! cmyk)
|
||||||
|
|
|
||||||
|
|
@ -83,14 +83,22 @@ resource_load (FILE *file)
|
||||||
gchar type[5];
|
gchar type[5];
|
||||||
guint32 size;
|
guint32 size;
|
||||||
|
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (type, header.type, 4);
|
strncpy (type, header.type, 4);
|
||||||
|
#else
|
||||||
|
strncpy_s (type, 5, header.type, 4);
|
||||||
|
#endif
|
||||||
type[4] = '\0';
|
type[4] = '\0';
|
||||||
size = GUINT32_FROM_BE (header.size);
|
size = GUINT32_FROM_BE (header.size);
|
||||||
|
|
||||||
if (! strncmp (header.type, "icns", 4) && size > sizeof (IcnsResourceHeader))
|
if (! strncmp (header.type, "icns", 4) && size > sizeof (IcnsResourceHeader))
|
||||||
{
|
{
|
||||||
res = (IcnsResource *) g_new (guchar, sizeof (IcnsResource) + size);
|
res = (IcnsResource *) g_new (guchar, sizeof (IcnsResource) + size);
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (res->type, header.type, 4);
|
strncpy (res->type, header.type, 4);
|
||||||
|
#else
|
||||||
|
strncpy_s (res->type, 5, header.type, 4);
|
||||||
|
#endif
|
||||||
res->type[4] = '\0';
|
res->type[4] = '\0';
|
||||||
res->size = size;
|
res->size = size;
|
||||||
res->cursor = sizeof (IcnsResourceHeader);
|
res->cursor = sizeof (IcnsResourceHeader);
|
||||||
|
|
@ -144,7 +152,11 @@ resource_get_next (IcnsResource *icns,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
header = (IcnsResourceHeader *) &(icns->data[icns->cursor]);
|
header = (IcnsResourceHeader *) &(icns->data[icns->cursor]);
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (res->type, header->type, 4);
|
strncpy (res->type, header->type, 4);
|
||||||
|
#else
|
||||||
|
strncpy_s (res->type, 5, header->type, 4);
|
||||||
|
#endif
|
||||||
res->size = GUINT32_FROM_BE (header->size);
|
res->size = GUINT32_FROM_BE (header->size);
|
||||||
res->cursor = sizeof (IcnsResourceHeader);
|
res->cursor = sizeof (IcnsResourceHeader);
|
||||||
res->data = &(icns->data[icns->cursor]);
|
res->data = &(icns->data[icns->cursor]);
|
||||||
|
|
@ -455,7 +467,11 @@ icns_attach_image (GimpImage *image,
|
||||||
guint expected_size;
|
guint expected_size;
|
||||||
gboolean layer_loaded = FALSE;
|
gboolean layer_loaded = FALSE;
|
||||||
|
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (layer_name, icontype->type, 4);
|
strncpy (layer_name, icontype->type, 4);
|
||||||
|
#else
|
||||||
|
strncpy_s (layer_name, 5, icontype->type, 4);
|
||||||
|
#endif
|
||||||
layer_name[4] = '\0';
|
layer_name[4] = '\0';
|
||||||
|
|
||||||
row = 4 * icontype->width;
|
row = 4 * icontype->width;
|
||||||
|
|
@ -481,7 +497,11 @@ icns_attach_image (GimpImage *image,
|
||||||
gchar *temp_file_type = NULL;
|
gchar *temp_file_type = NULL;
|
||||||
gchar *procedure_name = NULL;
|
gchar *procedure_name = NULL;
|
||||||
|
|
||||||
|
#ifndef _UCRT
|
||||||
strncpy (image_type, (gchar *) icns->data + 8, 4);
|
strncpy (image_type, (gchar *) icns->data + 8, 4);
|
||||||
|
#else
|
||||||
|
strncpy_s (image_type, 5, (gchar *) icns->data + 8, 4);
|
||||||
|
#endif
|
||||||
image_type[4] = '\0';
|
image_type[4] = '\0';
|
||||||
|
|
||||||
/* PNG */
|
/* PNG */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue