From b78f7e884e18cf519c8a2444c82d56d6ade959c2 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Wed, 26 Nov 2003 00:58:21 +0000 Subject: [PATCH] The need arose --- stepmania/src/archutils/Darwin/wchar.cpp | 59 ++++++++++++++++++------ 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/stepmania/src/archutils/Darwin/wchar.cpp b/stepmania/src/archutils/Darwin/wchar.cpp index 18571e4d8c..52bf791d3a 100644 --- a/stepmania/src/archutils/Darwin/wchar.cpp +++ b/stepmania/src/archutils/Darwin/wchar.cpp @@ -7,40 +7,69 @@ * */ -/* - * Since I cannot use the header beacuse Apple decided to be really - * stupid when it released the old SDKs, I'm going to write really bad - * implementations for a few functions since they are not actually used - * anywhere in StepMania (I hope). If the need arises, I can write real - * real functions for these. - */ - #define _BSD_WCHAR_T_DEFINED_ #include +#include +#include + -#define CRASH(x) *(char*)0=0; return x extern "C" { #ifndef wcslen -size_t wcslen(const wchar_t *w) { CRASH(0); } +size_t wcslen(const wchar_t *ws) +{ + size_t n = 0; + + while (*(ws++) != NULL) + ++n; + return n; +} #endif #ifndef wmemchr -wchar_t *wmemchr(const wchar_t *w1, wchar_t w2, size_t s) { CRASH(NULL); } +wchar_t *wmemchr(const wchar_t *ws, wchar_t wc, size_t n) +{ + for (unsigned i=0; i, std::allocator >; +#endif