Cleanup spacing, fix check HAVE_WCSLEN, and use __BEGIN_DECL and __END_DECL to keep Xcode from wanting to indent all of the functions another level.
This commit is contained in:
@@ -1,69 +1,69 @@
|
|||||||
#include <bits/c++config.h>
|
#include <bits/c++config.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
// This is very annoying. The 10.2.8 SDK uses GLIBCPP but the 10.4u SDK uses GLIBCXX
|
// This is very annoying. The 10.2.8 SDK uses GLIBCPP but the 10.4u SDK uses GLIBCXX
|
||||||
#define _GLIB_CHECK(x) (_GLIBCPP_ ## x || _GLIBCXX_ ## x)
|
#define _GLIB_CHECK(x) (_GLIBCPP_ ## x || _GLIBCXX_ ## x)
|
||||||
|
|
||||||
extern "C"
|
__BEGIN_DECLS
|
||||||
{
|
#if ! _GLIB_CHECK(HAVE_WCSLEN)
|
||||||
#if ! _GLIB_CHECK(HAVE_WCLEN)
|
|
||||||
size_t wcslen( const wchar_t *ws )
|
size_t wcslen( const wchar_t *ws )
|
||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
|
||||||
while( *(ws++) != L'\0' )
|
while( *(ws++) != L'\0' )
|
||||||
++n;
|
++n;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! _GLIB_CHECK(HAVE_WMEMCHR)
|
#if ! _GLIB_CHECK(HAVE_WMEMCHR)
|
||||||
wchar_t *wmemchr( const wchar_t *ws, wchar_t wc, size_t n )
|
wchar_t *wmemchr( const wchar_t *ws, wchar_t wc, size_t n )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<n; ++i, ++ws )
|
for( unsigned i=0; i<n; ++i, ++ws )
|
||||||
if( *ws == wc )
|
if( *ws == wc )
|
||||||
return (wchar_t *)ws;
|
return (wchar_t *)ws;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! _GLIB_CHECK(HAVE_WMEMCMP)
|
#if ! _GLIB_CHECK(HAVE_WMEMCMP)
|
||||||
int wmemcmp( const wchar_t *ws1, const wchar_t *ws2, size_t n )
|
int wmemcmp( const wchar_t *ws1, const wchar_t *ws2, size_t n )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<n; ++i, ++ws1, ++ws2 )
|
for( unsigned i=0; i<n; ++i, ++ws1, ++ws2 )
|
||||||
if( *ws1 != *ws2 )
|
if( *ws1 != *ws2 )
|
||||||
return *ws1 - *ws2;
|
return *ws1 - *ws2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! _GLIB_CHECK(HAVE_WMEMCPY)
|
#if ! _GLIB_CHECK(HAVE_WMEMCPY)
|
||||||
wchar_t *wmemcpy( wchar_t *ws1, const wchar_t *ws2, size_t n )
|
wchar_t *wmemcpy( wchar_t *ws1, const wchar_t *ws2, size_t n )
|
||||||
{
|
{
|
||||||
return (wchar_t *)memcpy( ws1, ws2, n * sizeof(wchar_t) );
|
return (wchar_t *)memcpy( ws1, ws2, n * sizeof(wchar_t) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! _GLIB_CHECK(HAVE_WMEMMOVE)
|
#if ! _GLIB_CHECK(HAVE_WMEMMOVE)
|
||||||
wchar_t *wmemmove( wchar_t *ws1, const wchar_t *ws2, size_t n )
|
wchar_t *wmemmove( wchar_t *ws1, const wchar_t *ws2, size_t n )
|
||||||
{
|
{
|
||||||
return (wchar_t *)memmove( ws1, ws2, n * sizeof(wchar_t) );
|
return (wchar_t *)memmove( ws1, ws2, n * sizeof(wchar_t) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! _GLIB_CHECK(HAVE_WMEMSET)
|
#if ! _GLIB_CHECK(HAVE_WMEMSET)
|
||||||
wchar_t *wmemset( wchar_t *ws , wchar_t wc, size_t n )
|
wchar_t *wmemset( wchar_t *ws , wchar_t wc, size_t n )
|
||||||
{
|
{
|
||||||
wchar_t *temp = ws;
|
wchar_t *temp = ws;
|
||||||
for( unsigned i=0; i<n; ++i, ++temp )
|
for( unsigned i=0; i<n; ++i, ++temp )
|
||||||
*temp = wc;
|
*temp = wc;
|
||||||
return ws;
|
return ws;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
__END_DECLS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2005 Steve Checkoway
|
* (c) 2003-2006 Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
Reference in New Issue
Block a user