summaryrefslogtreecommitdiff
path: root/includes/BString.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-18 23:41:54 -0800
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-18 23:41:54 -0800
commitaec952125146ef754b755f75bf9281d16e837155 (patch)
treef9632a7fc772044142a589ac6bd41584be830bb2 /includes/BString.h
parentb2f3f5217a0e9833479367bc3ebbb7926819b71b (diff)
Visual Studio port.
Diffstat (limited to 'includes/BString.h')
-rw-r--r--includes/BString.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/includes/BString.h b/includes/BString.h
index 0cfb8b8..9f68e9a 100644
--- a/includes/BString.h
+++ b/includes/BString.h
@@ -12,7 +12,14 @@
#include <string>
#include <vector>
-#ifdef _WIN32
+#ifdef _MSC_VER
+typedef size_t ssize_t;
+#define printfwarning(a, b)
+#else
+#define printfwarning(a, b) __attribute__((format(printf, a, b)))
+#endif
+
+#if defined(_WIN32) && !defined(_MSC_VER)
int vsscanf(const char *, const char *, va_list);
#endif
@@ -35,12 +42,12 @@ class String : private std::string {
String(const std::string & s) : std::string(s) { }
String(String && s) : std::string(s) { }
- String & set(const char * fmt, va_list) __attribute__((format(printf, 2, 0)));
- String & set(const char * fmt, ...) __attribute__((format(printf, 2, 3))) { va_list ap; va_start(ap, fmt); set(fmt, ap); va_end(ap); return *this; }
+ String & set(const char * fmt, va_list) printfwarning(2, 0);
+ String & set(const char * fmt, ...) printfwarning(2, 3) { va_list ap; va_start(ap, fmt); set(fmt, ap); va_end(ap); return *this; }
String & set(const String & fmt, ...) { va_list ap; va_start(ap, fmt); set(fmt.to_charp(), ap); va_end(ap); return *this; }
int scanf(const char * fmt, va_list ap) const { return ::vsscanf(c_str(), fmt, ap); }
- int scanf(const char * fmt, ...) const __attribute__((format(scanf, 2, 3))) { va_list ap; va_start(ap, fmt); int r = scanf(fmt, ap); va_end(ap); return r; }
+ int scanf(const char * fmt, ...) const printfwarning(2, 3) { va_list ap; va_start(ap, fmt); int r = scanf(fmt, ap); va_end(ap); return r; }
int scanf(const String & fmt, ...) const { va_list ap; va_start(ap, fmt); int r = scanf(fmt.to_charp(), ap); va_end(ap); return r; }
const char * to_charp(size_t begin = 0) const { return c_str() + begin; }