mirror of https://github.com/encounter/SDL.git
hidapi, windows: replace a strncpy() with plain memcpy()
mainstream has a similar change, already.
This commit is contained in:
parent
5fc901d4f3
commit
09465a9083
|
@ -53,7 +53,6 @@ typedef LONG NTSTATUS;
|
||||||
#define memset SDL_memset
|
#define memset SDL_memset
|
||||||
#define strcmp SDL_strcmp
|
#define strcmp SDL_strcmp
|
||||||
#define strlen SDL_strlen
|
#define strlen SDL_strlen
|
||||||
#define strncpy SDL_strlcpy
|
|
||||||
#define strstr SDL_strstr
|
#define strstr SDL_strstr
|
||||||
#define strtol SDL_strtol
|
#define strtol SDL_strtol
|
||||||
#define wcscmp SDL_wcscmp
|
#define wcscmp SDL_wcscmp
|
||||||
|
@ -105,9 +104,6 @@ extern "C" {
|
||||||
#define MIN(x,y) ((x) < (y)? (x): (y))
|
#define MIN(x,y) ((x) < (y)? (x): (y))
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
/* Thanks Microsoft, but I know how to use strncpy(). */
|
|
||||||
#pragma warning(disable:4996)
|
|
||||||
|
|
||||||
/* Yes, we have some unreferenced formal parameters */
|
/* Yes, we have some unreferenced formal parameters */
|
||||||
#pragma warning(disable:4100)
|
#pragma warning(disable:4100)
|
||||||
#endif
|
#endif
|
||||||
|
@ -550,8 +546,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||||
if (str) {
|
if (str) {
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
cur_dev->path = (char*) calloc(len+1, sizeof(char));
|
cur_dev->path = (char*) calloc(len+1, sizeof(char));
|
||||||
strncpy(cur_dev->path, str, len+1);
|
memcpy(cur_dev->path, str, len+1);
|
||||||
cur_dev->path[len] = '\0';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cur_dev->path = NULL;
|
cur_dev->path = NULL;
|
||||||
|
|
Loading…
Reference in New Issue