apple/Throw: add missing <cstring> header
strlen() and strcpy() are provided by the <string.h> and <cstring> headers (as functions in global and std namespaces, respectively). Compilers MAY provide an implementation for either of the functions without including the extra header but the existence of a declaration without the header is not assured.
This commit is contained in:
parent
106ad08cd2
commit
c6f7f57776
@ -31,6 +31,7 @@
|
|||||||
#include "ErrorRef.hxx"
|
#include "ErrorRef.hxx"
|
||||||
#include "StringRef.hxx"
|
#include "StringRef.hxx"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace Apple {
|
namespace Apple {
|
||||||
@ -57,8 +58,8 @@ ThrowOSStatus(OSStatus status, const char *_msg)
|
|||||||
const Apple::StringRef cfstr(cferr.CopyDescription());
|
const Apple::StringRef cfstr(cferr.CopyDescription());
|
||||||
|
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
strcpy(msg, _msg);
|
std::strcpy(msg, _msg);
|
||||||
size_t length = strlen(msg);
|
size_t length = std::strlen(msg);
|
||||||
|
|
||||||
cfstr.GetCString(msg + length, sizeof(msg) - length);
|
cfstr.GetCString(msg + length, sizeof(msg) - length);
|
||||||
throw std::runtime_error(msg);
|
throw std::runtime_error(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user