Commit 7f5393ea authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: csr: remove CsrUtf8String typedef

Use the in-kernel u8 type instead.

Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
Cc: Riku Mettälä <riku.mettala@bluegiga.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f58bfd88
...@@ -74,7 +74,7 @@ void CsrMsgConvDeinit(void); ...@@ -74,7 +74,7 @@ void CsrMsgConvDeinit(void);
/* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */ /* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */
u32 CsrCharStringSerLen(const CsrCharString *str); u32 CsrCharStringSerLen(const CsrCharString *str);
u32 CsrUtf8StringSerLen(const CsrUtf8String *str); u32 CsrUtf8StringSerLen(const u8 *str);
u32 CsrUtf16StringSerLen(const u16 *str); u32 CsrUtf16StringSerLen(const u16 *str);
/* Prototypes for primitive type serializers */ /* Prototypes for primitive type serializers */
...@@ -83,7 +83,7 @@ void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value); ...@@ -83,7 +83,7 @@ void CsrUint16Ser(u8 *buffer, CsrSize *offset, u16 value);
void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value); void CsrUint32Ser(u8 *buffer, CsrSize *offset, u32 value);
void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length); void CsrMemCpySer(u8 *buffer, CsrSize *offset, const void *value, CsrSize length);
void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value); void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value);
void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value); void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value);
void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value); void CsrUtf16StringSer(u8 *buffer, CsrSize *offset, const u16 *value);
void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr); void CsrVoidPtrSer(u8 *buffer, CsrSize *offset, void *ptr);
void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value); void CsrSizeSer(u8 *buffer, CsrSize *offset, CsrSize value);
...@@ -93,7 +93,7 @@ void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset); ...@@ -93,7 +93,7 @@ void CsrUint16Des(u16 *value, u8 *buffer, CsrSize *offset);
void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset); void CsrUint32Des(u32 *value, u8 *buffer, CsrSize *offset);
void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length); void CsrMemCpyDes(void *value, u8 *buffer, CsrSize *offset, CsrSize length);
void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset); void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset);
void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset); void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset);
void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset); void CsrUtf16StringDes(u16 **value, u8 *buffer, CsrSize *offset);
void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset); void CsrVoidPtrDes(void **value, u8 *buffer, CsrSize *offset);
void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset); void CsrSizeDes(CsrSize *value, u8 *buffer, CsrSize *offset);
......
...@@ -55,9 +55,9 @@ void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset) ...@@ -55,9 +55,9 @@ void CsrCharStringDes(CsrCharString **value, u8 *buffer, CsrSize *offset)
} }
EXPORT_SYMBOL_GPL(CsrCharStringDes); EXPORT_SYMBOL_GPL(CsrCharStringDes);
void CsrUtf8StringDes(CsrUtf8String **value, u8 *buffer, CsrSize *offset) void CsrUtf8StringDes(u8 **value, u8 *buffer, CsrSize *offset)
{ {
*value = (CsrUtf8String *) CsrStrDup((CsrCharString *) &buffer[*offset]); *value = (u8 *) CsrStrDup((CsrCharString *) &buffer[*offset]);
*offset += CsrStrLen((CsrCharString *) *value) + 1; *offset += CsrStrLen((CsrCharString *) *value) + 1;
} }
...@@ -134,7 +134,7 @@ void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value) ...@@ -134,7 +134,7 @@ void CsrCharStringSer(u8 *buffer, CsrSize *offset, const CsrCharString *value)
} }
EXPORT_SYMBOL_GPL(CsrCharStringSer); EXPORT_SYMBOL_GPL(CsrCharStringSer);
void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const CsrUtf8String *value) void CsrUtf8StringSer(u8 *buffer, CsrSize *offset, const u8 *value)
{ {
CsrCharStringSer(buffer, offset, (CsrCharString *) value); CsrCharStringSer(buffer, offset, (CsrCharString *) value);
} }
...@@ -185,7 +185,7 @@ u32 CsrCharStringSerLen(const CsrCharString *str) ...@@ -185,7 +185,7 @@ u32 CsrCharStringSerLen(const CsrCharString *str)
} }
} }
u32 CsrUtf8StringSerLen(const CsrUtf8String *str) u32 CsrUtf8StringSerLen(const u8 *str)
{ {
if (str) if (str)
{ {
......
...@@ -37,7 +37,6 @@ typedef u8 CsrBool; ...@@ -37,7 +37,6 @@ typedef u8 CsrBool;
/* String types */ /* String types */
typedef char CsrCharString; typedef char CsrCharString;
typedef u8 CsrUtf8String;
/* /*
* 64-bit integers * 64-bit integers
......
...@@ -21,9 +21,9 @@ u16 *CsrUint32ToUtf16String(u32 number); ...@@ -21,9 +21,9 @@ u16 *CsrUint32ToUtf16String(u32 number);
u32 CsrUtf16StringToUint32(const u16 *unicodeString); u32 CsrUtf16StringToUint32(const u16 *unicodeString);
u32 CsrUtf16StrLen(const u16 *unicodeString); u32 CsrUtf16StrLen(const u16 *unicodeString);
CsrUtf8String *CsrUtf16String2Utf8(const u16 *source); u8 *CsrUtf16String2Utf8(const u16 *source);
u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String); u16 *CsrUtf82Utf16String(const u8 *utf8String);
u16 *CsrUtf16StrCpy(u16 *target, const u16 *source); u16 *CsrUtf16StrCpy(u16 *target, const u16 *source);
u16 *CsrUtf16StringDuplicate(const u16 *source); u16 *CsrUtf16StringDuplicate(const u16 *source);
...@@ -38,9 +38,9 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, ...@@ -38,9 +38,9 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2,
u16 *CsrUtf16String2XML(u16 *str); u16 *CsrUtf16String2XML(u16 *str);
u16 *CsrXML2Utf16String(u16 *str); u16 *CsrXML2Utf16String(u16 *str);
s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2); s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2);
s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count); s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count);
u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); u32 CsrUtf8StringLengthInBytes(const u8 *string);
/******************************************************************************* /*******************************************************************************
...@@ -66,7 +66,7 @@ u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string); ...@@ -66,7 +66,7 @@ u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string);
Returns target Returns target
*******************************************************************************/ *******************************************************************************/
CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count); u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count);
/******************************************************************************* /*******************************************************************************
...@@ -90,7 +90,7 @@ CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count); ...@@ -90,7 +90,7 @@ CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count);
Returns target Returns target
*******************************************************************************/ *******************************************************************************/
CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source); u8 *CsrUtf8StrCpy(u8 *target, const u8 *source);
/******************************************************************************* /*******************************************************************************
...@@ -116,7 +116,7 @@ CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source) ...@@ -116,7 +116,7 @@ CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source)
Returns target Returns target
*******************************************************************************/ *******************************************************************************/
CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count); u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count);
/******************************************************************************* /*******************************************************************************
...@@ -143,7 +143,7 @@ CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source ...@@ -143,7 +143,7 @@ CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source
Returns target Returns target
*******************************************************************************/ *******************************************************************************/
CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count); u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count);
/******************************************************************************* /*******************************************************************************
...@@ -163,9 +163,9 @@ CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *so ...@@ -163,9 +163,9 @@ CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *so
Returns a duplicate of source. Returns a duplicate of source.
*******************************************************************************/ *******************************************************************************/
CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source); u8 *CsrUtf8StrDup(const u8 *source);
CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4); u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4);
/* /*
* UCS2 * UCS2
......
...@@ -253,9 +253,9 @@ u32 CsrUtf16StrLen(const u16 *unicodeString) ...@@ -253,9 +253,9 @@ u32 CsrUtf16StrLen(const u16 *unicodeString)
* Output: 0-terminated string of byte oriented UTF8 coded characters. * Output: 0-terminated string of byte oriented UTF8 coded characters.
* *
*********************************************************************************/ *********************************************************************************/
CsrUtf8String *CsrUtf16String2Utf8(const u16 *source) u8 *CsrUtf16String2Utf8(const u16 *source)
{ {
CsrUtf8String *dest, *destStart = NULL; u8 *dest, *destStart = NULL;
u32 i; u32 i;
u32 ch; u32 ch;
u32 length; u32 length;
...@@ -463,9 +463,9 @@ CsrUtf8String *CsrUtf16String2Utf8(const u16 *source) ...@@ -463,9 +463,9 @@ CsrUtf8String *CsrUtf16String2Utf8(const u16 *source)
TRUE if the given code unit is legal. TRUE if the given code unit is legal.
*****************************************************************************/ *****************************************************************************/
static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length) static CsrBool isLegalUtf8(const u8 *codeUnit, u32 length)
{ {
const CsrUtf8String *srcPtr = codeUnit + length; const u8 *srcPtr = codeUnit + length;
u8 byte; u8 byte;
switch (length) /* Everything falls through except case 1 */ switch (length) /* Everything falls through except case 1 */
...@@ -562,7 +562,7 @@ static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length) ...@@ -562,7 +562,7 @@ static CsrBool isLegalUtf8(const CsrUtf8String *codeUnit, u32 length)
* Output: 0-terminated string of UTF-16 characters. * Output: 0-terminated string of UTF-16 characters.
* *
*********************************************************************************/ *********************************************************************************/
u16 *CsrUtf82Utf16String(const CsrUtf8String *utf8String) u16 *CsrUtf82Utf16String(const u8 *utf8String)
{ {
CsrSize i, length = 0; CsrSize i, length = 0;
CsrSize sourceLength; CsrSize sourceLength;
...@@ -1016,17 +1016,17 @@ u16 *CsrXML2Utf16String(u16 *str) ...@@ -1016,17 +1016,17 @@ u16 *CsrXML2Utf16String(u16 *str)
return resultString; return resultString;
} }
s32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2) s32 CsrUtf8StrCmp(const u8 *string1, const u8 *string2)
{ {
return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2); return CsrStrCmp((const CsrCharString *) string1, (const CsrCharString *) string2);
} }
s32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count) s32 CsrUtf8StrNCmp(const u8 *string1, const u8 *string2, CsrSize count)
{ {
return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count); return CsrStrNCmp((const CsrCharString *) string1, (const CsrCharString *) string2, count);
} }
u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) u32 CsrUtf8StringLengthInBytes(const u8 *string)
{ {
CsrSize length = 0; CsrSize length = 0;
if (string) if (string)
...@@ -1036,12 +1036,12 @@ u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string) ...@@ -1036,12 +1036,12 @@ u32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string)
return (u32) length; return (u32) length;
} }
CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source) u8 *CsrUtf8StrCpy(u8 *target, const u8 *source)
{ {
return (CsrUtf8String *) CsrStrCpy((CsrCharString *) target, (const CsrCharString *) source); return (u8 *) CsrStrCpy((CsrCharString *) target, (const CsrCharString *) source);
} }
CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count) u8 *CsrUtf8StrTruncate(u8 *target, CsrSize count)
{ {
CsrSize lastByte = count - 1; CsrSize lastByte = count - 1;
...@@ -1070,12 +1070,12 @@ CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count) ...@@ -1070,12 +1070,12 @@ CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count)
return target; return target;
} }
CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count) u8 *CsrUtf8StrNCpy(u8 *target, const u8 *source, CsrSize count)
{ {
return (CsrUtf8String *) CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); return (u8 *) CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count);
} }
CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count) u8 *CsrUtf8StrNCpyZero(u8 *target, const u8 *source, CsrSize count)
{ {
CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count); CsrStrNCpy((CsrCharString *) target, (const CsrCharString *) source, count);
if (target[count - 1] != '\0') if (target[count - 1] != '\0')
...@@ -1085,14 +1085,14 @@ CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *so ...@@ -1085,14 +1085,14 @@ CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *so
return target; return target;
} }
CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source) u8 *CsrUtf8StrDup(const u8 *source)
{ {
return (CsrUtf8String *) CsrStrDup((const CsrCharString *) source); return (u8 *) CsrStrDup((const CsrCharString *) source);
} }
CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4) u8 *CsrUtf8StringConcatenateTexts(const u8 *inputText1, const u8 *inputText2, const u8 *inputText3, const u8 *inputText4)
{ {
CsrUtf8String *outputText; u8 *outputText;
u32 textLen, textLen1, textLen2, textLen3, textLen4; u32 textLen, textLen1, textLen2, textLen3, textLen4;
textLen1 = CsrUtf8StringLengthInBytes(inputText1); textLen1 = CsrUtf8StringLengthInBytes(inputText1);
...@@ -1107,7 +1107,7 @@ CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, co ...@@ -1107,7 +1107,7 @@ CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, co
return NULL; return NULL;
} }
outputText = (CsrUtf8String *) CsrPmemAlloc((textLen + 1) * sizeof(CsrUtf8String)); /* add space for 0-termination*/ outputText = (u8 *) CsrPmemAlloc((textLen + 1) * sizeof(u8)); /* add space for 0-termination*/
if (inputText1 != NULL) if (inputText1 != NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment