Flutter Engine
fl_standard_message_codec.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_message_codec.h"
#include "flutter/shell/platform/linux/fl_standard_message_codec_private.h"
#include <gmodule.h>
#include <cstring>

Go to the source code of this file.

Classes

struct  _FlStandardMessageCodec
 

Functions

 G_DEFINE_TYPE (FlStandardMessageCodec, fl_standard_message_codec, fl_message_codec_get_type()) static void write_uint8(GByteArray *buffer
 
static void write_uint16 (GByteArray *buffer, uint16_t value)
 
static void write_uint32 (GByteArray *buffer, uint32_t value)
 
static void write_int32 (GByteArray *buffer, int32_t value)
 
static void write_int64 (GByteArray *buffer, int64_t value)
 
static void write_float64 (GByteArray *buffer, double value)
 
static void write_align (GByteArray *buffer, guint align)
 
static gboolean check_size (GBytes *buffer, size_t offset, size_t required, GError **error)
 
static gboolean read_align (GBytes *buffer, size_t *offset, size_t align, GError **error)
 
static const uint8_t * get_data (GBytes *buffer, size_t *offset)
 
static gboolean read_uint8 (GBytes *buffer, size_t *offset, uint8_t *value, GError **error)
 
static gboolean read_uint16 (GBytes *buffer, size_t *offset, uint16_t *value, GError **error)
 
static gboolean read_uint32 (GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
 
static FlValueread_int32_value (GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_int64_value (GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_float64_value (GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_string_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_uint8_list_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_int32_list_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_int64_list_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_float32_list_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_float64_list_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_list_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static FlValueread_map_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 
static GBytes * fl_standard_message_codec_encode_message (FlMessageCodec *codec, FlValue *message, GError **error)
 
static FlValuefl_standard_message_codec_decode_message (FlMessageCodec *codec, GBytes *message, GError **error)
 
static void fl_standard_message_codec_class_init (FlStandardMessageCodecClass *klass)
 
static void fl_standard_message_codec_init (FlStandardMessageCodec *self)
 
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new ()
 
void fl_standard_message_codec_write_size (FlStandardMessageCodec *codec, GByteArray *buffer, uint32_t size)
 
gboolean fl_standard_message_codec_read_size (FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
 
gboolean fl_standard_message_codec_write_value (FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)
 
FlValuefl_standard_message_codec_read_value (FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
 

Variables

static constexpr int kValueNull = 0
 
static constexpr int kValueTrue = 1
 
static constexpr int kValueFalse = 2
 
static constexpr int kValueInt32 = 3
 
static constexpr int kValueInt64 = 4
 
static constexpr int kValueFloat64 = 6
 
static constexpr int kValueString = 7
 
static constexpr int kValueUint8List = 8
 
static constexpr int kValueInt32List = 9
 
static constexpr int kValueInt64List = 10
 
static constexpr int kValueFloat64List = 11
 
static constexpr int kValueList = 12
 
static constexpr int kValueMap = 13
 
static constexpr int kValueFloat32List = 14
 
uint8_t value
 

Function Documentation

◆ check_size()

static gboolean check_size ( GBytes *  buffer,
size_t  offset,
size_t  required,
GError **  error 
)
static

Definition at line 78 of file fl_standard_message_codec.cc.

References FALSE, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, and TRUE.

Referenced by read_align(), read_float32_list_value(), read_float64_list_value(), read_float64_value(), read_int32_list_value(), read_int32_value(), read_int64_list_value(), read_int64_value(), read_string_value(), read_uint16(), read_uint32(), read_uint8(), and read_uint8_list_value().

81  {
82  if (offset + required > g_bytes_get_size(buffer)) {
83  g_set_error(error, FL_MESSAGE_CODEC_ERROR,
84  FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, "Unexpected end of data");
85  return FALSE;
86  }
87  return TRUE;
88 }
const uint8_t uint32_t uint32_t GError ** error
#define FL_MESSAGE_CODEC_ERROR
static const uint8_t buffer[]
return FALSE

◆ fl_standard_message_codec_class_init()

static void fl_standard_message_codec_class_init ( FlStandardMessageCodecClass *  klass)
static

Definition at line 444 of file fl_standard_message_codec.cc.

References fl_standard_message_codec_decode_message(), and fl_standard_message_codec_encode_message().

445  {
446  FL_MESSAGE_CODEC_CLASS(klass)->encode_message =
448  FL_MESSAGE_CODEC_CLASS(klass)->decode_message =
450 }
static GBytes * fl_standard_message_codec_encode_message(FlMessageCodec *codec, FlValue *message, GError **error)
static FlValue * fl_standard_message_codec_decode_message(FlMessageCodec *codec, GBytes *message, GError **error)

◆ fl_standard_message_codec_decode_message()

static FlValue* fl_standard_message_codec_decode_message ( FlMessageCodec *  codec,
GBytes *  message,
GError **  error 
)
static

Definition at line 420 of file fl_standard_message_codec.cc.

References FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA, fl_standard_message_codec_read_value(), fl_value_ref(), and value.

Referenced by fl_standard_message_codec_class_init().

422  {
423  FlStandardMessageCodec* self =
424  reinterpret_cast<FlStandardMessageCodec*>(codec);
425 
426  size_t offset = 0;
427  g_autoptr(FlValue) value =
428  fl_standard_message_codec_read_value(self, message, &offset, error);
429  if (value == nullptr) {
430  return nullptr;
431  }
432 
433  if (offset != g_bytes_get_size(message)) {
434  g_set_error(error, FL_MESSAGE_CODEC_ERROR,
436  "Unused %zi bytes after standard message",
437  g_bytes_get_size(message) - offset);
438  return nullptr;
439  }
440 
441  return fl_value_ref(value);
442 }
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
#define FL_MESSAGE_CODEC_ERROR
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
FlValue * fl_standard_message_codec_read_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)

◆ fl_standard_message_codec_encode_message()

static GBytes* fl_standard_message_codec_encode_message ( FlMessageCodec *  codec,
FlValue message,
GError **  error 
)
static

Definition at line 405 of file fl_standard_message_codec.cc.

References buffer, and fl_standard_message_codec_write_value().

Referenced by fl_standard_message_codec_class_init().

407  {
408  FlStandardMessageCodec* self =
409  reinterpret_cast<FlStandardMessageCodec*>(codec);
410 
411  g_autoptr(GByteArray) buffer = g_byte_array_new();
412  if (!fl_standard_message_codec_write_value(self, buffer, message, error)) {
413  return nullptr;
414  }
415  return g_byte_array_free_to_bytes(
416  static_cast<GByteArray*>(g_steal_pointer(&buffer)));
417 }
const uint8_t uint32_t uint32_t GError ** error
static const uint8_t buffer[]
gboolean fl_standard_message_codec_write_value(FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)

◆ fl_standard_message_codec_init()

static void fl_standard_message_codec_init ( FlStandardMessageCodec *  self)
static

Definition at line 452 of file fl_standard_message_codec.cc.

452 {}

◆ fl_standard_message_codec_new()

G_MODULE_EXPORT FlStandardMessageCodec* fl_standard_message_codec_new ( )

Definition at line 454 of file fl_standard_message_codec.cc.

Referenced by decode_error_value(), decode_message(), encode_message(), fl_standard_method_codec_init(), and TEST().

454  {
455  return static_cast<FlStandardMessageCodec*>(
456  g_object_new(fl_standard_message_codec_get_type(), nullptr));
457 }

◆ fl_standard_message_codec_read_size()

gboolean fl_standard_message_codec_read_size ( FlStandardMessageCodec *  codec,
GBytes *  buffer,
size_t *  offset,
uint32_t *  value,
GError **  error 
)

fl_standard_message_codec_read_size: : an #FlStandardMessageCodec. : buffer to read from. : (inout): read position in . : location to read size. : (allow-none): #GError location to store the error occurring, or NULL.

Reads a size field in Flutter Standard encoding.

Returns: TRUE on success.

Definition at line 473 of file fl_standard_message_codec.cc.

References FALSE, read_uint16(), read_uint32(), read_uint8(), and TRUE.

Referenced by read_float32_list_value(), read_float64_list_value(), read_int32_list_value(), read_int64_list_value(), read_list_value(), read_map_value(), read_string_value(), and read_uint8_list_value().

477  {
478  uint8_t value8;
479  if (!read_uint8(buffer, offset, &value8, error)) {
480  return FALSE;
481  }
482 
483  if (value8 == 255) {
484  if (!read_uint32(buffer, offset, value, error)) {
485  return FALSE;
486  }
487  } else if (value8 == 254) {
488  uint16_t value16;
489  if (!read_uint16(buffer, offset, &value16, error)) {
490  return FALSE;
491  }
492  *value = value16;
493  } else {
494  *value = value8;
495  }
496 
497  return TRUE;
498 }
const uint8_t uint32_t uint32_t GError ** error
static gboolean read_uint16(GBytes *buffer, size_t *offset, uint16_t *value, GError **error)
static gboolean read_uint32(GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
static gboolean read_uint8(GBytes *buffer, size_t *offset, uint8_t *value, GError **error)
uint8_t value
static const uint8_t buffer[]
return FALSE

◆ fl_standard_message_codec_read_value()

FlValue* fl_standard_message_codec_read_value ( FlStandardMessageCodec *  codec,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)

fl_standard_message_codec_read_value: : an #FlStandardMessageCodec. : buffer to read from. : (inout): read position in . : location to read size. : (allow-none): #GError location to store the error occurring, or NULL.

Reads an FlValue in Flutter Standard encoding.

Returns: a new FlValue or NULL on error.

Definition at line 629 of file fl_standard_message_codec.cc.

References FALSE, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE, fl_value_new_bool(), fl_value_new_null(), fl_value_ref(), kValueFalse, kValueFloat32List, kValueFloat64, kValueFloat64List, kValueInt32, kValueInt32List, kValueInt64, kValueInt64List, kValueList, kValueMap, kValueNull, kValueString, kValueTrue, kValueUint8List, read_float32_list_value(), read_float64_list_value(), read_float64_value(), read_int32_list_value(), read_int32_value(), read_int64_list_value(), read_int64_value(), read_list_value(), read_map_value(), read_string_value(), read_uint8(), read_uint8_list_value(), TRUE, type, and value.

Referenced by fl_standard_message_codec_decode_message(), fl_standard_method_codec_decode_method_call(), fl_standard_method_codec_decode_response(), read_list_value(), and read_map_value().

632  {
633  uint8_t type;
634  if (!read_uint8(buffer, offset, &type, error)) {
635  return nullptr;
636  }
637 
638  g_autoptr(FlValue) value = nullptr;
639  if (type == kValueNull) {
640  return fl_value_new_null();
641  } else if (type == kValueTrue) {
642  return fl_value_new_bool(TRUE);
643  } else if (type == kValueFalse) {
644  return fl_value_new_bool(FALSE);
645  } else if (type == kValueInt32) {
646  value = read_int32_value(buffer, offset, error);
647  } else if (type == kValueInt64) {
648  value = read_int64_value(buffer, offset, error);
649  } else if (type == kValueFloat64) {
650  value = read_float64_value(buffer, offset, error);
651  } else if (type == kValueString) {
652  value = read_string_value(self, buffer, offset, error);
653  } else if (type == kValueUint8List) {
654  value = read_uint8_list_value(self, buffer, offset, error);
655  } else if (type == kValueInt32List) {
656  value = read_int32_list_value(self, buffer, offset, error);
657  } else if (type == kValueInt64List) {
658  value = read_int64_list_value(self, buffer, offset, error);
659  } else if (type == kValueFloat32List) {
660  value = read_float32_list_value(self, buffer, offset, error);
661  } else if (type == kValueFloat64List) {
662  value = read_float64_list_value(self, buffer, offset, error);
663  } else if (type == kValueList) {
664  value = read_list_value(self, buffer, offset, error);
665  } else if (type == kValueMap) {
666  value = read_map_value(self, buffer, offset, error);
667  } else {
668  g_set_error(error, FL_MESSAGE_CODEC_ERROR,
670  "Unexpected standard codec type %02x", type);
671  return nullptr;
672  }
673 
674  return value == nullptr ? nullptr : fl_value_ref(value);
675 }
static constexpr int kValueInt32List
KeyCallType type
static constexpr int kValueFloat64List
static constexpr int kValueFalse
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static constexpr int kValueTrue
static constexpr int kValueInt64
static constexpr int kValueFloat64
static constexpr int kValueMap
static FlValue * read_float32_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
#define FL_MESSAGE_CODEC_ERROR
static constexpr int kValueFloat32List
static FlValue * read_float64_value(GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
static FlValue * read_string_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static gboolean read_uint8(GBytes *buffer, size_t *offset, uint8_t *value, GError **error)
static constexpr int kValueString
static constexpr int kValueUint8List
static constexpr int kValueInt32
static constexpr int kValueNull
static constexpr int kValueInt64List
static FlValue * read_int64_value(GBytes *buffer, size_t *offset, GError **error)
uint8_t value
static FlValue * read_int32_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_float64_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_int64_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_uint8_list_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
static constexpr int kValueList
static const uint8_t buffer[]
static FlValue * read_map_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_int32_value(GBytes *buffer, size_t *offset, GError **error)
return FALSE
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:240

◆ fl_standard_message_codec_write_size()

void fl_standard_message_codec_write_size ( FlStandardMessageCodec *  codec,
GByteArray *  buffer,
uint32_t  size 
)

fl_standard_message_codec_write_size: : an #FlStandardMessageCodec. : buffer to write into. : size value to write.

Writes a size field in Flutter Standard encoding.

Definition at line 459 of file fl_standard_message_codec.cc.

References write_uint16(), and write_uint32().

Referenced by fl_standard_message_codec_write_value().

461  {
462  if (size < 254) {
463  write_uint8(buffer, size);
464  } else if (size <= 0xffff) {
465  write_uint8(buffer, 254);
467  } else {
468  write_uint8(buffer, 255);
470  }
471 }
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
static void write_uint32(GByteArray *buffer, uint32_t value)
static void write_uint16(GByteArray *buffer, uint16_t value)
static const uint8_t buffer[]

◆ fl_standard_message_codec_write_value()

gboolean fl_standard_message_codec_write_value ( FlStandardMessageCodec *  codec,
GByteArray *  buffer,
FlValue value,
GError **  error 
)

fl_standard_message_codec_write_value: : an #FlStandardMessageCodec. : buffer to write into. : (allow-none): value to write. : (allow-none): #GError location to store the error occurring, or NULL.

Writes an FlValue in Flutter Standard encoding.

Returns: TRUE on success.

Definition at line 500 of file fl_standard_message_codec.cc.

References FALSE, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE, fl_standard_message_codec_write_size(), fl_standard_message_codec_write_value(), fl_value_get_bool(), fl_value_get_float(), fl_value_get_float32_list(), fl_value_get_float_list(), fl_value_get_int(), fl_value_get_int32_list(), fl_value_get_int64_list(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_map_key(), fl_value_get_map_value(), fl_value_get_string(), fl_value_get_type(), fl_value_get_uint8_list(), FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_FLOAT32_LIST, FL_VALUE_TYPE_FLOAT_LIST, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_INT32_LIST, FL_VALUE_TYPE_INT64_LIST, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, FL_VALUE_TYPE_UINT8_LIST, kValueFalse, kValueFloat32List, kValueFloat64, kValueFloat64List, kValueInt32, kValueInt32List, kValueInt64, kValueInt64List, kValueList, kValueMap, kValueNull, kValueString, kValueTrue, kValueUint8List, length, text, TRUE, write_align(), write_float64(), write_int32(), and write_int64().

Referenced by fl_standard_message_codec_encode_message(), fl_standard_message_codec_write_value(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_method_call(), and fl_standard_method_codec_encode_success_envelope().

503  {
504  if (value == nullptr) {
505  write_uint8(buffer, kValueNull);
506  return TRUE;
507  }
508 
509  switch (fl_value_get_type(value)) {
510  case FL_VALUE_TYPE_NULL:
511  write_uint8(buffer, kValueNull);
512  return TRUE;
513  case FL_VALUE_TYPE_BOOL:
514  if (fl_value_get_bool(value)) {
515  write_uint8(buffer, kValueTrue);
516  } else {
517  write_uint8(buffer, kValueFalse);
518  }
519  return TRUE;
520  case FL_VALUE_TYPE_INT: {
521  int64_t v = fl_value_get_int(value);
522  if (v >= INT32_MIN && v <= INT32_MAX) {
523  write_uint8(buffer, kValueInt32);
524  write_int32(buffer, v);
525  } else {
526  write_uint8(buffer, kValueInt64);
527  write_int64(buffer, v);
528  }
529  return TRUE;
530  }
531  case FL_VALUE_TYPE_FLOAT:
532  write_uint8(buffer, kValueFloat64);
533  write_align(buffer, 8);
535  return TRUE;
536  case FL_VALUE_TYPE_STRING: {
537  write_uint8(buffer, kValueString);
538  const char* text = fl_value_get_string(value);
539  size_t length = strlen(text);
541  g_byte_array_append(buffer, reinterpret_cast<const uint8_t*>(text),
542  length);
543  return TRUE;
544  }
546  write_uint8(buffer, kValueUint8List);
547  size_t length = fl_value_get_length(value);
549  g_byte_array_append(buffer, fl_value_get_uint8_list(value),
550  sizeof(uint8_t) * length);
551  return TRUE;
552  }
554  write_uint8(buffer, kValueInt32List);
555  size_t length = fl_value_get_length(value);
557  write_align(buffer, 4);
558  g_byte_array_append(
559  buffer,
560  reinterpret_cast<const uint8_t*>(fl_value_get_int32_list(value)),
561  sizeof(int32_t) * length);
562  return TRUE;
563  }
565  write_uint8(buffer, kValueInt64List);
566  size_t length = fl_value_get_length(value);
568  write_align(buffer, 8);
569  g_byte_array_append(
570  buffer,
571  reinterpret_cast<const uint8_t*>(fl_value_get_int64_list(value)),
572  sizeof(int64_t) * length);
573  return TRUE;
574  }
576  write_uint8(buffer, kValueFloat32List);
577  size_t length = fl_value_get_length(value);
579  write_align(buffer, 4);
580  g_byte_array_append(
581  buffer,
582  reinterpret_cast<const uint8_t*>(fl_value_get_float32_list(value)),
583  sizeof(float) * length);
584  return TRUE;
585  }
587  write_uint8(buffer, kValueFloat64List);
588  size_t length = fl_value_get_length(value);
590  write_align(buffer, 8);
591  g_byte_array_append(
592  buffer,
593  reinterpret_cast<const uint8_t*>(fl_value_get_float_list(value)),
594  sizeof(double) * length);
595  return TRUE;
596  }
597  case FL_VALUE_TYPE_LIST:
598  write_uint8(buffer, kValueList);
601  for (size_t i = 0; i < fl_value_get_length(value); i++) {
603  self, buffer, fl_value_get_list_value(value, i), error)) {
604  return FALSE;
605  }
606  }
607  return TRUE;
608  case FL_VALUE_TYPE_MAP:
609  write_uint8(buffer, kValueMap);
612  for (size_t i = 0; i < fl_value_get_length(value); i++) {
614  self, buffer, fl_value_get_map_key(value, i), error) ||
616  self, buffer, fl_value_get_map_value(value, i), error)) {
617  return FALSE;
618  }
619  }
620  return TRUE;
621  }
622 
623  g_set_error(error, FL_MESSAGE_CODEC_ERROR,
625  "Unexpected FlValue type %d", fl_value_get_type(value));
626  return FALSE;
627 }
static constexpr int kValueInt32List
static constexpr int kValueFloat64List
G_MODULE_EXPORT const float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:670
static constexpr int kValueFalse
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static void write_align(GByteArray *buffer, guint align)
static void write_float64(GByteArray *buffer, double value)
static constexpr int kValueTrue
static constexpr int kValueInt64
static constexpr int kValueFloat64
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:677
static constexpr int kValueMap
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
void fl_standard_message_codec_write_size(FlStandardMessageCodec *codec, GByteArray *buffer, uint32_t size)
#define FL_MESSAGE_CODEC_ERROR
static void write_int64(GByteArray *buffer, int64_t value)
static constexpr int kValueFloat32List
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:663
static constexpr int kValueString
static constexpr int kValueUint8List
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:649
static constexpr int kValueInt32
static constexpr int kValueNull
static constexpr int kValueInt64List
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:735
size_t length
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:751
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:743
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:656
static constexpr int kValueList
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
std::u16string text
static const uint8_t buffer[]
return FALSE
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
static void write_int32(GByteArray *buffer, int32_t value)
gboolean fl_standard_message_codec_write_value(FlStandardMessageCodec *self, GByteArray *buffer, FlValue *value, GError **error)
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:621

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( FlStandardMessageCodec  ,
fl_standard_message_codec  ,
fl_message_codec_get_type()   
)

◆ get_data()

static const uint8_t* get_data ( GBytes *  buffer,
size_t *  offset 
)
static

Definition at line 109 of file fl_standard_message_codec.cc.

Referenced by read_float32_list_value(), read_float64_list_value(), read_float64_value(), read_int32_list_value(), read_int32_value(), read_int64_list_value(), read_int64_value(), read_string_value(), read_uint16(), read_uint32(), read_uint8(), and read_uint8_list_value().

109  {
110  return static_cast<const uint8_t*>(g_bytes_get_data(buffer, nullptr)) +
111  *offset;
112 }
static const uint8_t buffer[]

◆ read_align()

static gboolean read_align ( GBytes *  buffer,
size_t *  offset,
size_t  align,
GError **  error 
)
static

Definition at line 91 of file fl_standard_message_codec.cc.

References check_size(), FALSE, and TRUE.

Referenced by read_float32_list_value(), read_float64_list_value(), read_float64_value(), read_int32_list_value(), and read_int64_list_value().

94  {
95  if ((*offset) % align == 0) {
96  return TRUE;
97  }
98 
99  size_t required = align - (*offset) % align;
100  if (!check_size(buffer, *offset, required, error)) {
101  return FALSE;
102  }
103 
104  (*offset) += required;
105  return TRUE;
106 }
const uint8_t uint32_t uint32_t GError ** error
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t buffer[]
return FALSE

◆ read_float32_list_value()

static FlValue* read_float32_list_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 302 of file fl_standard_message_codec.cc.

References check_size(), fl_standard_message_codec_read_size(), fl_value_new_float32_list(), get_data(), length, read_align(), and value.

Referenced by fl_standard_message_codec_read_value().

305  {
306  uint32_t length;
307  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
308  error)) {
309  return nullptr;
310  }
311  if (!read_align(buffer, offset, 4, error)) {
312  return nullptr;
313  }
314  if (!check_size(buffer, *offset, sizeof(float) * length, error)) {
315  return nullptr;
316  }
318  reinterpret_cast<const float*>(get_data(buffer, offset)), length);
319  *offset += sizeof(float) * length;
320  return value;
321 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
Definition: fl_value.cc:318
size_t length
static const uint8_t buffer[]

◆ read_float64_list_value()

static FlValue* read_float64_list_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 326 of file fl_standard_message_codec.cc.

References check_size(), fl_standard_message_codec_read_size(), fl_value_new_float_list(), get_data(), length, read_align(), and value.

Referenced by fl_standard_message_codec_read_value().

329  {
330  uint32_t length;
331  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
332  error)) {
333  return nullptr;
334  }
335  if (!read_align(buffer, offset, 8, error)) {
336  return nullptr;
337  }
338  if (!check_size(buffer, *offset, sizeof(double) * length, error)) {
339  return nullptr;
340  }
342  reinterpret_cast<const double*>(get_data(buffer, offset)), length);
343  *offset += sizeof(double) * length;
344  return value;
345 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
size_t length
static const uint8_t buffer[]
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:328

◆ read_float64_value()

static FlValue* read_float64_value ( GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 194 of file fl_standard_message_codec.cc.

References check_size(), fl_value_new_float(), get_data(), read_align(), and value.

Referenced by fl_standard_message_codec_read_value().

196  {
197  if (!read_align(buffer, offset, 8, error)) {
198  return nullptr;
199  }
200  if (!check_size(buffer, *offset, sizeof(double), error)) {
201  return nullptr;
202  }
203 
205  reinterpret_cast<const double*>(get_data(buffer, offset))[0]);
206  *offset += sizeof(double);
207  return value;
208 }
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:258
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
static const uint8_t buffer[]

◆ read_int32_list_value()

static FlValue* read_int32_list_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 254 of file fl_standard_message_codec.cc.

References check_size(), fl_standard_message_codec_read_size(), fl_value_new_int32_list(), get_data(), length, read_align(), and value.

Referenced by fl_standard_message_codec_read_value().

257  {
258  uint32_t length;
259  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
260  error)) {
261  return nullptr;
262  }
263  if (!read_align(buffer, offset, 4, error)) {
264  return nullptr;
265  }
266  if (!check_size(buffer, *offset, sizeof(int32_t) * length, error)) {
267  return nullptr;
268  }
270  reinterpret_cast<const int32_t*>(get_data(buffer, offset)), length);
271  *offset += sizeof(int32_t) * length;
272  return value;
273 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:298
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
size_t length
static const uint8_t buffer[]

◆ read_int32_value()

static FlValue* read_int32_value ( GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 162 of file fl_standard_message_codec.cc.

References check_size(), fl_value_new_int(), get_data(), and value.

Referenced by fl_standard_message_codec_read_value().

164  {
165  if (!check_size(buffer, *offset, sizeof(int32_t), error)) {
166  return nullptr;
167  }
168 
170  reinterpret_cast<const int32_t*>(get_data(buffer, offset))[0]);
171  *offset += sizeof(int32_t);
172  return value;
173 }
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
static const uint8_t buffer[]

◆ read_int64_list_value()

static FlValue* read_int64_list_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 278 of file fl_standard_message_codec.cc.

References check_size(), fl_standard_message_codec_read_size(), fl_value_new_int64_list(), get_data(), length, read_align(), and value.

Referenced by fl_standard_message_codec_read_value().

281  {
282  uint32_t length;
283  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
284  error)) {
285  return nullptr;
286  }
287  if (!read_align(buffer, offset, 8, error)) {
288  return nullptr;
289  }
290  if (!check_size(buffer, *offset, sizeof(int64_t) * length, error)) {
291  return nullptr;
292  }
294  reinterpret_cast<const int64_t*>(get_data(buffer, offset)), length);
295  *offset += sizeof(int64_t) * length;
296  return value;
297 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:308
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static gboolean read_align(GBytes *buffer, size_t *offset, size_t align, GError **error)
size_t length
static const uint8_t buffer[]

◆ read_int64_value()

static FlValue* read_int64_value ( GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 178 of file fl_standard_message_codec.cc.

References check_size(), fl_value_new_int(), get_data(), and value.

Referenced by fl_standard_message_codec_read_value().

180  {
181  if (!check_size(buffer, *offset, sizeof(int64_t), error)) {
182  return nullptr;
183  }
184 
186  reinterpret_cast<const int64_t*>(get_data(buffer, offset))[0]);
187  *offset += sizeof(int64_t);
188  return value;
189 }
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
static const uint8_t buffer[]

◆ read_list_value()

static FlValue* read_list_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 350 of file fl_standard_message_codec.cc.

References fl_standard_message_codec_read_size(), fl_standard_message_codec_read_value(), fl_value_append(), fl_value_new_list(), fl_value_ref(), and length.

Referenced by fl_standard_message_codec_read_value().

353  {
354  uint32_t length;
355  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
356  error)) {
357  return nullptr;
358  }
359 
360  g_autoptr(FlValue) list = fl_value_new_list();
361  for (size_t i = 0; i < length; i++) {
362  g_autoptr(FlValue) child =
364  if (child == nullptr) {
365  return nullptr;
366  }
367  fl_value_append(list, child);
368  }
369 
370  return fl_value_ref(list);
371 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:552
size_t length
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
static const uint8_t buffer[]
FlValue * fl_standard_message_codec_read_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)

◆ read_map_value()

static FlValue* read_map_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 376 of file fl_standard_message_codec.cc.

References fl_standard_message_codec_read_size(), fl_standard_message_codec_read_value(), fl_value_new_map(), fl_value_ref(), fl_value_set(), key, length, and value.

Referenced by fl_standard_message_codec_read_value().

379  {
380  uint32_t length;
381  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
382  error)) {
383  return nullptr;
384  }
385 
386  g_autoptr(FlValue) map = fl_value_new_map();
387  for (size_t i = 0; i < length; i++) {
388  g_autoptr(FlValue) key =
390  if (key == nullptr) {
391  return nullptr;
392  }
393  g_autoptr(FlValue) value =
395  if (value == nullptr) {
396  return nullptr;
397  }
398  fl_value_set(map, key, value);
399  }
400 
401  return fl_value_ref(map);
402 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT void fl_value_set(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:569
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
uint8_t value
size_t length
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
static const uint8_t buffer[]
FlValue * fl_standard_message_codec_read_value(FlStandardMessageCodec *self, GBytes *buffer, size_t *offset, GError **error)

◆ read_string_value()

static FlValue* read_string_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 213 of file fl_standard_message_codec.cc.

References check_size(), fl_standard_message_codec_read_size(), fl_value_new_string_sized(), get_data(), length, and value.

Referenced by fl_standard_message_codec_read_value().

216  {
217  uint32_t length;
218  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
219  error)) {
220  return nullptr;
221  }
222  if (!check_size(buffer, *offset, length, error)) {
223  return nullptr;
224  }
226  reinterpret_cast<const gchar*>(get_data(buffer, offset)), length);
227  *offset += length;
228  return value;
229 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
size_t length
static const uint8_t buffer[]
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:272

◆ read_uint16()

static gboolean read_uint16 ( GBytes *  buffer,
size_t *  offset,
uint16_t *  value,
GError **  error 
)
static

Definition at line 131 of file fl_standard_message_codec.cc.

References check_size(), FALSE, get_data(), and TRUE.

Referenced by fl_standard_message_codec_read_size().

134  {
135  if (!check_size(buffer, *offset, sizeof(uint16_t), error)) {
136  return FALSE;
137  }
138 
139  *value = reinterpret_cast<const uint16_t*>(get_data(buffer, offset))[0];
140  *offset += sizeof(uint16_t);
141  return TRUE;
142 }
const uint8_t uint32_t uint32_t GError ** error
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static const uint8_t buffer[]
return FALSE

◆ read_uint32()

static gboolean read_uint32 ( GBytes *  buffer,
size_t *  offset,
uint32_t *  value,
GError **  error 
)
static

Definition at line 146 of file fl_standard_message_codec.cc.

References check_size(), FALSE, get_data(), and TRUE.

Referenced by fl_standard_message_codec_read_size().

149  {
150  if (!check_size(buffer, *offset, sizeof(uint32_t), error)) {
151  return FALSE;
152  }
153 
154  *value = reinterpret_cast<const uint32_t*>(get_data(buffer, offset))[0];
155  *offset += sizeof(uint32_t);
156  return TRUE;
157 }
const uint8_t uint32_t uint32_t GError ** error
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static const uint8_t buffer[]
return FALSE

◆ read_uint8()

static gboolean read_uint8 ( GBytes *  buffer,
size_t *  offset,
uint8_t *  value,
GError **  error 
)
static

Definition at line 116 of file fl_standard_message_codec.cc.

References check_size(), FALSE, get_data(), and TRUE.

Referenced by fl_standard_message_codec_read_size(), and fl_standard_message_codec_read_value().

119  {
120  if (!check_size(buffer, *offset, sizeof(uint8_t), error)) {
121  return FALSE;
122  }
123 
124  *value = get_data(buffer, offset)[0];
125  (*offset)++;
126  return TRUE;
127 }
const uint8_t uint32_t uint32_t GError ** error
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
static const uint8_t buffer[]
return FALSE

◆ read_uint8_list_value()

static FlValue* read_uint8_list_value ( FlStandardMessageCodec *  self,
GBytes *  buffer,
size_t *  offset,
GError **  error 
)
static

Definition at line 234 of file fl_standard_message_codec.cc.

References check_size(), fl_standard_message_codec_read_size(), fl_value_new_uint8_list(), get_data(), length, and value.

Referenced by fl_standard_message_codec_read_value().

237  {
238  uint32_t length;
239  if (!fl_standard_message_codec_read_size(self, buffer, offset, &length,
240  error)) {
241  return nullptr;
242  }
243  if (!check_size(buffer, *offset, sizeof(uint8_t) * length, error)) {
244  return nullptr;
245  }
246  FlValue* value = fl_value_new_uint8_list(get_data(buffer, offset), length);
247  *offset += length;
248  return value;
249 }
gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:281
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gboolean check_size(GBytes *buffer, size_t offset, size_t required, GError **error)
static const uint8_t * get_data(GBytes *buffer, size_t *offset)
uint8_t value
size_t length
static const uint8_t buffer[]

◆ write_align()

static void write_align ( GByteArray *  buffer,
guint  align 
)
static

Definition at line 71 of file fl_standard_message_codec.cc.

Referenced by fl_standard_message_codec_write_value().

71  {
72  while (buffer->len % align != 0) {
73  write_uint8(buffer, 0);
74  }
75 }
static const uint8_t buffer[]

◆ write_float64()

static void write_float64 ( GByteArray *  buffer,
double  value 
)
static

Definition at line 65 of file fl_standard_message_codec.cc.

Referenced by fl_standard_message_codec_write_value().

65  {
66  g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
67  sizeof(double));
68 }
uint8_t value
static const uint8_t buffer[]

◆ write_int32()

static void write_int32 ( GByteArray *  buffer,
int32_t  value 
)
static

Definition at line 55 of file fl_standard_message_codec.cc.

Referenced by fl_standard_message_codec_write_value().

55  {
56  g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
57  sizeof(int32_t));
58 }
uint8_t value
static const uint8_t buffer[]

◆ write_int64()

static void write_int64 ( GByteArray *  buffer,
int64_t  value 
)
static

Definition at line 60 of file fl_standard_message_codec.cc.

Referenced by fl_standard_message_codec_write_value().

60  {
61  g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
62  sizeof(int64_t));
63 }
uint8_t value
static const uint8_t buffer[]

◆ write_uint16()

static void write_uint16 ( GByteArray *  buffer,
uint16_t  value 
)
static

Definition at line 45 of file fl_standard_message_codec.cc.

Referenced by fl_standard_message_codec_write_size().

45  {
46  g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
47  sizeof(uint16_t));
48 }
uint8_t value
static const uint8_t buffer[]

◆ write_uint32()

static void write_uint32 ( GByteArray *  buffer,
uint32_t  value 
)
static

Definition at line 50 of file fl_standard_message_codec.cc.

Referenced by fl_standard_message_codec_write_size().

50  {
51  g_byte_array_append(buffer, reinterpret_cast<uint8_t*>(&value),
52  sizeof(uint32_t));
53 }
uint8_t value
static const uint8_t buffer[]

Variable Documentation

◆ kValueFalse

constexpr int kValueFalse = 2
static

◆ kValueFloat32List

constexpr int kValueFloat32List = 14
static

◆ kValueFloat64

constexpr int kValueFloat64 = 6
static

◆ kValueFloat64List

constexpr int kValueFloat64List = 11
static

◆ kValueInt32

constexpr int kValueInt32 = 3
static

◆ kValueInt32List

constexpr int kValueInt32List = 9
static

◆ kValueInt64

constexpr int kValueInt64 = 4
static

◆ kValueInt64List

constexpr int kValueInt64List = 10
static

◆ kValueList

constexpr int kValueList = 12
static

◆ kValueMap

constexpr int kValueMap = 13
static

◆ kValueNull

constexpr int kValueNull = 0
static

◆ kValueString

constexpr int kValueString = 7
static

◆ kValueTrue

constexpr int kValueTrue = 1
static

◆ kValueUint8List

constexpr int kValueUint8List = 8
static

◆ value

uint8_t value
Initial value:
{
g_byte_array_append(buffer, &value, sizeof(uint8_t))
uint8_t value
static const uint8_t buffer[]

Definition at line 41 of file fl_standard_message_codec.cc.

Referenced by base::internal::SaturateFastAsmOp< Dst, Src >::__attribute__(), base::internal::ClampedNegFastOp< T >::__attribute__(), base::internal::AbsWrapper(), flutter::CounterValues::Add(), FlValueHandler::add(), ui::AXPlatformNodeBase::AddAttributeToList(), base::internal::NarrowingRange< Dst, Src, Bounds >::Adjust(), flutter::PersistentCache::cache_sksl(), cancel_channel(), base::internal::checked_cast(), base::internal::CheckedAddImpl(), base::internal::CheckedMulImpl(), base::internal::CheckedNumericState< T, NUMERIC_INTEGER >::CheckedNumericState(), base::internal::CheckedSubImpl(), checkEncodeDecode(), base::ClampCeil(), base::internal::ClampedNumeric< T >::ClampedNumeric(), base::ClampFloor(), FlutterStandardMessageCodec::codecWithReaderWriter:, ui::AXPosition< AXNodePosition, AXNode >::CompareTo(), ui::AXPlatformNodeBase::ComputeAttributes(), base::internal::ConditionalNegate(), base::Contains(), flutter::SemanticsUpdateBuilder::create(), tonic::CreateZeroInitializedDartObject(), decode_error_message(), decode_error_value(), decode_message(), flutter::JsonMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), flutter::decodeFontFeatures(), flutter::ServiceProtocol::Handler::Description::Description(), AXPlatformNodeCocoa::detach, flutter::RuntimeController::DispatchSemanticsAction(), base::internal::CheckedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::IsValueInRangeFastOp< Dst, Src, typename std::enable_if< std::is_integral< Dst >::value &&std::is_integral< Src >::value &&std::is_signed< Dst >::value &&std::is_signed< Src >::value &&!IsTypeInRangeForNumericType< Dst, Src >::value >::type >::Do(), base::internal::ClampedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::ClampedNegFastOp< T >::Do(), base::internal::ClampedSubOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::CheckedSubOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::SaturateFastOp< Dst, Src, typename std::enable_if< std::is_integral< Src >::value &&std::is_integral< Dst >::value &&!SaturateFastAsmOp< Dst, Src >::is_supported >::type >::Do(), base::internal::ClampedLshOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::CheckedDivOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::ClampedRshOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::CheckedModOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::CheckedLshOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::DstRangeRelationToSrcRange(), echo_response_cb(), fl_json_message_codec_decode(), fl_json_message_codec_decode_message(), fl_json_method_codec_decode_method_call(), fl_json_method_codec_decode_response(), fl_standard_message_codec_decode_message(), fl_standard_message_codec_read_value(), fl_value_lookup_string(), fl_value_new_float(), fl_value_new_int(), fl_value_new_list_from_strv(), fl_value_set_take(), FlutterEngineInitialize(), flutter_runner::FocusDelegate::FocusDelegate(), tonic::DartConverter< flutter::RRect >::FromArguments(), flutter::Shell::GetDartVM(), ui::TestAXNodeWrapper::GetIndexInParent(), ui::AXPlatformNodeDelegateBase::GetInnerText(), ui::AXNode::GetInnerText(), flutter::AndroidShellHolder::GetPlatformMessageHandler(), ui::AXPlatformNodeBase::GetRangeValueText(), flutter::Engine::GetRuntimeController(), flutter::RuntimeController::GetSnapshotDelegate(), flutter::GetSwitchValue(), ui::AXPlatformNodeBase::GetValue(), flutter_runner::FocusDelegate::HandlePlatformMessage(), hex_string_to_bytes(), initialize_logical_key_to_lock_bit_loop_body(), FlutterViewController::initWithCoder:, FlutterEngineRegistrar::initWithPlugin:flutterEngine:, base::win::VariantVector::Insert(), base::internal::InvertWrapper(), base::IsApproximatelyEqual(), base::internal::IsValueInRangeForNumericType(), base::internal::IsValueNegative(), listen_channel(), tonic::LookupNonNullableType(), base::internal::NarrowingRange< Dst, Src, Bounds >::lowest(), base::internal::MakeCheckedNum(), base::internal::MakeClampedNum(), base::internal::MakeStrictNum(), base::internal::ClampedNumeric< T >::MathOp(), base::internal::CheckedNumeric< T >::MathOp(), base::internal::ClampedNumeric< T >::Max(), ui::AXNodePosition::MaxTextOffset(), base::internal::ClampedNumeric< T >::Min(), android::move_backward_type(), android::move_forward_type(), base::internal::NegateWrapper(), SemanticsObject::onCustomAccessibilityAction:, fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits >::operator!=(), base::internal::ClampedNumeric< T >::operator++(), base::internal::CheckedNumeric< T >::operator++(), base::internal::ClampedNumeric< T >::operator--(), base::internal::CheckedNumeric< T >::operator--(), base::internal::operator<<(), fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits >::operator==(), ParseCodepoint(), flutter::GamepadWinUWP::Process(), base::win::internal::VariantUtil< ElementVartype >::RawSet(), base::internal::ClampedNumeric< T >::RawValue(), read_float32_list_value(), read_float64_list_value(), read_float64_value(), read_int32_list_value(), read_int32_value(), read_int64_list_value(), read_int64_value(), read_map_value(), read_string_value(), read_uint8_list_value(), FlutterStandardReader::readByte, flutter::ByteStreamReader::ReadDouble(), flutter::ByteStreamReader::ReadInt32(), flutter::ByteStreamReader::ReadInt64(), flutter::StandardCodecSerializer::ReadSize(), FlutterStandardReader::readSize, flutter::StandardCodecSerializer::ReadValueOfType(), FlutterStandardReader::readValueOfType:, flutter::AssetManagerFontProvider::RegisterAsset(), txt::TypefaceFontAssetProvider::RegisterTypeface(), fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits >::reset(), FlutterEngine::run, base::internal::SafeCompare(), base::internal::SafeUnsignedAbs(), base::internal::saturated_cast(), base::internal::saturated_cast_impl(), base::internal::SaturatedAbsWrapper(), base::internal::SaturatedNegWrapper(), base::win::ScopedVariant::ScopedVariant(), flutter::FrameTiming::Set(), flutter::Layer::set_subtree_has_platform_view(), flutter::PersistentCache::SetAssetManager(), flutter::PersistentCache::SetCacheSkSL(), flutter::DartIsolateGroupData::SetChildIsolatePreparer(), txt::FontFeatures::SetFeature(), flutter::PersistentCache::SetIsDumpingSkp(), ui::TestAXNodeWrapper::SetScaleFactor(), flutter_runner::AccessibilityBridge::SetSemanticsEnabled(), fml::SyncSwitch::SetSwitch(), base::internal::strict_cast(), synchronize_lock_states_loop_body(), synchronize_pressed_states_loop_body(), flutter::TEST(), gfx::TEST(), fml::testing::TEST(), TEST(), flutter::testing::TEST(), flutter::testing::TEST_F(), ui::TEST_F(), tonic::ToDartTypeHandle(), ui::AXNodeData::ToString(), fml::tracing::TraceToString(), update_editing_state(), flutter::SemanticsUpdateBuilder::updateNode(), flutter::PlatformViewAndroidDelegate::UpdateSemantics(), flutter::StandardCodecSerializer::WriteSize(), FlutterStandardWriter::writeSize:, flutter::StandardCodecSerializer::WriteValue(), flutter::PointExtensionSerializer::WriteValue(), flutter::SomeDataExtensionSerializer::WriteValue(), FlutterStandardWriter::writeValue:, zircon_dart_byte_array_set_value(), _FlutterTaskRunner::~_FlutterTaskRunner(), and android::OnEntryRemoved< TKey, TValue >::~OnEntryRemoved().