Skip to content

Commit

Permalink
MAP: change strncpy to use macro MAP_STRNCPY
Browse files Browse the repository at this point in the history
Similar to how macro MAP_STRCPY works, MAP_STRNCPY points to either strncpy or strncpy_s depending on compiler used
  • Loading branch information
andrew-platt committed Sep 13, 2024
1 parent e8d0ea9 commit 4e69da8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/map/src/mapapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ MAP_EXTERNCALL void map_set_gravity(MAP_ParameterType_t* p_type, const double gr

MAP_EXTERNCALL void map_set_input_text(MAP_InitInputType_t* init_type, const char* input_txt_line)
{
strncpy(init_type->library_input_str, input_txt_line, 254);
MAP_STRNCPY(init_type->library_input_str, input_txt_line, 254);
init_type->library_input_str[254] = '\0';
}

Expand Down
2 changes: 2 additions & 0 deletions modules/map/src/mapsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@
# define map_snprintf _snprintf
# define map_strcat(a,b,c) strcat_s(a,b,c)
# define MAP_STRCPY(a,b,c) strcpy_s(a,b,c)
# define MAP_STRNCPY(a,b,c) strncpy_s(a,c,b,c)
#else
# include <stdbool.h>
# define map_snprintf snprintf
# define map_strcat(a,b,c) strncat(a,c,b)
# define MAP_STRCPY(a,b,c) strcpy(a,c)
# define MAP_STRNCPY(a,b,c) strncpy(a,b,c)
#endif


Expand Down

0 comments on commit 4e69da8

Please sign in to comment.