summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-10-28 15:47:42 +0000
committerrubidium <rubidium@openttd.org>2008-10-28 15:47:42 +0000
commitda0a0ef8ca740e9d23b71a1b02c4fc0c7512eaec (patch)
treeecc92b69757c100f41d819afca70a0bb9a5da65c
parent0d254e8914f294a8f9a0e177e2d0208e57b2d5c9 (diff)
downloadopenttd-da0a0ef8ca740e9d23b71a1b02c4fc0c7512eaec.tar.xz
(svn r14541) -Fix (r14540): mingw didn't like it :(
-rw-r--r--src/string.cpp35
-rw-r--r--src/string_func.h1
2 files changed, 17 insertions, 19 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 3925ba24c..d0b19f00b 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -14,6 +14,23 @@
#include <stdarg.h>
#include <ctype.h> // required for tolower()
+/**
+ * Safer implementation of vsnprintf; same as vsnprintf except:
+ * - last instead of size, i.e. replace sizeof with lastof.
+ * - return gives the amount of characters added, not what it would add.
+ * @param str buffer to write to up to last
+ * @param last last character we may write to
+ * @param format the formatting (see snprintf)
+ * @param ap the list of arguments for the format
+ * @return the number of added characters
+ */
+static int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap)
+{
+ if (str >= last) return 0;
+ size_t size = last - str;
+ return min((int)size, vsnprintf(str, size, format, ap));
+}
+
void ttd_strlcat(char *dst, const char *src, size_t size)
{
assert(size > 0);
@@ -204,24 +221,6 @@ int CDECL seprintf(char *str, const char *last, const char *format, ...)
return ret;
}
-/**
- * Safer implementation of vsnprintf; same as vsnprintf except:
- * - last instead of size, i.e. replace sizeof with lastof.
- * - return gives the amount of characters added, not what it would add.
- * @param str buffer to write to up to last
- * @param last last character we may write to
- * @param format the formatting (see snprintf)
- * @param ap the list of arguments for the format
- * @return the number of added characters
- */
-int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap)
-{
- if (str >= last) return 0;
- size_t size = last - str;
- return min((int)size, vsnprintf(str, size, format, ap));
-}
-
-
/** Convert the md5sum to a hexadecimal string representation
* @param buf buffer to put the md5sum into
diff --git a/src/string_func.h b/src/string_func.h
index c6d71b56d..6c8ce4a5a 100644
--- a/src/string_func.h
+++ b/src/string_func.h
@@ -42,7 +42,6 @@ char *strecat(char *dst, const char *src, const char *last);
char *strecpy(char *dst, const char *src, const char *last);
int CDECL seprintf(char *str, const char *last, const char *format, ...);
-int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap);
char *CDECL str_fmt(const char *str, ...);