diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-04-11 11:31:17 -0700 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-04-13 02:16:20 +0000 |
commit | cf6501eb45408c83467160c8ed026c6aab347642 (patch) | |
tree | 84755bcc3bbdb9a1b7dcc69e171ab2f947f0ed0a /epan | |
parent | f6b8b4dca5c05f0e6011ca8d8ef670beb911ac39 (diff) |
Windows: Remove the need for _CRT_NONSTDC_NO_DEPRECATE.
Replace some function calls with their non-deprecated equivalents so
that we can remove _CRT_NONSTDC_NO_DEPRECATE from CMakeLists.txt and
config.nmake.
Leave _CRT_SECURE_NO_DEPRECATE in place. Removing it failed with 145
warnings and 72 errors.
Note that we could probably improve startup performance by using wmem
in diam_dict.*.
Change-Id: I6e130003de838aebedbdd1aa78c50de8a339ddcb
Reviewed-on: https://code.wireshark.org/review/14883
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/diam_dict.l | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 4 |
2 files changed, 18 insertions, 8 deletions
diff --git a/epan/diam_dict.l b/epan/diam_dict.l index 47aa11eb50..a82d81c5f2 100644 --- a/epan/diam_dict.l +++ b/epan/diam_dict.l @@ -94,6 +94,16 @@ #include <epan/to_str.h> #include <wsutil/file_util.h> +/* + * Deprecated CRT functions. We call malloc+free quite a bit here. We could + * probably improve startup performance by using wmem instead. + */ +#ifdef _WIN32 +#define ws_strdup _strdup +#else +#define ws_strdup strdup +#endif + typedef struct entity_t { char* name; char* file; @@ -284,10 +294,10 @@ description_attr description=\042 } <XMLPI_ATTRS>{xmlpi_key_attr} BEGIN XMLPI_GETKEY; -<XMLPI_GETKEY>{ndquot} { yyextra->xmlpi->key = strdup(yytext); BEGIN XMLPI_ATTRS; } +<XMLPI_GETKEY>{ndquot} { yyextra->xmlpi->key = ws_strdup(yytext); BEGIN XMLPI_ATTRS; } <XMLPI_ATTRS>{xmlpi_value_attr} BEGIN XMLPI_GETVAL; -<XMLPI_GETVAL>{ndquot} { yyextra->xmlpi->value = strdup(yytext); BEGIN XMLPI_ATTRS; } +<XMLPI_GETVAL>{ndquot} { yyextra->xmlpi->value = ws_strdup(yytext); BEGIN XMLPI_ATTRS; } <XMLPI_ATTRS>. <XMLPI_ATTRS>{xmlpi_end} BEGIN LOADING; @@ -296,14 +306,14 @@ description_attr description=\042 <LOADING>{start_entity} BEGIN ENTITY; <ENTITY>{entityname} { entity_t* e = g_new(entity_t,1); - e->name = strdup(yytext); + e->name = ws_strdup(yytext); e->next = yyextra->ents; yyextra->ents = e; BEGIN GET_SYSTEM; }; <GET_SYSTEM>{system} BEGIN GET_FILE; <GET_FILE>{ndquot} { - yyextra->ents->file = strdup(yytext); + yyextra->ents->file = ws_strdup(yytext); BEGIN END_ENTITY; } <END_ENTITY>{end_entity} BEGIN LOADING; @@ -384,7 +394,7 @@ description_attr description=\042 <GET_ATTR>{ndquot} { - *(yyextra->attr_str) = strdup(yytext); + *(yyextra->attr_str) = ws_strdup(yytext); D(("%s\n",yytext)); yyextra->attr_str = NULL; BEGIN END_ATTR; @@ -540,7 +550,7 @@ description_attr description=\042 <AVP_ATTRS>{stop_end} { BEGIN IN_APPL; } -<IN_AVP>{grouped_start} { yyextra->avp->type = strdup("Grouped"); }; +<IN_AVP>{grouped_start} { yyextra->avp->type = ws_strdup("Grouped"); }; <IN_AVP>{grouped_end} ; <IN_AVP>{type_start} { BEGIN TYPE_ATTRS; } diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index b534144eac..29df42fc27 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -3777,7 +3777,7 @@ ssl_load_key(FILE* fp) gint ret; guint bytes; - if (ws_fstat64(fileno(fp), &statbuf) == -1) { + if (ws_fstat64(ws_fileno(fp), &statbuf) == -1) { ssl_debug_printf("ssl_load_key: can't ws_fstat64 file\n"); return NULL; } @@ -4655,7 +4655,7 @@ file_needs_reopen(FILE *fp, const char *filename) /* consider a file deleted when stat fails for either file, * or when the residing device / inode has changed. */ - if (0 != ws_fstat64(fileno(fp), &open_stat)) + if (0 != ws_fstat64(ws_fileno(fp), &open_stat)) return TRUE; if (0 != ws_stat64(filename, ¤t_stat)) return TRUE; |