diff --git a/app/core/gimpbacktrace-windows.c b/app/core/gimpbacktrace-windows.c index 2c76e526bc..f9260dd75f 100644 --- a/app/core/gimpbacktrace-windows.c +++ b/app/core/gimpbacktrace-windows.c @@ -237,7 +237,7 @@ gimp_backtrace_exception_handler (PEXCEPTION_POINTERS info) if (info->ExceptionRecord != NULL && info->ExceptionRecord->ExceptionCode == EXCEPTION_SET_THREAD_NAME && - info->ExceptionRecord->NumberParameters * + info->ExceptionRecord->NumberParameters * sizeof (ULONG_PTR) == sizeof (THREADNAME_INFO)) { THREADNAME_INFO name_info; @@ -644,7 +644,11 @@ utf8_copy_sized (char *dest, if (size == 0) return; +#ifndef _UCRT strncpy (dest, src, size); +#else + strncpy_s (dest, sizeof (dest), src, size); +#endif if (dest[size - 1] != 0) { diff --git a/libgimpthumb/gimpthumb-utils.c b/libgimpthumb/gimpthumb-utils.c index 4a391031a2..dc6857bc23 100644 --- a/libgimpthumb/gimpthumb-utils.c +++ b/libgimpthumb/gimpthumb-utils.c @@ -864,7 +864,11 @@ gimp_thumb_png_name (const gchar *uri) name[i * 2 + 1] = (n > 9) ? 'a' + n - 10 : '0' + n; } +#ifndef _UCRT strncpy (name + 32, ".png", 5); +#else + strncpy_s (name + 32, 8, ".png", 5); +#endif return (const gchar *) name; } diff --git a/libgimpwidgets/gimpeevl.c b/libgimpwidgets/gimpeevl.c index a643bc097e..e6ddb1ddc6 100644 --- a/libgimpwidgets/gimpeevl.c +++ b/libgimpwidgets/gimpeevl.c @@ -454,7 +454,12 @@ gimp_eevl_quantity (GimpEevl *eva) identifier = g_newa (gchar, consumed_token.value.size + 1); +#ifndef _UCRT 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'; if (eva->options.unit_resolver_proc (identifier, diff --git a/plug-ins/common/file-jp2.c b/plug-ins/common/file-jp2.c index fed4d50d41..b0d39a91df 100644 --- a/plug-ins/common/file-jp2.c +++ b/plug-ins/common/file-jp2.c @@ -1925,7 +1925,12 @@ export_image (GFile *file, if (save_comment && comment && strlen (comment)) { parameters.cp_comment = g_malloc0 (strlen (comment) + 1); +#ifndef _UCRT strncpy (parameters.cp_comment, comment, strlen (comment)); +#else + strncpy_s (parameters.cp_comment, sizeof (parameters.cp_comment), + comment, strlen (comment)); +#endif } if (! cmyk) diff --git a/plug-ins/file-icns/file-icns-load.c b/plug-ins/file-icns/file-icns-load.c index e1bf3c29ef..f1709e1074 100644 --- a/plug-ins/file-icns/file-icns-load.c +++ b/plug-ins/file-icns/file-icns-load.c @@ -83,14 +83,22 @@ resource_load (FILE *file) gchar type[5]; guint32 size; +#ifndef _UCRT strncpy (type, header.type, 4); +#else + strncpy_s (type, 5, header.type, 4); +#endif type[4] = '\0'; size = GUINT32_FROM_BE (header.size); if (! strncmp (header.type, "icns", 4) && size > sizeof (IcnsResourceHeader)) { res = (IcnsResource *) g_new (guchar, sizeof (IcnsResource) + size); +#ifndef _UCRT strncpy (res->type, header.type, 4); +#else + strncpy_s (res->type, 5, header.type, 4); +#endif res->type[4] = '\0'; res->size = size; res->cursor = sizeof (IcnsResourceHeader); @@ -144,7 +152,11 @@ resource_get_next (IcnsResource *icns, return FALSE; header = (IcnsResourceHeader *) &(icns->data[icns->cursor]); +#ifndef _UCRT strncpy (res->type, header->type, 4); +#else + strncpy_s (res->type, 5, header->type, 4); +#endif res->size = GUINT32_FROM_BE (header->size); res->cursor = sizeof (IcnsResourceHeader); res->data = &(icns->data[icns->cursor]); @@ -455,7 +467,11 @@ icns_attach_image (GimpImage *image, guint expected_size; gboolean layer_loaded = FALSE; +#ifndef _UCRT strncpy (layer_name, icontype->type, 4); +#else + strncpy_s (layer_name, 5, icontype->type, 4); +#endif layer_name[4] = '\0'; row = 4 * icontype->width; @@ -481,7 +497,11 @@ icns_attach_image (GimpImage *image, gchar *temp_file_type = NULL; gchar *procedure_name = NULL; +#ifndef _UCRT strncpy (image_type, (gchar *) icns->data + 8, 4); +#else + strncpy_s (image_type, 5, (gchar *) icns->data + 8, 4); +#endif image_type[4] = '\0'; /* PNG */