Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions src/lib_ccx/matroska.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ void parse_ebml(FILE *file)

printf("\n");

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand Down Expand Up @@ -165,7 +166,7 @@ void parse_ebml(FILE *file)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand All @@ -183,7 +184,8 @@ void parse_segment_info(FILE *file)
ULLONG len = read_vint_length(file);
ULLONG pos = get_current_byte(file);

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand Down Expand Up @@ -264,7 +266,7 @@ void parse_segment_info(FILE *file)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand Down Expand Up @@ -484,7 +486,8 @@ void parse_segment_cluster_block_group(struct matroska_ctx *mkv_ctx, ULLONG clus
struct matroska_sub_sentence **sentence_list = NULL;
int sentence_count = 0;

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand Down Expand Up @@ -546,7 +549,7 @@ void parse_segment_cluster_block_group(struct matroska_ctx *mkv_ctx, ULLONG clus
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand Down Expand Up @@ -614,7 +617,8 @@ void parse_segment_cluster(struct matroska_ctx *mkv_ctx)

ULLONG timecode = 0;

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand Down Expand Up @@ -659,7 +663,7 @@ void parse_segment_cluster(struct matroska_ctx *mkv_ctx)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand Down Expand Up @@ -890,7 +894,8 @@ void parse_segment_track_entry(struct matroska_ctx *mkv_ctx)
char *codec_id_string = NULL;
enum matroska_track_subtitle_codec_id codec_id = MATROSKA_TRACK_SUBTITLE_CODEC_ID_UTF8;

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand Down Expand Up @@ -1007,12 +1012,12 @@ void parse_segment_track_entry(struct matroska_ctx *mkv_ctx)

/* Deprecated IDs */
case MATROSKA_SEGMENT_TRACK_TRACK_TIMECODE_SCALE:
mprint(MATROSKA_WARNING "Deprecated element 0x%x at position " LLD "\n", code,
mprint(MATROSKA_WARNING "Deprecated element 0x%" PRIx32 " at position " LLD "\n", code,
get_current_byte(file) - 3); // minus length of the ID
read_vint_block_skip(file);
MATROSKA_SWITCH_BREAK(code, code_len);
case MATROSKA_SEGMENT_TRACK_TRACK_OFFSET:
mprint(MATROSKA_WARNING "Deprecated element 0x%x at position " LLD "\n", code,
mprint(MATROSKA_WARNING "Deprecated element 0x%" PRIx32 " at position " LLD "\n", code,
get_current_byte(file) - 2); // minus length of the ID
read_vint_block_skip(file);
MATROSKA_SWITCH_BREAK(code, code_len);
Expand Down Expand Up @@ -1047,7 +1052,7 @@ void parse_segment_track_entry(struct matroska_ctx *mkv_ctx)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand Down Expand Up @@ -1224,7 +1229,8 @@ void parse_segment_tracks(struct matroska_ctx *mkv_ctx)
ULLONG len = read_vint_length(file);
ULLONG pos = get_current_byte(file);

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand All @@ -1251,7 +1257,7 @@ void parse_segment_tracks(struct matroska_ctx *mkv_ctx)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand All @@ -1270,7 +1276,8 @@ void parse_segment(struct matroska_ctx *mkv_ctx)
ULLONG len = read_vint_length(file);
ULLONG pos = get_current_byte(file);

int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;
while (pos + len > get_current_byte(file))
{
code <<= 8;
Expand Down Expand Up @@ -1317,7 +1324,7 @@ void parse_segment(struct matroska_ctx *mkv_ctx)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand Down Expand Up @@ -1959,7 +1966,8 @@ void matroska_free_all(struct matroska_ctx *mkv_ctx)

void matroska_parse(struct matroska_ctx *mkv_ctx)
{
int code = 0, code_len = 0;
uint32_t code = 0;
int code_len = 0;

mprint("\n");

Expand Down Expand Up @@ -1993,7 +2001,7 @@ void matroska_parse(struct matroska_ctx *mkv_ctx)
default:
if (code_len == MATROSKA_MAX_ID_LENGTH)
{
mprint(MATROSKA_WARNING "Unknown element 0x%x at position " LLD ", skipping this element\n", code,
mprint(MATROSKA_WARNING "Unknown element 0x%" PRIx32 " at position " LLD ", skipping this element\n", code,
get_current_byte(file) - MATROSKA_MAX_ID_LENGTH);
// Skip just the unknown element, not the entire block
read_vint_block_skip(file);
Expand Down
Loading