mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-31 04:43:06 +02:00
gistructinfo: Use proper types for offset lookup
This is a private function so we can just use the expected types. Also this avoids a signed/unsigned conversion.
This commit is contained in:
parent
19476db825
commit
13791b47f6
@ -72,16 +72,16 @@ gi_struct_info_get_n_fields (GIStructInfo *info)
|
|||||||
* Returns: field offset, in bytes
|
* Returns: field offset, in bytes
|
||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
static int32_t
|
static size_t
|
||||||
gi_struct_get_field_offset (GIStructInfo *info,
|
gi_struct_get_field_offset (GIStructInfo *info,
|
||||||
unsigned int n)
|
uint16_t n)
|
||||||
{
|
{
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
Header *header = (Header *)rinfo->typelib->data;
|
Header *header = (Header *)rinfo->typelib->data;
|
||||||
uint32_t offset = rinfo->offset + header->struct_blob_size;
|
size_t offset = rinfo->offset + header->struct_blob_size;
|
||||||
FieldBlob *field_blob;
|
FieldBlob *field_blob;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < n; i++)
|
for (uint16_t i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
||||||
offset += header->field_blob_size;
|
offset += header->field_blob_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user