regposerr.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* SUCH DAMAGE.
*/
+/* Can't include regint.h etc.. for conflict of regex_t.
+ Define ONIGURUMA_EXPORT here for onigposix.h.
+ */
+#ifndef ONIGURUMA_EXPORT
+#define ONIGURUMA_EXPORT
+#endif
+
#include "config.h"
#include "onigposix.h"
#if defined(_WIN32) && !defined(__GNUC__)
#define xsnprintf sprintf_s
+#define xstrncpy(dest,src,size) strncpy_s(dest,size,src,_TRUNCATE)
#else
#define xsnprintf snprintf
+#define xstrncpy strncpy
#endif
static char* ESTRING[] = {
len = strlen(s) + 1; /* use strlen() because s is ascii encoding. */
if (buf != NULL && size > 0) {
- strncpy(buf, s, size - 1);
+ xstrncpy(buf, s, size - 1);
buf[size - 1] = '\0';
}
return len;