libobs/util: Use int64_t as return for serializer
Intended as a means of expressing an error occurred (-1) when performing a seek or getting a position.
This commit is contained in:
parent
af11984314
commit
8c1fb99e99
@ -24,10 +24,10 @@ static size_t array_output_write(void *param, const void *data, size_t size)
|
||||
return size;
|
||||
}
|
||||
|
||||
static uint64_t array_output_get_pos(void *param)
|
||||
static int64_t array_output_get_pos(void *param)
|
||||
{
|
||||
struct array_output_data *data = param;
|
||||
return data->bytes.num;
|
||||
return (int64_t)data->bytes.num;
|
||||
}
|
||||
|
||||
void array_output_serializer_init(struct serializer *s,
|
||||
|
@ -38,8 +38,8 @@ struct serializer {
|
||||
|
||||
size_t (*read)(void *, void *, size_t);
|
||||
size_t (*write)(void *, const void *, size_t);
|
||||
uint64_t (*seek)(void *, int64_t, enum serialize_seek_type);
|
||||
uint64_t (*get_pos)(void *);
|
||||
int64_t (*seek)(void *, int64_t, enum serialize_seek_type);
|
||||
int64_t (*get_pos)(void *);
|
||||
};
|
||||
|
||||
static inline size_t s_read(struct serializer *s, void *data, size_t size)
|
||||
@ -69,19 +69,19 @@ static inline size_t serialize(struct serializer *s, void *data, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline uint64_t serializer_seek(struct serializer *s, int64_t offset,
|
||||
static inline int64_t serializer_seek(struct serializer *s, int64_t offset,
|
||||
enum serialize_seek_type seek_type)
|
||||
{
|
||||
if (s && s->seek)
|
||||
return s->seek(s->data, offset, seek_type);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline uint64_t serializer_get_pos(struct serializer *s)
|
||||
static inline int64_t serializer_get_pos(struct serializer *s)
|
||||
{
|
||||
if (s && s->get_pos)
|
||||
return s->get_pos(s->data);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* formatted this to be similar to the AVIO layout that ffmpeg uses */
|
||||
|
Loading…
x
Reference in New Issue
Block a user