u32 CsrCharStringSerLen(const CsrCharString *str);
u32 CsrUtf8StringSerLen(const CsrUtf8String *str);
-u32 CsrUtf16StringSerLen(const CsrUtf16String *str);
+u32 CsrUtf16StringSerLen(const u16 *str);
/* Prototypes for primitive type serializers */
void CsrUint8Ser(u8 *buffer, CsrSize *offset, u8 value);
void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length);
void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value);
void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value);
-void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const CsrUtf16String *value);
+void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value);
void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr);
void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value);
void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length);
void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset);
void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset);
-void CsrUtf16StringDes(CsrUtf16String **value, u8 *buffer, CsrSize *offset);
+void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset);
void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset);
void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset);
extern "C" {
#endif
-CsrUtf16String *CsrUint32ToUtf16String(u32 number);
+u16 *CsrUint32ToUtf16String(u32 number);
-u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString);
-u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString);
+u32 CsrUtf16StringToUint32(const u16 *unicodeString);
+u32 CsrUtf16StrLen(const u16 *unicodeString);
-CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source);
+CsrUtf8String *CsrUtf16String2Utf8(const u16 *source);
-CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String);
+u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String);
-CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source);
-CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source);
+u16 *CsrUtf16StrCpy(u16 *target, const u16 *source);
+u16 *CsrUtf16StringDuplicate(const u16 *source);
-u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2);
-u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, u32 count);
+u16 CsrUtf16StrICmp(const u16 *string1, const u16 *string2);
+u16 CsrUtf16StrNICmp(const u16 *string1, const u16 *string2, u32 count);
-CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, u32 count);
-CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2,
- const CsrUtf16String *inputText3, const CsrUtf16String *inputText4);
+u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count);
+u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2,
+ const u16 *inputText3, const u16 *inputText4);
-CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str);
-CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str);
+u16 *CsrUtf16String2XML(u16 *str);
+u16 *CsrXML2Utf16String(u16 *str);
s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2);
s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count);
u8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String);
CsrUcs2String *CsrUtf82Ucs2ByteString(const u8 *utf8String);
-u8 *CsrUtf16String2Ucs2ByteString(const CsrUtf16String *source);
-CsrUtf16String *CsrUcs2ByteString2Utf16String(const u8 *source);
+u8 *CsrUtf16String2Ucs2ByteString(const u16 *source);
+u16 *CsrUcs2ByteString2Utf16String(const u8 *source);
#ifdef __cplusplus
}
* Output: A string of UTF-16 characters.
*
*********************************************************************************/
-CsrUtf16String *CsrUint32ToUtf16String(u32 number)
+u16 *CsrUint32ToUtf16String(u32 number)
{
u16 count, noOfDigits;
- CsrUtf16String *output;
+ u16 *output;
u32 tempNumber;
/* calculate the number of digits in the output */
noOfDigits++;
}
- output = (CsrUtf16String *) CsrPmemAlloc(sizeof(CsrUtf16String) * (noOfDigits + 1)); /*add space for 0-termination*/
+ output = (u16 *) CsrPmemAlloc(sizeof(u16) * (noOfDigits + 1)); /*add space for 0-termination*/
tempNumber = number;
for (count = noOfDigits; count > 0; count--)
{
- output[count - 1] = (CsrUtf16String) ((tempNumber % 10) + '0');
+ output[count - 1] = (u16) ((tempNumber % 10) + '0');
tempNumber = tempNumber / 10;
}
output[noOfDigits] = '\0';
* Output: 32 bit number.
*
*********************************************************************************/
-u32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString)
+u32 CsrUtf16StringToUint32(const u16 *unicodeString)
{
u16 numLen, count;
u32 newNumber = 0;
for (count = 0; count < numLen; count++)
{
- CsrUtf16String input = unicodeString[count];
+ u16 input = unicodeString[count];
if ((input < 0x30) || (input > 0x39) || ((newNumber == 0x19999999) && (input > 0x35)) || (newNumber > 0x19999999)) /* chars are present or number is too large now causing number to get to large when *10 */
{
return 0;
* Output: A pointer to an unicoded string.
*
*********************************************************************************/
-CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, u32 count)
+u16 *CsrUtf16MemCpy(u16 *dest, const u16 *src, u32 count)
{
- return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(CsrUtf16String));
+ return CsrMemCpy((u8 *) dest, (u8 *) src, count * sizeof(u16));
}
/********************************************************************************
* Output: A new unicoded string (UTF-16) containing the combined strings.
*
*********************************************************************************/
-CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2,
- const CsrUtf16String *inputText3, const CsrUtf16String *inputText4)
+u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2,
+ const u16 *inputText3, const u16 *inputText4)
{
- CsrUtf16String *outputText;
+ u16 *outputText;
u32 textLen, textLen1, textLen2, textLen3, textLen4;
textLen1 = CsrUtf16StrLen(inputText1);
return NULL;
}
- outputText = (CsrUtf16String *) CsrPmemAlloc((textLen + 1) * sizeof(CsrUtf16String)); /* add space for 0-termination*/
+ outputText = (u16 *) CsrPmemAlloc((textLen + 1) * sizeof(u16)); /* add space for 0-termination*/
if (inputText1 != NULL)
* Output: The number of 16 bit elements in the string.
*
*********************************************************************************/
-u32 CsrUtf16StrLen(const CsrUtf16String *unicodeString)
+u32 CsrUtf16StrLen(const u16 *unicodeString)
{
u32 length;
* Output: 0-terminated string of byte oriented UTF8 coded characters.
*
*********************************************************************************/
-CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source)
+CsrUtf8String *CsrUtf16String2Utf8(const u16 *source)
{
CsrUtf8String *dest, *destStart = NULL;
u32 i;
* Output: 0-terminated string of UTF-16 characters.
*
*********************************************************************************/
-CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String)
+u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String)
{
CsrSize i, length = 0;
CsrSize sourceLength;
- CsrUtf16String *dest = NULL;
- CsrUtf16String *destStart = NULL;
+ u16 *dest = NULL;
+ u16 *destStart = NULL;
s8 extraBytes2Read;
if (!utf8String)
}
/* Create space for the null terminated character */
- dest = (CsrUtf16String *) CsrPmemAlloc((1 + length) * sizeof(CsrUtf16String));
+ dest = (u16 *) CsrPmemAlloc((1 + length) * sizeof(u16));
destStart = dest;
for (i = 0; i < sourceLength; i++)
* Output: 0-terminated UTF-16 string.
*
*********************************************************************************/
-CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source)
+u16 *CsrUtf16StrCpy(u16 *target, const u16 *source)
{
if (source) /* if source is not NULL*/
{
- CsrMemCpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(CsrUtf16String));
+ CsrMemCpy(target, source, (CsrUtf16StrLen(source) + 1) * sizeof(u16));
return target;
}
else
* Output: Allocated variable0-terminated UTF-16 string.
*
*********************************************************************************/
-CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source)
+u16 *CsrUtf16StringDuplicate(const u16 *source)
{
- CsrUtf16String *target = NULL;
+ u16 *target = NULL;
u32 length;
if (source) /* if source is not NULL*/
{
- length = (CsrUtf16StrLen(source) + 1) * sizeof(CsrUtf16String);
- target = (CsrUtf16String *) CsrPmemAlloc(length);
+ length = (CsrUtf16StrLen(source) + 1) * sizeof(u16);
+ target = (u16 *) CsrPmemAlloc(length);
CsrMemCpy(target, source, length);
}
return target;
* Output: 0: if the strings are identical.
*
*********************************************************************************/
-u16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2)
+u16 CsrUtf16StrICmp(const u16 *string1, const u16 *string2)
{
while (*string1 || *string2)
{
* Output: 0: if the strings are identical.
*
*********************************************************************************/
-u16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, u32 count)
+u16 CsrUtf16StrNICmp(const u16 *string1, const u16 *string2, u32 count)
{
while ((*string1 || *string2) && count--)
{
* Output: A new unicoded string (UTF-16) containing the converted output.
*
*********************************************************************************/
-CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str)
+u16 *CsrUtf16String2XML(u16 *str)
{
- CsrUtf16String *scanString;
- CsrUtf16String *outputString = NULL;
- CsrUtf16String *resultString = str;
+ u16 *scanString;
+ u16 *outputString = NULL;
+ u16 *resultString = str;
u32 stringLength = 0;
CsrBool encodeChars = FALSE;
if (encodeChars)
{
- resultString = outputString = CsrPmemAlloc(stringLength * sizeof(CsrUtf16String));
+ resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16));
scanString = str;
* Output: A new unicoded pointer containing the decoded output.
*
*********************************************************************************/
-CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str)
+u16 *CsrXML2Utf16String(u16 *str)
{
- CsrUtf16String *scanString;
- CsrUtf16String *outputString = NULL;
- CsrUtf16String *resultString = str;
+ u16 *scanString;
+ u16 *outputString = NULL;
+ u16 *resultString = str;
u32 stringLength = 0;
CsrBool encodeChars = FALSE;
{
while (*scanString)
{
- if (*scanString == (CsrUtf16String) L'&')
+ if (*scanString == (u16) L'&')
{
scanString++;
- if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"AMP;", 4))
+ if (!CsrUtf16StrNICmp(scanString, (u16 *) L"AMP;", 4))
{
scanString += 3;
encodeChars = TRUE;
}
- else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"LT;", 3))
+ else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"LT;", 3))
{
scanString += 2;
encodeChars = TRUE;
}
- else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"GT;", 3))
+ else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"GT;", 3))
{
scanString += 2;
encodeChars = TRUE;
}
- if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"APOS;", 5))
+ if (!CsrUtf16StrNICmp(scanString, (u16 *) L"APOS;", 5))
{
scanString += 4;
encodeChars = TRUE;
}
- if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"QUOT;", 5))
+ if (!CsrUtf16StrNICmp(scanString, (u16 *) L"QUOT;", 5))
{
scanString += 4;
encodeChars = TRUE;
if (encodeChars)
{
- resultString = outputString = CsrPmemAlloc(stringLength * sizeof(CsrUtf16String));
+ resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16));
scanString = str;
{
scanString++;
- if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"AMP;", 4))
+ if (!CsrUtf16StrNICmp(scanString, (u16 *) L"AMP;", 4))
{
*outputString++ = L'&';
scanString += 3;
}
- else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"LT;", 3))
+ else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"LT;", 3))
{
*outputString++ = L'<';
scanString += 2;
}
- else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"GT;", 3))
+ else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"GT;", 3))
{
*outputString++ = L'>';
scanString += 2;
}
- else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"APOS;", 5))
+ else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"APOS;", 5))
{
*outputString++ = L'\'';
scanString += 4;
}
- else if (!CsrUtf16StrNICmp(scanString, (CsrUtf16String *) L"QUOT;", 5))
+ else if (!CsrUtf16StrNICmp(scanString, (u16 *) L"QUOT;", 5))
{
*outputString++ = L'\"';
scanString += 4;