Rename char16_t to char16 to fix VS2010 compiler errors due to char16_t becoming a built-in type (issue #243).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@289 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-09-18 01:07:28 +00:00
parent 093c969fb1
commit d27343bac5
4 changed files with 19 additions and 19 deletions

View File

@ -74,7 +74,7 @@ typedef cef_string_userfree_utf8_t cef_string_userfree_t;
#define cef_string_to_wide cef_string_utf8_to_wide #define cef_string_to_wide cef_string_utf8_to_wide
#define cef_string_from_wide cef_string_wide_to_utf8 #define cef_string_from_wide cef_string_wide_to_utf8
#elif defined(CEF_STRING_TYPE_UTF16) #elif defined(CEF_STRING_TYPE_UTF16)
typedef char16_t cef_char_t; typedef char16 cef_char_t;
typedef cef_string_userfree_utf16_t cef_string_userfree_t; typedef cef_string_userfree_utf16_t cef_string_userfree_t;
typedef cef_string_utf16_t cef_string_t; typedef cef_string_utf16_t cef_string_t;
#define cef_string_set cef_string_utf16_set #define cef_string_set cef_string_utf16_set

View File

@ -43,13 +43,13 @@ extern "C" {
#include "cef_export.h" #include "cef_export.h"
#include <stddef.h> #include <stddef.h>
// CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on // CEF character type definitions. wchar_t is 2 bytes on Windows and 4 bytes on
// most other platforms. // most other platforms.
#if defined(OS_WIN) #if defined(OS_WIN)
typedef wchar_t char16_t; typedef wchar_t char16;
#else // !OS_WIN #else // !OS_WIN
typedef unsigned short char16_t; typedef unsigned short char16;
#ifndef WCHAR_T_IS_UTF32 #ifndef WCHAR_T_IS_UTF32
#define WCHAR_T_IS_UTF32 #define WCHAR_T_IS_UTF32
#endif // WCHAR_T_IS_UTF32 #endif // WCHAR_T_IS_UTF32
@ -76,9 +76,9 @@ typedef struct _cef_string_utf8_t {
} cef_string_utf8_t; } cef_string_utf8_t;
typedef struct _cef_string_utf16_t { typedef struct _cef_string_utf16_t {
char16_t* str; char16* str;
size_t length; size_t length;
void (*dtor)(char16_t* str); void (*dtor)(char16* str);
} cef_string_utf16_t; } cef_string_utf16_t;
@ -92,7 +92,7 @@ CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
cef_string_wide_t* output, int copy); cef_string_wide_t* output, int copy);
CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len, CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len,
cef_string_utf8_t* output, int copy); cef_string_utf8_t* output, int copy);
CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_set(const char16* src, size_t src_len,
cef_string_utf16_t* output, int copy); cef_string_utf16_t* output, int copy);
@ -143,12 +143,12 @@ CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len,
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len, CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
cef_string_utf16_t* output); cef_string_utf16_t* output);
CEF_EXPORT int cef_string_utf16_to_wide(const char16_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len,
cef_string_wide_t* output); cef_string_wide_t* output);
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len, CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
cef_string_utf16_t* output); cef_string_utf16_t* output);
CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len,
cef_string_utf8_t* output); cef_string_utf8_t* output);

View File

@ -188,7 +188,7 @@ struct CefStringTraitsUTF8 {
// Traits implementation for utf16 character strings. // Traits implementation for utf16 character strings.
/// ///
struct CefStringTraitsUTF16 { struct CefStringTraitsUTF16 {
typedef char16_t char_type; typedef char16 char_type;
typedef cef_string_utf16_t struct_type; typedef cef_string_utf16_t struct_type;
typedef cef_string_userfree_utf16_t userfree_struct_type; typedef cef_string_userfree_utf16_t userfree_struct_type;
@ -339,7 +339,7 @@ public:
/// ///
CefStringBase(const string16& src) : string_(NULL), owner_(false) CefStringBase(const string16& src) : string_(NULL), owner_(false)
{ FromString16(src); } { FromString16(src); }
CefStringBase(const char16_t* src) : string_(NULL), owner_(false) CefStringBase(const char16* src) : string_(NULL), owner_(false)
{ FromString16(string16(src)); } { FromString16(string16(src)); }
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32 #endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
@ -667,7 +667,7 @@ public:
operator string16() const { return ToString16(); } operator string16() const { return ToString16(); }
CefStringBase& operator=(const string16& str) CefStringBase& operator=(const string16& str)
{ FromString16(str); return *this; } { FromString16(str); return *this; }
CefStringBase& operator=(const char16_t* str) CefStringBase& operator=(const char16* str)
{ FromString16(string16(str)); return *this; } { FromString16(string16(str)); return *this; }
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32 #endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32

View File

@ -19,7 +19,7 @@ void string_utf8_dtor(char* str)
delete [] str; delete [] str;
} }
void string_utf16_dtor(char16_t* str) void string_utf16_dtor(char16* str)
{ {
delete [] str; delete [] str;
} }
@ -74,24 +74,24 @@ CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len,
return 1; return 1;
} }
CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_set(const char16* src, size_t src_len,
cef_string_utf16_t* output, int copy) cef_string_utf16_t* output, int copy)
{ {
cef_string_utf16_clear(output); cef_string_utf16_clear(output);
if (copy) { if (copy) {
if (src && src_len > 0) { if (src && src_len > 0) {
output->str = new char16_t[src_len+1]; output->str = new char16[src_len+1];
if (!output->str) if (!output->str)
return 0; return 0;
memcpy(output->str, src, src_len * sizeof(char16_t)); memcpy(output->str, src, src_len * sizeof(char16));
output->str[src_len] = 0; output->str[src_len] = 0;
output->length = src_len; output->length = src_len;
output->dtor = string_utf16_dtor; output->dtor = string_utf16_dtor;
} }
} else { } else {
output->str = const_cast<char16_t*>(src); output->str = const_cast<char16*>(src);
output->length = src_len; output->length = src_len;
output->dtor = NULL; output->dtor = NULL;
} }
@ -211,7 +211,7 @@ CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
return ret; return ret;
} }
CEF_EXPORT int cef_string_utf16_to_wide(const char16_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len,
cef_string_wide_t* output) cef_string_wide_t* output)
{ {
std::wstring str; std::wstring str;
@ -231,7 +231,7 @@ CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
return ret; return ret;
} }
CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len,
cef_string_utf8_t* output) cef_string_utf8_t* output)
{ {
std::string str; std::string str;