/*
*******************************************************************************
*
-* Copyright (C) 1998-2008, International Business Machines
+* Copyright (C) 1998-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
#include "cstring.h"
#include "unicode/ustring.h"
#include "unicode/putil.h"
+#include "unicode/utf16.h"
/* Protos */
static void ustr_resize(struct UString *s, int32_t len, UErrorCode *status);
/* Macros */
#define ALLOCATION(minSize) (minSize < 0x80 ? 0x80 : (2 * minSize + 0x80) & ~(0x80 - 1))
-void
+U_CFUNC void
ustr_init(struct UString *s)
{
s->fChars = 0;
s->fLength = s->fCapacity = 0;
}
-void
+U_CFUNC void
ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status)
{
int i = 0;
}
}
-void
+U_CFUNC void
ustr_deinit(struct UString *s)
{
if (s) {
}
}
-void
+U_CFUNC void
ustr_cpy(struct UString *dst,
const struct UString *src,
UErrorCode *status)
if(src->fChars == NULL || dst->fChars == NULL){
return;
}
- uprv_memcpy(dst->fChars, src->fChars, sizeof(UChar) * src->fLength);
+ u_memcpy(dst->fChars, src->fChars, src->fLength);
dst->fLength = src->fLength;
dst->fChars[dst->fLength] = 0x0000;
}
-void
+U_CFUNC void
ustr_setlen(struct UString *s,
int32_t len,
UErrorCode *status)
s->fChars[len] = 0x0000;
}
-void
+U_CFUNC void
ustr_cat(struct UString *dst,
const struct UString *src,
UErrorCode *status)
ustr_ncat(dst, src, src->fLength, status);
}
-void
+U_CFUNC void
ustr_ncat(struct UString *dst,
const struct UString *src,
int32_t n,
dst->fChars[dst->fLength] = 0x0000;
}
-void
+U_CFUNC void
ustr_ucat(struct UString *dst,
UChar c,
UErrorCode *status)
dst->fLength += 1;
dst->fChars[dst->fLength] = 0x0000;
}
-void
+U_CFUNC void
ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status){
if(c > 0x10FFFF){
*status = U_ILLEGAL_CHAR_FOUND;
ustr_ucat(dst, (UChar) c, status);
}
}
-void
+U_CFUNC void
ustr_uscat(struct UString *dst,
const UChar* src,int len,
UErrorCode *status)