Port lstring and sclist to C++.
This commit is contained in:
parent
2ba4fb180e
commit
3e8157c6bc
@ -79,7 +79,7 @@ elif builder.target_platform == 'mac':
|
|||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
'libpawnc.cpp',
|
'libpawnc.cpp',
|
||||||
'lstring.c',
|
'lstring.cpp',
|
||||||
'memfile.cpp',
|
'memfile.cpp',
|
||||||
'pawncc.cpp',
|
'pawncc.cpp',
|
||||||
'sc1.c',
|
'sc1.c',
|
||||||
@ -91,7 +91,7 @@ binary.sources += [
|
|||||||
'sc7.c',
|
'sc7.c',
|
||||||
'scexpand.c',
|
'scexpand.c',
|
||||||
'sci18n.c',
|
'sci18n.c',
|
||||||
'sclist.c',
|
'sclist.cpp',
|
||||||
'scmemfil.cpp',
|
'scmemfil.cpp',
|
||||||
'scstate.cpp',
|
'scstate.cpp',
|
||||||
'sctracker.c',
|
'sctracker.c',
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* will be copied. Always NUL terminates (unless siz == 0).
|
* will be copied. Always NUL terminates (unless siz == 0).
|
||||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||||
*/
|
*/
|
||||||
size_t
|
extern "C" size_t
|
||||||
strlcpy(char *dst, const char *src, size_t siz)
|
strlcpy(char *dst, const char *src, size_t siz)
|
||||||
{
|
{
|
||||||
char *d = dst;
|
char *d = dst;
|
||||||
@ -93,7 +93,7 @@ strlcpy(char *dst, const char *src, size_t siz)
|
|||||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||||
* If retval >= siz, truncation occurred.
|
* If retval >= siz, truncation occurred.
|
||||||
*/
|
*/
|
||||||
size_t
|
extern "C" size_t
|
||||||
strlcat(char *dst, const char *src, size_t siz)
|
strlcat(char *dst, const char *src, size_t siz)
|
||||||
{
|
{
|
||||||
char *d = dst;
|
char *d = dst;
|
@ -9,10 +9,18 @@
|
|||||||
|
|
||||||
#if !defined HAVE_SAFESTR
|
#if !defined HAVE_SAFESTR
|
||||||
|
|
||||||
size_t
|
#if defined(__cplusplus)
|
||||||
|
# define EXPORT extern "C"
|
||||||
|
#else
|
||||||
|
# define EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EXPORT size_t
|
||||||
strlcpy(char *dst, const char *src, size_t siz);
|
strlcpy(char *dst, const char *src, size_t siz);
|
||||||
|
|
||||||
size_t
|
EXPORT size_t
|
||||||
strlcat(char *dst, const char *src, size_t siz);
|
strlcat(char *dst, const char *src, size_t siz);
|
||||||
|
|
||||||
|
#undef EXPORT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -319,12 +319,13 @@ SC_FUNC stringpair *find_subst(char *name,int length)
|
|||||||
if (item && (item->flags & flgDEPRECATED) != 0)
|
if (item && (item->flags & flgDEPRECATED) != 0)
|
||||||
{
|
{
|
||||||
static char macro[128];
|
static char macro[128];
|
||||||
char *rem, *msg = (item->documentation != NULL) ? item->documentation : "";
|
const char *msg = (item->documentation != NULL) ? item->documentation : "";
|
||||||
strlcpy(macro, item->first, sizeof(macro));
|
strlcpy(macro, item->first, sizeof(macro));
|
||||||
|
|
||||||
/* If macro contains an opening parentheses and a percent sign, then assume that
|
/* If macro contains an opening parentheses and a percent sign, then assume that
|
||||||
* it takes arguments and remove them from the warning message.
|
* it takes arguments and remove them from the warning message.
|
||||||
*/
|
*/
|
||||||
|
char *rem;
|
||||||
if ((rem = strchr(macro, '(')) != NULL && strchr(macro, '%') > rem)
|
if ((rem = strchr(macro, '(')) != NULL && strchr(macro, '%') > rem)
|
||||||
{
|
{
|
||||||
*rem = '\0';
|
*rem = '\0';
|
Loading…
Reference in New Issue
Block a user