mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-347 do not use wchar.h except when we really need it and we know that we have it
X-SVN-Rev: 1087
This commit is contained in:
parent
84aa10b17f
commit
db929853bc
8 changed files with 53 additions and 17 deletions
|
@ -127,3 +127,34 @@ T_CString_stricmp(const char *str1, const char *str2) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !U_HAVE_WCHAR_H
|
||||
U_CAPI wchar_t *uprv_wcscat(wchar_t *dst, const wchar_t *src) {
|
||||
wchar_t *start=dst;
|
||||
while(*dst!=0) {
|
||||
++dst;
|
||||
}
|
||||
while((*dst=*src)!=0) {
|
||||
++dst;
|
||||
++src;
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
U_CAPI wchar_t *uprv_wcscpy(wchar_t *dst, const wchar_t *src) {
|
||||
wchar_t *start=dst;
|
||||
while((*dst=*src)!=0) {
|
||||
++dst;
|
||||
++src;
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
U_CAPI size_t uprv_wcslen(const wchar_t *src) {
|
||||
const wchar_t *start=src;
|
||||
while(*src!=0) {
|
||||
++src;
|
||||
}
|
||||
return src-start;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -55,9 +55,19 @@
|
|||
/*===========================================================================*/
|
||||
/* Wide-character functions */
|
||||
/*===========================================================================*/
|
||||
#define uprv_wcscat(dst, src) wcscat(dst, src)
|
||||
#define uprv_wcscpy(dst, src) wcscpy(dst, src)
|
||||
#define uprv_wcslen(src) wcslen(src)
|
||||
|
||||
/* The following are not available on all systemts, defined in wchar.h or string.h . */
|
||||
#if U_HAVE_WCHAR_H
|
||||
# define uprv_wcscat(dst, src) wcscat(dst, src)
|
||||
# define uprv_wcscpy(dst, src) wcscpy(dst, src)
|
||||
# define uprv_wcslen(src) wcslen(src)
|
||||
#else
|
||||
U_CAPI wchar_t *uprv_wcscat(wchar_t *dst, const wchar_t *src);
|
||||
U_CAPI wchar_t *uprv_wcscpy(wchar_t *dst, const wchar_t *src);
|
||||
U_CAPI size_t uprv_wcslen(const wchar_t *src);
|
||||
#endif
|
||||
|
||||
/* The following are part of the ANSI C standard, defined in stdlib.h . */
|
||||
#define uprv_wcstombs(mbstr, wcstr, count) wcstombs(mbstr, wcstr, count)
|
||||
#define uprv_mbstowcs(wcstr, mbstr, count) mbstowcs(wcstr, mbstr, count)
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "unicode/utypes.h"
|
||||
#endif
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
typedef struct _FileStream FileStream;
|
||||
|
||||
U_CAPI FileStream* U_EXPORT2
|
||||
|
|
|
@ -45,9 +45,10 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include "rbcache.h"
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/resbund.h"
|
||||
|
||||
#include "rbcache.h"
|
||||
#include "mutex.h"
|
||||
|
||||
#include "unistrm.h"
|
||||
|
@ -60,7 +61,6 @@
|
|||
|
||||
#include <iostream.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Implementation Notes
|
||||
|
|
|
@ -166,15 +166,15 @@ u_strncpy(UChar *dst,
|
|||
int32_t
|
||||
u_strlen(const UChar *s)
|
||||
{
|
||||
if(U_SIZEOF_WCHAR_T == sizeof(UChar)) {
|
||||
return uprv_wcslen((const wchar_t *) s);
|
||||
} else {
|
||||
# if U_SIZEOF_WCHAR_T == U_SIZEOF_UCHAR
|
||||
return uprv_wcslen(s);
|
||||
# else
|
||||
const UChar *t = s;
|
||||
while(*t != 0) {
|
||||
++t;
|
||||
}
|
||||
return t - s;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* conversions between char* and UChar* ------------------------------------- */
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "uprintf.h"
|
||||
#include "uprntf_p.h"
|
||||
#include "unicode/ustdio.h"
|
||||
|
@ -32,8 +33,6 @@
|
|||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
u_printf_handler g_u_printf_handlers [256];
|
||||
u_printf_info g_u_printf_infos [256];
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/uchar.h"
|
||||
|
||||
#include "uscanf.h"
|
||||
|
@ -33,8 +34,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
u_scanf_handler g_u_scanf_handlers [256];
|
||||
u_scanf_info g_u_scanf_infos [256];
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#include <wchar.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "intltest.h"
|
||||
|
|
Loading…
Add table
Reference in a new issue