diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-13 23:44:31 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-13 23:44:31 +0200 |
commit | 16c355664bf27e5ec4be5e58bd83d9d1a4752a20 (patch) | |
tree | 3c53ebdcf7c2fea5705a117575c1a015b04e1272 /c/util.h | |
parent | 20db24893b3b2a816bf82954ae9bdef243278b4d (diff) | |
download | EpisodeBrowser-16c355664bf27e5ec4be5e58bd83d9d1a4752a20.tar.gz |
Strcpy: Use memcpy instead of strcpy_s.
Diffstat (limited to 'c/util.h')
-rw-r--r-- | c/util.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,6 +1,8 @@ #ifndef UTIL_H #define UTIL_H +#include <algorithm> +#include <cstring> #include <memory> /* Format static wide string. */ @@ -12,9 +14,11 @@ inline int Swprintf(wchar_t (&buf)[N], const wchar_t* const fmt, T... xs) /* Copy to static narrow string buffer. */ template <size_t N> -inline int Strcpy(char (&dst)[N], const char* const src) +inline char* Strcpy(char (&dst)[N], const char* const src) { - return strcpy_s(dst, N, src); + memcpy(dst, src, std::min(N, strlen(src))); + dst[N-1] = 0; + return dst; } inline int Cmp(const int a, const int b) |