Flutter Engine
 
Loading...
Searching...
No Matches
fl_test.cc File Reference

Go to the source code of this file.

Functions

static uint8_t hex_digit_to_int (char value)
 
static uint8_t parse_hex8 (const gchar *hex_string)
 
GBytes * hex_string_to_bytes (const gchar *hex_string)
 
gchar * bytes_to_hex_string (GBytes *bytes)
 
void PrintTo (FlValue *v, std::ostream *os)
 

Function Documentation

◆ bytes_to_hex_string()

gchar * bytes_to_hex_string ( GBytes *  bytes)

Definition at line 52 of file fl_test.cc.

52 {
53 GString* hex_string = g_string_new("");
54 size_t data_length;
55 const uint8_t* data =
56 static_cast<const uint8_t*>(g_bytes_get_data(bytes, &data_length));
57 for (size_t i = 0; i < data_length; i++) {
58 g_string_append_printf(hex_string, "%02x", data[i]);
59 }
60 return g_string_free(hex_string, FALSE);
61}
std::shared_ptr< const fml::Mapping > data

References data, and i.

Referenced by encode_error_envelope(), encode_message(), encode_message(), encode_message_with_codec(), encode_method_call(), encode_success_envelope(), and TEST().

◆ hex_digit_to_int()

static uint8_t hex_digit_to_int ( char  value)
static

Definition at line 24 of file fl_test.cc.

24 {
25 if (value >= '0' && value <= '9') {
26 return value - '0';
27 } else if (value >= 'a' && value <= 'f') {
28 return value - 'a' + 10;
29 } else if (value >= 'F' && value <= 'F') {
30 return value - 'A' + 10;
31 } else {
32 return 0;
33 }
34}
int32_t value

References value.

Referenced by parse_hex8().

◆ hex_string_to_bytes()

GBytes * hex_string_to_bytes ( const gchar *  hex_string)

Definition at line 43 of file fl_test.cc.

43 {
44 GByteArray* buffer = g_byte_array_new();
45 for (int i = 0; hex_string[i] != '\0' && hex_string[i + 1] != '\0'; i += 2) {
46 uint8_t value = parse_hex8(hex_string + i);
47 g_byte_array_append(buffer, &value, 1);
48 }
49 return g_byte_array_free_to_bytes(buffer);
50}
g_byte_array_append(buffer, &type, sizeof(uint8_t))
static uint8_t parse_hex8(const gchar *hex_string)
Definition fl_test.cc:36
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98

References g_byte_array_append(), i, parse_hex8(), and value.

Referenced by decode_error_method_call(), decode_error_response(), decode_error_value(), decode_message(), decode_message(), decode_message_with_codec(), decode_method_call(), decode_response_with_error(), and decode_response_with_success().

◆ parse_hex8()

static uint8_t parse_hex8 ( const gchar *  hex_string)
static

Definition at line 36 of file fl_test.cc.

36 {
37 if (hex_string[0] == '\0') {
38 return 0x00;
39 }
40 return hex_digit_to_int(hex_string[0]) << 4 | hex_digit_to_int(hex_string[1]);
41}
static uint8_t hex_digit_to_int(char value)
Definition fl_test.cc:24

References hex_digit_to_int().

Referenced by hex_string_to_bytes().

◆ PrintTo()

void PrintTo ( FlValue v,
std::ostream *  os 
)

Definition at line 63 of file fl_test.cc.

63 {
64 g_autofree gchar* s = fl_value_to_string(v);
65 *os << s;
66}
G_MODULE_EXPORT gchar * fl_value_to_string(FlValue *value)
Definition fl_value.cc:846

References fl_value_to_string().