app, libgimp*, plug-ins: Use strtok_s on Windows to fix CRT_INSECURE_DEPRECATE
This commit is contained in:
parent
b5ca37f192
commit
d254c5684c
8 changed files with 164 additions and 6 deletions
|
|
@ -198,8 +198,15 @@ gimp_palette_load (GimpContext *context,
|
|||
{
|
||||
GeglColor *color = gegl_color_new ("black");
|
||||
guint8 rgb[3] = { 0 };
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef _UCRT
|
||||
tok = strtok (str, " \t");
|
||||
#else
|
||||
tok = strtok_s (str, " \t", &context);
|
||||
#endif
|
||||
if (tok)
|
||||
{
|
||||
if (atoi (tok) < 0 || atoi (tok) > 255)
|
||||
|
|
@ -216,7 +223,12 @@ gimp_palette_load (GimpContext *context,
|
|||
gimp_file_get_utf8_name (file), linenum);
|
||||
}
|
||||
|
||||
#ifndef _UCRT
|
||||
tok = strtok (NULL, " \t");
|
||||
#else
|
||||
tok = strtok_s (NULL, " \t", &context);
|
||||
#endif
|
||||
|
||||
if (tok)
|
||||
{
|
||||
if (atoi (tok) < 0 || atoi (tok) > 255)
|
||||
|
|
@ -233,7 +245,11 @@ gimp_palette_load (GimpContext *context,
|
|||
gimp_file_get_utf8_name (file), linenum);
|
||||
}
|
||||
|
||||
#ifndef _UCRT
|
||||
tok = strtok (NULL, " \t");
|
||||
#else
|
||||
tok = strtok_s (NULL, " \t", &context);
|
||||
#endif
|
||||
if (tok)
|
||||
{
|
||||
if (atoi (tok) < 0 || atoi (tok) > 255)
|
||||
|
|
@ -251,7 +267,11 @@ gimp_palette_load (GimpContext *context,
|
|||
}
|
||||
|
||||
/* optional name */
|
||||
#ifndef _UCRT
|
||||
tok = strtok (NULL, "\n");
|
||||
#else
|
||||
tok = strtok_s (NULL, "\n", &context);
|
||||
#endif
|
||||
|
||||
/* Historical .gpl format is sRGB. */
|
||||
gegl_color_set_pixel (color, babl_format ("R'G'B' u8"), rgb);
|
||||
|
|
|
|||
|
|
@ -1220,22 +1220,41 @@ parse_svg_viewbox (const gchar *value,
|
|||
gchar *tok;
|
||||
gchar *str = g_strdup (value);
|
||||
gboolean success = FALSE;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
x = y = w = h = 0;
|
||||
|
||||
#ifndef _UCRT
|
||||
tok = strtok (str, ", \t");
|
||||
#else
|
||||
tok = strtok_s (str, ", \t", &context);
|
||||
#endif
|
||||
if (tok)
|
||||
{
|
||||
x = g_ascii_strtod (tok, NULL);
|
||||
#ifndef _UCRT
|
||||
tok = strtok (NULL, ", \t");
|
||||
#else
|
||||
tok = strtok_s (NULL, ", \t", &context);
|
||||
#endif
|
||||
if (tok)
|
||||
{
|
||||
y = g_ascii_strtod (tok, NULL);
|
||||
#ifndef _UCRT
|
||||
tok = strtok (NULL, ", \t");
|
||||
#else
|
||||
tok = strtok_s (NULL, ", \t", &context);
|
||||
#endif
|
||||
if (tok != NULL)
|
||||
{
|
||||
w = g_ascii_strtod (tok, NULL);
|
||||
#ifndef _UCRT
|
||||
tok = strtok (NULL, ", \t");
|
||||
#else
|
||||
tok = strtok_s (NULL, ", \t", &context);
|
||||
#endif
|
||||
if (tok)
|
||||
{
|
||||
h = g_ascii_strtod (tok, NULL);
|
||||
|
|
|
|||
|
|
@ -1117,17 +1117,28 @@ extensions_parse (gchar *extensions)
|
|||
{
|
||||
gchar *extension;
|
||||
gchar *next_token;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
/* work on a copy */
|
||||
extensions = g_strdup (extensions);
|
||||
|
||||
next_token = extensions;
|
||||
#ifndef _UCRT
|
||||
extension = strtok (next_token, " \t,");
|
||||
#else
|
||||
extension = strtok_s (next_token, " \t,", &context);
|
||||
#endif
|
||||
|
||||
while (extension)
|
||||
{
|
||||
list = g_slist_prepend (list, g_strdup (extension));
|
||||
#ifndef _UCRT
|
||||
extension = strtok (NULL, " \t,");
|
||||
#else
|
||||
extension = strtok_s (NULL, " \t,", &context);
|
||||
#endif
|
||||
}
|
||||
|
||||
g_free (extensions);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ gimp_pixpipe_params_parse (const gchar *parameters,
|
|||
gchar *copy;
|
||||
gchar *p, *q, *r;
|
||||
gint i;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
g_return_if_fail (parameters != NULL);
|
||||
g_return_if_fail (params != NULL);
|
||||
|
|
@ -108,7 +111,11 @@ gimp_pixpipe_params_parse (const gchar *parameters,
|
|||
copy = g_strdup (parameters);
|
||||
|
||||
q = copy;
|
||||
#ifndef _UCRT
|
||||
while ((p = strtok (q, " \r\n")) != NULL)
|
||||
#else
|
||||
while ((p = strtok_s (q, " \r\n", &context)) != NULL)
|
||||
#endif
|
||||
{
|
||||
q = NULL;
|
||||
r = strchr (p, ':');
|
||||
|
|
|
|||
|
|
@ -1692,28 +1692,57 @@ yyreduce:
|
|||
/* Line 1787 of yacc.c */
|
||||
#line 200 "imap_csim.y"
|
||||
{
|
||||
char *p;
|
||||
char *p;
|
||||
gchar *context = NULL;
|
||||
if (current_type == RECTANGLE) {
|
||||
Rectangle_t *rectangle;
|
||||
|
||||
rectangle = ObjectToRectangle(current_object);
|
||||
#ifndef _UCRT
|
||||
p = strtok((yyvsp[(3) - (3)].id), ",");
|
||||
#else
|
||||
p = strtok_s((yyvsp[(3) - (3)].id), ",", &context);
|
||||
#endif
|
||||
rectangle->x = atoi(p);
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
rectangle->y = atoi(p);
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
rectangle->width = atoi(p) - rectangle->x;
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
rectangle->height = atoi(p) - rectangle->y;
|
||||
} else if (current_type == CIRCLE) {
|
||||
Circle_t *circle;
|
||||
|
||||
circle = ObjectToCircle(current_object);
|
||||
#ifndef _UCRT
|
||||
p = strtok((yyvsp[(3) - (3)].id), ",");
|
||||
#else
|
||||
p = strtok_s((yyvsp[(3) - (3)].id), ",", &context);
|
||||
#endif
|
||||
circle->x = atoi(p);
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
circle->y = atoi(p);
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
circle->r = atoi(p);
|
||||
} else if (current_type == POLYGON) {
|
||||
Polygon_t *polygon = ObjectToPolygon(current_object);
|
||||
|
|
@ -1721,19 +1750,35 @@ yyreduce:
|
|||
GdkPoint *point, *first;
|
||||
gint x, y;
|
||||
|
||||
#ifndef _UCRT
|
||||
p = strtok((yyvsp[(3) - (3)].id), ",");
|
||||
#else
|
||||
p = strtok_s((yyvsp[(3) - (3)].id), ",", &context);
|
||||
#endif
|
||||
x = atoi(p);
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
y = atoi(p);
|
||||
point = new_point(x, y);
|
||||
points = g_list_append(NULL, (gpointer) point);
|
||||
|
||||
while(1) {
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
if (!p)
|
||||
break;
|
||||
x = atoi(p);
|
||||
#ifndef _UCRT
|
||||
p = strtok(NULL, ",");
|
||||
#else
|
||||
p = strtok_s(NULL, ",", &context);
|
||||
#endif
|
||||
y = atoi(p);
|
||||
point = new_point(x, y);
|
||||
points = g_list_append(points, (gpointer) point);
|
||||
|
|
|
|||
|
|
@ -923,6 +923,9 @@ save_as_cern(gpointer param, OutputFunc_t output)
|
|||
char *p;
|
||||
gchar *description;
|
||||
gchar *next_token;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
write_cern_comment(param, output);
|
||||
output(param, "-:Image map file created by GIMP Image Map plug-in\n");
|
||||
|
|
@ -941,10 +944,15 @@ save_as_cern(gpointer param, OutputFunc_t output)
|
|||
|
||||
description = g_strdup(_map_info.description);
|
||||
next_token = description;
|
||||
for (p = strtok (next_token, "\n"); p; p = strtok(NULL, "\n")) {
|
||||
write_cern_comment(param, output);
|
||||
output(param, "DESCRIPTION:%s\n", p);
|
||||
}
|
||||
#ifndef _UCRT
|
||||
for (p = strtok (next_token, "\n"); p; p = strtok(NULL, "\n"))
|
||||
#else
|
||||
for (p = strtok_s (next_token, "\n", &context); p; p = strtok_s(NULL, "\n", &context))
|
||||
#endif
|
||||
{
|
||||
write_cern_comment(param, output);
|
||||
output(param, "DESCRIPTION:%s\n", p);
|
||||
}
|
||||
g_free(description);
|
||||
|
||||
if (*_map_info.default_url)
|
||||
|
|
@ -957,6 +965,9 @@ save_as_csim(gpointer param, OutputFunc_t output)
|
|||
{
|
||||
char *p;
|
||||
gchar *description;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
output(param, "<img src=\"%s\" width=\"%d\" height=\"%d\" border=\"0\" "
|
||||
"usemap=\"#%s\" />\n\n", _map_info.image_name,
|
||||
|
|
@ -971,7 +982,11 @@ save_as_csim(gpointer param, OutputFunc_t output)
|
|||
output(param, "<!-- #$AUTHOR:%s -->\n", _map_info.author);
|
||||
|
||||
description = g_strdup(_map_info.description);
|
||||
#ifndef _UCRT
|
||||
for (p = strtok(description, "\n"); p; p = strtok(NULL, "\n"))
|
||||
#else
|
||||
for (p = strtok_s(description, "\n", &context); p; p = strtok_s(NULL, "\n", &context))
|
||||
#endif
|
||||
output(param, "<!-- #$DESCRIPTION:%s -->\n", p);
|
||||
g_free(description);
|
||||
|
||||
|
|
@ -987,6 +1002,7 @@ save_as_ncsa(gpointer param, OutputFunc_t output)
|
|||
{
|
||||
char *p;
|
||||
gchar *description;
|
||||
gchar *context = NULL;
|
||||
|
||||
output(param, "#$-:Image map file created by GIMP Image Map plug-in\n");
|
||||
output(param, "#$-:GIMP Image Map plug-in by Maurits Rijk\n");
|
||||
|
|
@ -997,7 +1013,11 @@ save_as_ncsa(gpointer param, OutputFunc_t output)
|
|||
output(param, "#$FORMAT:ncsa\n");
|
||||
|
||||
description = g_strdup(_map_info.description);
|
||||
#ifndef _UCRT
|
||||
for (p = strtok(description, "\n"); p; p = strtok(NULL, "\n"))
|
||||
#else
|
||||
for (p = strtok_s(description, "\n", &context); p; p = strtok_s(NULL, "\n", &context))
|
||||
#endif
|
||||
output(param, "#$DESCRIPTION:%s\n", p);
|
||||
g_free(description);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,12 @@ static void get_button_colors (PreferencesDialog_t *dialog,
|
|||
static gint
|
||||
parse_map_type(void)
|
||||
{
|
||||
#ifndef _UCRT
|
||||
char *token = strtok(NULL, " )");
|
||||
#else
|
||||
gchar *context = NULL;
|
||||
char *token = strtok_s(NULL, " )", &context);
|
||||
#endif
|
||||
if (!strcmp(token, "ncsa"))
|
||||
return NCSA;
|
||||
else if (!strcmp(token, "cern"))
|
||||
|
|
@ -87,14 +92,24 @@ parse_map_type(void)
|
|||
static gint
|
||||
parse_yes_no(void)
|
||||
{
|
||||
#ifndef _UCRT
|
||||
char *token = strtok(NULL, " )");
|
||||
#else
|
||||
gchar *context = NULL;
|
||||
char *token = strtok_s(NULL, " )", &context);
|
||||
#endif
|
||||
return (gint) strcmp(token, "no");
|
||||
}
|
||||
|
||||
static gint
|
||||
parse_int(void)
|
||||
{
|
||||
#ifndef _UCRT
|
||||
char *token = strtok(NULL, " )");
|
||||
#else
|
||||
gchar *context = NULL;
|
||||
char *token = strtok_s(NULL, " )", &context);
|
||||
#endif
|
||||
return (gint) atoi(token);
|
||||
}
|
||||
|
||||
|
|
@ -110,18 +125,30 @@ parse_color(GdkRGBA *color)
|
|||
static void
|
||||
parse_mru_entry(void)
|
||||
{
|
||||
#ifndef _UCRT
|
||||
char *filename = strtok(NULL, " )");
|
||||
#else
|
||||
gchar *context = NULL;
|
||||
char *filename = strtok_s(NULL, " )", &context);
|
||||
#endif
|
||||
mru_add(get_mru(), filename);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_line(PreferencesData_t *data, char *line)
|
||||
{
|
||||
char *token;
|
||||
char *token;
|
||||
ColorSelData_t *colors = &data->colors;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
line++; /* Skip '(' */
|
||||
#ifndef _UCRT
|
||||
token = strtok(line, " ");
|
||||
#else
|
||||
token = strtok_s(line, " ", &context);
|
||||
#endif
|
||||
|
||||
if (!strcmp(token, "default-map-type")) {
|
||||
data->default_map_type = parse_map_type();
|
||||
|
|
|
|||
|
|
@ -4879,14 +4879,23 @@ set_gps_longitude_latitude (GimpMetadata *metadata,
|
|||
gint degrees, minutes;
|
||||
gdouble seconds;
|
||||
gboolean remove_val = FALSE;
|
||||
#ifdef _UCRT
|
||||
gchar *context = NULL;
|
||||
#endif
|
||||
|
||||
g_log (ME_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "set_gps_longitude_latitude - Tag %s, Input value: %s", tag, value);
|
||||
|
||||
if (s && s[0] != '\0')
|
||||
{
|
||||
#ifndef _UCRT
|
||||
str1 = strtok (s, delimiters_dms);
|
||||
str2 = strtok (NULL, delimiters_dms);
|
||||
str3 = strtok (NULL, delimiters_dms);
|
||||
#else
|
||||
str1 = strtok_s (s, delimiters_dms, &context);
|
||||
str2 = strtok_s (NULL, delimiters_dms, &context);
|
||||
str3 = strtok_s (NULL, delimiters_dms, &context);
|
||||
#endif
|
||||
|
||||
g_log (ME_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "String split into: %s - %s - %s", str1, str2, str3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue