Remove CEF-specific integer and char16 typedef's (see #3507)

This commit is contained in:
Marshall Greenblatt
2023-06-01 17:06:15 +03:00
parent 695ee2a041
commit 5042d71408
150 changed files with 597 additions and 621 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_from_wide cef_string_wide_to_utf8
#elif defined(CEF_STRING_TYPE_UTF16)
typedef char16 cef_char_t;
typedef char16_t cef_char_t;
typedef cef_string_userfree_utf16_t cef_string_userfree_t;
typedef cef_string_utf16_t cef_string_t;
#define cef_string_set cef_string_utf16_set

View File

@@ -70,9 +70,9 @@ typedef struct _cef_string_utf8_t {
} cef_string_utf8_t;
typedef struct _cef_string_utf16_t {
char16* str;
char16_t* str;
size_t length;
void (*dtor)(char16* str);
void (*dtor)(char16_t* str);
} cef_string_utf16_t;
///
@@ -89,7 +89,7 @@ CEF_EXPORT int cef_string_utf8_set(const char* src,
size_t src_len,
cef_string_utf8_t* output,
int copy);
CEF_EXPORT int cef_string_utf16_set(const char16* src,
CEF_EXPORT int cef_string_utf16_set(const char16_t* src,
size_t src_len,
cef_string_utf16_t* output,
int copy);
@@ -141,14 +141,14 @@ CEF_EXPORT int cef_string_utf8_to_wide(const char* src,
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src,
size_t src_len,
cef_string_utf16_t* output);
CEF_EXPORT int cef_string_utf16_to_wide(const char16* src,
CEF_EXPORT int cef_string_utf16_to_wide(const char16_t* src,
size_t src_len,
cef_string_wide_t* output);
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src,
size_t src_len,
cef_string_utf16_t* output);
CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src,
CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src,
size_t src_len,
cef_string_utf8_t* output);
@@ -198,10 +198,10 @@ CEF_EXPORT void cef_string_userfree_utf16_free(cef_string_userfree_utf16_t str);
/// may change the length of the string in some cases.
///
CEF_EXPORT int cef_string_utf16_to_lower(const char16* src,
CEF_EXPORT int cef_string_utf16_to_lower(const char16_t* src,
size_t src_len,
cef_string_utf16_t* output);
CEF_EXPORT int cef_string_utf16_to_upper(const char16* src,
CEF_EXPORT int cef_string_utf16_to_upper(const char16_t* src,
size_t src_len,
cef_string_utf16_t* output);

View File

@@ -115,7 +115,7 @@ struct CefStringTraitsWide {
static inline bool from_string16(const std::u16string::value_type* data,
size_t length,
struct_type* s) {
return cef_string_utf16_to_wide(reinterpret_cast<const char16*>(data),
return cef_string_utf16_to_wide(reinterpret_cast<const char16_t*>(data),
length, s)
? true
: false;
@@ -213,7 +213,7 @@ struct CefStringTraitsUTF8 {
static inline bool from_string16(const std::u16string::value_type* data,
size_t length,
struct_type* s) {
return cef_string_utf16_to_utf8(reinterpret_cast<const char16*>(data),
return cef_string_utf16_to_utf8(reinterpret_cast<const char16_t*>(data),
length, s)
? true
: false;
@@ -227,7 +227,7 @@ struct CefStringTraitsUTF8 {
/// Traits implementation for utf16 character strings.
///
struct CefStringTraitsUTF16 {
typedef char16 char_type;
typedef char16_t char_type;
typedef cef_string_utf16_t struct_type;
typedef cef_string_userfree_utf16_t userfree_struct_type;
@@ -290,12 +290,15 @@ struct CefStringTraitsUTF16 {
}
#else // WCHAR_T_IS_UTF32
static inline std::wstring to_wstring(const struct_type* s) {
return std::wstring(s->str, s->length);
return std::wstring(reinterpret_cast<wchar_t*>(s->str), s->length);
}
static inline bool from_wstring(const std::wstring::value_type* data,
size_t length,
struct_type* s) {
return cef_string_utf16_set(data, length, s, true) ? true : false;
return cef_string_utf16_set(reinterpret_cast<const char16_t*>(data), length,
s, true)
? true
: false;
}
#endif // WCHAR_T_IS_UTF32
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
@@ -308,7 +311,7 @@ struct CefStringTraitsUTF16 {
static inline bool from_string16(const std::u16string::value_type* data,
size_t length,
struct_type* s) {
return cef_string_utf16_set(reinterpret_cast<const char16*>(data), length,
return cef_string_utf16_set(reinterpret_cast<const char16_t*>(data), length,
s, true)
? true
: false;
@@ -412,15 +415,6 @@ class CefStringBase {
FromString16(src, length);
}
}
#if defined(WCHAR_T_IS_UTF32)
CefStringBase(const char16* src, size_t length = 0)
: string_(NULL), owner_(false) {
if (src) {
FromString16(reinterpret_cast<const std::u16string::value_type*>(src),
length);
}
}
#endif // WCHAR_T_IS_UTF32
///
/// Create a new string from an existing character array. If |copy| is true
@@ -826,12 +820,6 @@ class CefStringBase {
FromString16(str);
return *this;
}
#if defined(WCHAR_T_IS_UTF32)
CefStringBase& operator=(const char16* str) {
FromString16(reinterpret_cast<const std::u16string::value_type*>(str));
return *this;
}
#endif // WCHAR_T_IS_UTF32
#if defined(USING_CHROMIUM_INCLUDES)
// The base::FilePath constructor is marked as explicit so provide the
// conversion here for convenience.

View File

@@ -35,7 +35,9 @@
extern "C" {
#endif
#include <stdint.h>
#include <time.h>
#include "include/base/cef_basictypes.h"
#include "include/internal/cef_export.h"
@@ -47,7 +49,7 @@ extern "C" {
/// This is equivalent of Chromium `base::Time` (see base/time/time.h).
///
typedef struct _cef_basetime_t {
int64 val;
int64_t val;
} cef_basetime_t;
///

View File

@@ -51,60 +51,60 @@ extern "C" {
CEF_EXPORT void cef_trace_event_instant(const char* category,
const char* name,
const char* arg1_name,
uint64 arg1_val,
uint64_t arg1_val,
const char* arg2_name,
uint64 arg2_val);
uint64_t arg2_val);
CEF_EXPORT void cef_trace_event_begin(const char* category,
const char* name,
const char* arg1_name,
uint64 arg1_val,
uint64_t arg1_val,
const char* arg2_name,
uint64 arg2_val);
uint64_t arg2_val);
CEF_EXPORT void cef_trace_event_end(const char* category,
const char* name,
const char* arg1_name,
uint64 arg1_val,
uint64_t arg1_val,
const char* arg2_name,
uint64 arg2_val);
uint64_t arg2_val);
CEF_EXPORT void cef_trace_counter(const char* category,
const char* name,
const char* value1_name,
uint64 value1_val,
uint64_t value1_val,
const char* value2_name,
uint64 value2_val);
uint64_t value2_val);
CEF_EXPORT void cef_trace_counter_id(const char* category,
const char* name,
uint64 id,
uint64_t id,
const char* value1_name,
uint64 value1_val,
uint64_t value1_val,
const char* value2_name,
uint64 value2_val);
uint64_t value2_val);
CEF_EXPORT void cef_trace_event_async_begin(const char* category,
const char* name,
uint64 id,
uint64_t id,
const char* arg1_name,
uint64 arg1_val,
uint64_t arg1_val,
const char* arg2_name,
uint64 arg2_val);
uint64_t arg2_val);
CEF_EXPORT void cef_trace_event_async_step_into(const char* category,
const char* name,
uint64 id,
uint64 step,
uint64_t id,
uint64_t step,
const char* arg1_name,
uint64 arg1_val);
uint64_t arg1_val);
CEF_EXPORT void cef_trace_event_async_step_past(const char* category,
const char* name,
uint64 id,
uint64 step,
uint64_t id,
uint64_t step,
const char* arg1_name,
uint64 arg1_val);
uint64_t arg1_val);
CEF_EXPORT void cef_trace_event_async_end(const char* category,
const char* name,
uint64 id,
uint64_t id,
const char* arg1_name,
uint64 arg1_val,
uint64_t arg1_val,
const char* arg2_name,
uint64 arg2_val);
uint64_t arg2_val);
#ifdef __cplusplus
}

View File

@@ -49,7 +49,7 @@
// 32-bit ARGB color value, not premultiplied. The color components are always
// in a known order. Equivalent to the SkColor type.
typedef uint32 cef_color_t;
typedef uint32_t cef_color_t;
// Return the alpha byte from a cef_color_t value.
#define CefColorGetA(color) (((color) >> 24) & 0xFF)
@@ -66,17 +66,18 @@ typedef uint32 cef_color_t;
(static_cast<unsigned>(a) << 24) | (static_cast<unsigned>(r) << 16) | \
(static_cast<unsigned>(g) << 8) | (static_cast<unsigned>(b) << 0))
// Return an int64 value with the specified low and high int32 component values.
#define CefInt64Set(int32_low, int32_high) \
static_cast<int64>((static_cast<uint32>(int32_low)) | \
(static_cast<int64>(static_cast<int32>(int32_high))) \
<< 32)
// Return an int64_t value with the specified low and high int32_t component
// values.
#define CefInt64Set(int32_low, int32_high) \
static_cast<int64_t>( \
(static_cast<uint32_t>(int32_low)) | \
(static_cast<int64_t>(static_cast<int32_t>(int32_high))) << 32)
// Return the low int32 value from an int64 value.
#define CefInt64GetLow(int64_val) static_cast<int32>(int64_val)
// Return the high int32 value from an int64 value.
// Return the low int32_t value from an int64_t value.
#define CefInt64GetLow(int64_val) static_cast<int32_t>(int64_val)
// Return the high int32_t value from an int64_t value.
#define CefInt64GetHigh(int64_val) \
static_cast<int32>((static_cast<int64>(int64_val) >> 32) & 0xFFFFFFFFL)
static_cast<int32_t>((static_cast<int64_t>(int64_val) >> 32) & 0xFFFFFFFFL)
#ifdef __cplusplus
extern "C" {
@@ -1779,7 +1780,7 @@ typedef struct _cef_mouse_event_t {
/// Bit flags describing any pressed modifier keys. See
/// cef_event_flags_t for values.
///
uint32 modifiers;
uint32_t modifiers;
} cef_mouse_event_t;
///
@@ -1857,7 +1858,7 @@ typedef struct _cef_touch_event_t {
/// Bit flags describing any pressed modifier keys. See
/// cef_event_flags_t for values.
///
uint32 modifiers;
uint32_t modifiers;
///
/// The device type that caused the event.
@@ -2070,7 +2071,7 @@ typedef struct _cef_key_event_t {
/// Bit flags describing any pressed modifier keys. See
/// cef_event_flags_t for values.
///
uint32 modifiers;
uint32_t modifiers;
///
/// The Windows key code for the key event. This value is used by the DOM
@@ -2095,13 +2096,13 @@ typedef struct _cef_key_event_t {
///
/// The character generated by the keystroke.
///
char16 character;
char16_t character;
///
/// Same as |character| but unmodified by any concurrently-held modifiers
/// (except shift). This is useful for working out shortcut keys.
///
char16 unmodified_character;
char16_t unmodified_character;
///
/// True if the focus is currently on an editable field on the page. This is
@@ -3348,7 +3349,7 @@ typedef struct _cef_touch_handle_state_t {
/// Combination of cef_touch_handle_state_flags_t values indicating what state
/// is set.
///
uint32 flags;
uint32_t flags;
///
/// Enabled state. Only set if |flags| contains CEF_THS_FLAG_ENABLED.