@@ -3062,7 +3062,11 @@ IMGUIFILEDIALOG_API IGFD_Selection IGFD_GetSelection(ImGuiFileDialog* vContext)
30623062 {
30633063 size_t siz = s.first .size () + 1U ;
30643064 pair->fileName = new char [siz];
3065- strncpy (pair->fileName , s.first .c_str (), siz); // no need to use strncpy_s for MSVC here
3065+ #ifndef MSVC
3066+ strncpy (pair->fileName , s.first .c_str (), siz);
3067+ #else
3068+ strncpy_s (pair->fileName , siz, s.first .c_str (), siz);
3069+ #endif
30663070 pair->fileName [siz - 1U ] = ' \0 ' ;
30673071 }
30683072
@@ -3071,7 +3075,11 @@ IMGUIFILEDIALOG_API IGFD_Selection IGFD_GetSelection(ImGuiFileDialog* vContext)
30713075 {
30723076 size_t siz = s.first .size () + 1U ;
30733077 pair->filePathName = new char [siz];
3074- strncpy (pair->filePathName , s.first .c_str (), siz); // no need to use strncpy_s for MSVC here
3078+ #ifndef MSVC
3079+ strncpy (pair->filePathName , s.first .c_str (), siz);
3080+ #else
3081+ strncpy_s (pair->filePathName , siz, s.first .c_str (), siz);
3082+ #endif
30753083 pair->filePathName [siz - 1U ] = ' \0 ' ;
30763084 }
30773085 }
@@ -3094,7 +3102,11 @@ IMGUIFILEDIALOG_API char* IGFD_GetFilePathName(ImGuiFileDialog* vContext)
30943102 {
30953103 size_t siz = s.size () + 1U ;
30963104 res = new char [siz];
3097- strncpy (res, s.c_str (), siz); // no need to use strncpy_s for MSVC here
3105+ #ifndef MSVC
3106+ strncpy (res, s.c_str (), siz);
3107+ #else
3108+ strncpy_s (res, siz, s.c_str (), siz);
3109+ #endif
30983110 res[siz - 1U ] = ' \0 ' ;
30993111 }
31003112 }
@@ -3113,7 +3125,11 @@ IMGUIFILEDIALOG_API char* IGFD_GetCurrentFileName(ImGuiFileDialog* vContext)
31133125 {
31143126 size_t siz = s.size () + 1U ;
31153127 res = new char [siz];
3116- strncpy (res, s.c_str (), siz); // no need to use strncpy_s for MSVC here
3128+ #ifndef MSVC
3129+ strncpy (res, s.c_str (), siz);
3130+ #else
3131+ strncpy_s (res, siz, s.c_str (), siz);
3132+ #endif
31173133 res[siz - 1U ] = ' \0 ' ;
31183134 }
31193135 }
@@ -3132,7 +3148,11 @@ IMGUIFILEDIALOG_API char* IGFD_GetCurrentPath(ImGuiFileDialog* vContext)
31323148 {
31333149 size_t siz = s.size () + 1U ;
31343150 res = new char [siz];
3135- strncpy (res, s.c_str (), siz); // no need to use strncpy_s for MSVC here
3151+ #ifndef MSVC
3152+ strncpy (res, s.c_str (), siz);
3153+ #else
3154+ strncpy_s (res, siz, s.c_str (), siz);
3155+ #endif
31363156 res[siz - 1U ] = ' \0 ' ;
31373157 }
31383158 }
@@ -3151,7 +3171,11 @@ IMGUIFILEDIALOG_API char* IGFD_GetCurrentFilter(ImGuiFileDialog* vContext)
31513171 {
31523172 size_t siz = s.size () + 1U ;
31533173 res = new char [siz];
3154- strncpy (res, s.c_str (), siz); // no need to use strncpy_s for MSVC here
3174+ #ifndef MSVC
3175+ strncpy (res, s.c_str (), siz);
3176+ #else
3177+ strncpy_s (res, siz, s.c_str (), siz);
3178+ #endif
31553179 res[siz - 1U ] = ' \0 ' ;
31563180 }
31573181 }
@@ -3198,7 +3222,11 @@ IMGUIFILEDIALOG_API bool IGFD_GetExtentionInfos(ImGuiFileDialog* vContext,
31983222 {
31993223 size_t siz = icon.size () + 1U ;
32003224 *vOutIcon = new char [siz];
3201- strncpy (*vOutIcon, icon.c_str (), siz); // no need to use strncpy_s for MSVC here
3225+ #ifndef MSVC
3226+ strncpy (*vOutIcon, icon.c_str (), siz);
3227+ #else
3228+ strncpy_s (*vOutIcon, siz, icon.c_str (), siz);
3229+ #endif
32023230 *vOutIcon[siz - 1U ] = ' \0 ' ;
32033231 }
32043232 return res;
@@ -3237,7 +3265,11 @@ IMGUIFILEDIALOG_API char* IGFD_SerializeBookmarks(ImGuiFileDialog* vContext)
32373265 {
32383266 size_t siz = s.size () + 1U ;
32393267 res = new char [siz];
3240- strncpy (res, s.c_str (), siz); // no need to use strncpy_s for MSVC here
3268+ #ifndef MSVC
3269+ strncpy (res, s.c_str (), siz);
3270+ #else
3271+ strncpy_s (res, siz, s.c_str (), siz);
3272+ #endif
32413273 res[siz - 1U ] = ' \0 ' ;
32423274 }
32433275 }
0 commit comments