Resolve unnecessary_cast lints

This commit is contained in:
David Tolnay 2022-07-07 17:10:53 -07:00
parent 501b058987
commit 7f726a96a4
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
10 changed files with 5220 additions and 6486 deletions

File diff suppressed because it is too large Load diff

View file

@ -44,14 +44,14 @@ unsafe fn unsafe_main() -> ExitCode {
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let version_directive: *mut yaml_version_directive_t = let version_directive: *mut yaml_version_directive_t =
ptr::null_mut::<yaml_version_directive_t>(); ptr::null_mut::<yaml_version_directive_t>();
let canonical: libc::c_int = 0 as libc::c_int; let canonical: libc::c_int = 0_i32;
let unicode: libc::c_int = 0 as libc::c_int; let unicode: libc::c_int = 0_i32;
let mut buf = ReadBuf::new(); let mut buf = ReadBuf::new();
let mut foundfile: libc::c_int = 0 as libc::c_int; let mut foundfile: libc::c_int = 0_i32;
for arg in env::args().skip(1) { for arg in env::args().skip(1) {
if foundfile == 0 { if foundfile == 0 {
input = File::open(arg).ok(); input = File::open(arg).ok();
foundfile = 1 as libc::c_int; foundfile = 1_i32;
} }
} }
let input = input.unwrap_or_else(|| __assert!(false)); let input = input.unwrap_or_else(|| __assert!(false));
@ -92,28 +92,28 @@ unsafe fn unsafe_main() -> ExitCode {
if strncmp( if strncmp(
line, line,
b"+STR\0" as *const u8 as *const libc::c_char, b"+STR\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
ok = yaml_stream_start_event_initialize(event, YAML_UTF8_ENCODING); ok = yaml_stream_start_event_initialize(event, YAML_UTF8_ENCODING);
} else if strncmp( } else if strncmp(
line, line,
b"-STR\0" as *const u8 as *const libc::c_char, b"-STR\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
ok = yaml_stream_end_event_initialize(event); ok = yaml_stream_end_event_initialize(event);
} else if strncmp( } else if strncmp(
line, line,
b"+DOC\0" as *const u8 as *const libc::c_char, b"+DOC\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
implicit = (strncmp( implicit = (strncmp(
line.offset(4 as libc::c_int as isize), line.offset(4_i32 as isize),
b" ---\0" as *const u8 as *const libc::c_char, b" ---\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) != 0 as libc::c_int) as libc::c_int; ) != 0_i32) as libc::c_int;
ok = yaml_document_start_event_initialize( ok = yaml_document_start_event_initialize(
event, event,
version_directive, version_directive,
@ -124,20 +124,20 @@ unsafe fn unsafe_main() -> ExitCode {
} else if strncmp( } else if strncmp(
line, line,
b"-DOC\0" as *const u8 as *const libc::c_char, b"-DOC\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
implicit = (strncmp( implicit = (strncmp(
line.offset(4 as libc::c_int as isize), line.offset(4_i32 as isize),
b" ...\0" as *const u8 as *const libc::c_char, b" ...\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) != 0 as libc::c_int) as libc::c_int; ) != 0_i32) as libc::c_int;
ok = yaml_document_end_event_initialize(event, implicit); ok = yaml_document_end_event_initialize(event, implicit);
} else if strncmp( } else if strncmp(
line, line,
b"+MAP\0" as *const u8 as *const libc::c_char, b"+MAP\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
style = YAML_BLOCK_MAPPING_STYLE as libc::c_int; style = YAML_BLOCK_MAPPING_STYLE as libc::c_int;
ok = yaml_mapping_start_event_initialize( ok = yaml_mapping_start_event_initialize(
@ -145,21 +145,21 @@ unsafe fn unsafe_main() -> ExitCode {
get_anchor('&' as i32 as libc::c_char, line, anchor.as_mut_ptr()) get_anchor('&' as i32 as libc::c_char, line, anchor.as_mut_ptr())
as *mut yaml_char_t, as *mut yaml_char_t,
get_tag(line, tag.as_mut_ptr()) as *mut yaml_char_t, get_tag(line, tag.as_mut_ptr()) as *mut yaml_char_t,
0 as libc::c_int, 0_i32,
style as yaml_mapping_style_t, style as yaml_mapping_style_t,
); );
} else if strncmp( } else if strncmp(
line, line,
b"-MAP\0" as *const u8 as *const libc::c_char, b"-MAP\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
ok = yaml_mapping_end_event_initialize(event); ok = yaml_mapping_end_event_initialize(event);
} else if strncmp( } else if strncmp(
line, line,
b"+SEQ\0" as *const u8 as *const libc::c_char, b"+SEQ\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
style = YAML_BLOCK_SEQUENCE_STYLE as libc::c_int; style = YAML_BLOCK_SEQUENCE_STYLE as libc::c_int;
ok = yaml_sequence_start_event_initialize( ok = yaml_sequence_start_event_initialize(
@ -167,21 +167,21 @@ unsafe fn unsafe_main() -> ExitCode {
get_anchor('&' as i32 as libc::c_char, line, anchor.as_mut_ptr()) get_anchor('&' as i32 as libc::c_char, line, anchor.as_mut_ptr())
as *mut yaml_char_t, as *mut yaml_char_t,
get_tag(line, tag.as_mut_ptr()) as *mut yaml_char_t, get_tag(line, tag.as_mut_ptr()) as *mut yaml_char_t,
0 as libc::c_int, 0_i32,
style as yaml_sequence_style_t, style as yaml_sequence_style_t,
); );
} else if strncmp( } else if strncmp(
line, line,
b"-SEQ\0" as *const u8 as *const libc::c_char, b"-SEQ\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
ok = yaml_sequence_end_event_initialize(event); ok = yaml_sequence_end_event_initialize(event);
} else if strncmp( } else if strncmp(
line, line,
b"=VAL\0" as *const u8 as *const libc::c_char, b"=VAL\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
let mut value: [libc::c_char; 1024] = [0; 1024]; let mut value: [libc::c_char; 1024] = [0; 1024];
let mut style_0: libc::c_int = 0; let mut style_0: libc::c_int = 0;
@ -195,7 +195,7 @@ unsafe fn unsafe_main() -> ExitCode {
as *mut yaml_char_t, as *mut yaml_char_t,
get_tag(line, tag.as_mut_ptr()) as *mut yaml_char_t, get_tag(line, tag.as_mut_ptr()) as *mut yaml_char_t,
value.as_mut_ptr() as *mut yaml_char_t, value.as_mut_ptr() as *mut yaml_char_t,
-(1 as libc::c_int), -1_i32,
implicit, implicit,
implicit, implicit,
style_0 as yaml_scalar_style_t, style_0 as yaml_scalar_style_t,
@ -203,8 +203,8 @@ unsafe fn unsafe_main() -> ExitCode {
} else if strncmp( } else if strncmp(
line, line,
b"=ALI\0" as *const u8 as *const libc::c_char, b"=ALI\0" as *const u8 as *const libc::c_char,
4 as libc::c_int as libc::c_ulong, 4_i32 as libc::c_ulong,
) == 0 as libc::c_int ) == 0_i32
{ {
ok = yaml_alias_event_initialize( ok = yaml_alias_event_initialize(
event, event,
@ -350,13 +350,11 @@ pub unsafe fn get_tag(line: *mut libc::c_char, tag: *mut libc::c_char) -> *mut l
} }
memcpy( memcpy(
tag as *mut libc::c_void, tag as *mut libc::c_void,
start.offset(1 as libc::c_int as isize) as *const libc::c_void, start.offset(1_i32 as isize) as *const libc::c_void,
(end.offset_from(start) as libc::c_long - 1 as libc::c_int as libc::c_long) (end.offset_from(start) as libc::c_long - 1_i32 as libc::c_long) as libc::c_ulong,
as libc::c_ulong,
); );
*tag.offset( *tag.offset((end.offset_from(start) as libc::c_long - 1_i32 as libc::c_long) as isize) =
(end.offset_from(start) as libc::c_long - 1 as libc::c_int as libc::c_long) as isize, '\0' as i32 as libc::c_char;
) = '\0' as i32 as libc::c_char;
tag tag
} }
pub unsafe fn get_value( pub unsafe fn get_value(
@ -364,15 +362,15 @@ pub unsafe fn get_value(
value: *mut libc::c_char, value: *mut libc::c_char,
style: *mut libc::c_int, style: *mut libc::c_int,
) { ) {
let mut i: libc::c_int = 0 as libc::c_int; let mut i: libc::c_int = 0_i32;
let mut c: *mut libc::c_char; let mut c: *mut libc::c_char;
let mut start: *mut libc::c_char = ptr::null_mut::<libc::c_char>(); let mut start: *mut libc::c_char = ptr::null_mut::<libc::c_char>();
let end: *mut libc::c_char = line.offset(strlen(line) as isize); let end: *mut libc::c_char = line.offset(strlen(line) as isize);
let mut current_block_8: u64; let mut current_block_8: u64;
c = line.offset(4 as libc::c_int as isize); c = line.offset(4_i32 as isize);
while c < end { while c < end {
if *c as libc::c_int == ' ' as i32 { if *c as libc::c_int == ' ' as i32 {
start = c.offset(1 as libc::c_int as isize); start = c.offset(1_i32 as isize);
if *start as libc::c_int == ':' as i32 { if *start as libc::c_int == ':' as i32 {
*style = YAML_PLAIN_SCALAR_STYLE as libc::c_int; *style = YAML_PLAIN_SCALAR_STYLE as libc::c_int;
current_block_8 = 17407779659766490442; current_block_8 = 17407779659766490442;

View file

@ -32,11 +32,11 @@ unsafe fn unsafe_main() -> ExitCode {
let parser = parser.as_mut_ptr(); let parser = parser.as_mut_ptr();
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mut foundfile: libc::c_int = 0 as libc::c_int; let mut foundfile: libc::c_int = 0_i32;
for arg in env::args_os().skip(1) { for arg in env::args_os().skip(1) {
if foundfile == 0 { if foundfile == 0 {
input = fs::read(arg).ok(); input = fs::read(arg).ok();
foundfile = 1 as libc::c_int; foundfile = 1_i32;
} else { } else {
return usage(ExitCode::FAILURE); return usage(ExitCode::FAILURE);
} }
@ -57,7 +57,7 @@ unsafe fn unsafe_main() -> ExitCode {
ptr::copy_nonoverlapping((*remaining).as_ptr().cast(), buffer, n); ptr::copy_nonoverlapping((*remaining).as_ptr().cast(), buffer, n);
*remaining = &(*remaining)[n..]; *remaining = &(*remaining)[n..];
*size_read = n as size_t; *size_read = n as size_t;
1 as libc::c_int 1_i32
} }
let mut remaining = input.as_slice(); let mut remaining = input.as_slice();
yaml_parser_set_input(parser, Some(read_from_file), addr_of_mut!(remaining).cast()); yaml_parser_set_input(parser, Some(read_from_file), addr_of_mut!(remaining).cast());
@ -72,8 +72,8 @@ unsafe fn unsafe_main() -> ExitCode {
let _ = writeln!( let _ = writeln!(
io::stderr(), io::stderr(),
"Line: {} Column: {}", "Line: {} Column: {}",
((*parser).problem_mark.line).wrapping_add(1 as libc::c_int as libc::c_ulong), ((*parser).problem_mark.line).wrapping_add(1_i32 as libc::c_ulong),
((*parser).problem_mark.column).wrapping_add(1 as libc::c_int as libc::c_ulong), ((*parser).problem_mark.column).wrapping_add(1_i32 as libc::c_ulong),
); );
} }
return ExitCode::FAILURE; return ExitCode::FAILURE;
@ -203,7 +203,7 @@ unsafe fn unsafe_main() -> ExitCode {
pub unsafe fn print_escaped(str: *mut yaml_char_t, length: size_t) { pub unsafe fn print_escaped(str: *mut yaml_char_t, length: size_t) {
let mut i: libc::c_int; let mut i: libc::c_int;
let mut c: libc::c_char; let mut c: libc::c_char;
i = 0 as libc::c_int; i = 0_i32;
while (i as libc::c_ulong) < length { while (i as libc::c_ulong) < length {
c = *str.offset(i as isize) as libc::c_char; c = *str.offset(i as isize) as libc::c_char;
if c as libc::c_int == '\\' as i32 { if c as libc::c_int == '\\' as i32 {

View file

@ -15,15 +15,15 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> libc::c_int
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
__assert!(!emitter.is_null()); __assert!(!emitter.is_null());
__assert!((*emitter).opened == 0); __assert!((*emitter).opened == 0);
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_STREAM_START_EVENT; (*event).type_0 = YAML_STREAM_START_EVENT;
@ -31,37 +31,37 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> libc::c_int
(*event).end_mark = mark; (*event).end_mark = mark;
(*event).data.stream_start.encoding = YAML_ANY_ENCODING; (*event).data.stream_start.encoding = YAML_ANY_ENCODING;
if yaml_emitter_emit(emitter, event) == 0 { if yaml_emitter_emit(emitter, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
(*emitter).opened = 1 as libc::c_int; (*emitter).opened = 1_i32;
1 as libc::c_int 1_i32
} }
pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> libc::c_int { pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> libc::c_int {
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
__assert!(!emitter.is_null()); __assert!(!emitter.is_null());
__assert!((*emitter).opened != 0); __assert!((*emitter).opened != 0);
if (*emitter).closed != 0 { if (*emitter).closed != 0 {
return 1 as libc::c_int; return 1_i32;
} }
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_STREAM_END_EVENT; (*event).type_0 = YAML_STREAM_END_EVENT;
(*event).start_mark = mark; (*event).start_mark = mark;
(*event).end_mark = mark; (*event).end_mark = mark;
if yaml_emitter_emit(emitter, event) == 0 { if yaml_emitter_emit(emitter, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
(*emitter).closed = 1 as libc::c_int; (*emitter).closed = 1_i32;
1 as libc::c_int 1_i32
} }
pub unsafe fn yaml_emitter_dump( pub unsafe fn yaml_emitter_dump(
emitter: *mut yaml_emitter_t, emitter: *mut yaml_emitter_t,
@ -71,9 +71,9 @@ pub unsafe fn yaml_emitter_dump(
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
__assert!(!emitter.is_null()); __assert!(!emitter.is_null());
__assert!(!document.is_null()); __assert!(!document.is_null());
@ -93,7 +93,7 @@ pub unsafe fn yaml_emitter_dump(
if (*document).nodes.start == (*document).nodes.top { if (*document).nodes.start == (*document).nodes.top {
if !(yaml_emitter_close(emitter) == 0) { if !(yaml_emitter_close(emitter) == 0) {
yaml_emitter_delete_document_and_anchors(emitter); yaml_emitter_delete_document_and_anchors(emitter);
return 1 as libc::c_int; return 1_i32;
} }
} else { } else {
__assert!((*emitter).opened != 0); __assert!((*emitter).opened != 0);
@ -105,7 +105,7 @@ pub unsafe fn yaml_emitter_dump(
if !((*emitter).anchors).is_null() { if !((*emitter).anchors).is_null() {
memset( memset(
(*emitter).anchors as *mut libc::c_void, (*emitter).anchors as *mut libc::c_void,
0 as libc::c_int, 0_i32,
(size_of::<yaml_anchors_t>() as libc::c_ulong).wrapping_mul( (size_of::<yaml_anchors_t>() as libc::c_ulong).wrapping_mul(
((*document).nodes.top).c_offset_from((*document).nodes.start) ((*document).nodes.top).c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_ulong, as libc::c_long as libc::c_ulong,
@ -113,7 +113,7 @@ pub unsafe fn yaml_emitter_dump(
); );
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_DOCUMENT_START_EVENT; (*event).type_0 = YAML_DOCUMENT_START_EVENT;
@ -126,11 +126,11 @@ pub unsafe fn yaml_emitter_dump(
(*document).tag_directives.end; (*document).tag_directives.end;
(*event).data.document_start.implicit = (*document).start_implicit; (*event).data.document_start.implicit = (*document).start_implicit;
if !(yaml_emitter_emit(emitter, event) == 0) { if !(yaml_emitter_emit(emitter, event) == 0) {
yaml_emitter_anchor_node(emitter, 1 as libc::c_int); yaml_emitter_anchor_node(emitter, 1_i32);
if !(yaml_emitter_dump_node(emitter, 1 as libc::c_int) == 0) { if !(yaml_emitter_dump_node(emitter, 1_i32) == 0) {
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_DOCUMENT_END_EVENT; (*event).type_0 = YAML_DOCUMENT_END_EVENT;
@ -139,7 +139,7 @@ pub unsafe fn yaml_emitter_dump(
(*event).data.document_end.implicit = (*document).end_implicit; (*event).data.document_end.implicit = (*document).end_implicit;
if !(yaml_emitter_emit(emitter, event) == 0) { if !(yaml_emitter_emit(emitter, event) == 0) {
yaml_emitter_delete_document_and_anchors(emitter); yaml_emitter_delete_document_and_anchors(emitter);
return 1 as libc::c_int; return 1_i32;
} }
} }
} }
@ -149,7 +149,7 @@ pub unsafe fn yaml_emitter_dump(
_ => {} _ => {}
} }
yaml_emitter_delete_document_and_anchors(emitter); yaml_emitter_delete_document_and_anchors(emitter);
0 as libc::c_int 0_i32
} }
unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitter_t) { unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitter_t) {
let mut index: libc::c_int; let mut index: libc::c_int;
@ -159,7 +159,7 @@ unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitte
*fresh2 = ptr::null_mut::<yaml_document_t>(); *fresh2 = ptr::null_mut::<yaml_document_t>();
return; return;
} }
index = 0 as libc::c_int; index = 0_i32;
while ((*(*emitter).document).nodes.start).wrapping_offset(index as isize) while ((*(*emitter).document).nodes.start).wrapping_offset(index as isize)
< (*(*emitter).document).nodes.top < (*(*emitter).document).nodes.top
{ {
@ -195,23 +195,20 @@ unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitte
yaml_free((*emitter).anchors as *mut libc::c_void); yaml_free((*emitter).anchors as *mut libc::c_void);
let fresh6 = addr_of_mut!((*emitter).anchors); let fresh6 = addr_of_mut!((*emitter).anchors);
*fresh6 = ptr::null_mut::<yaml_anchors_t>(); *fresh6 = ptr::null_mut::<yaml_anchors_t>();
(*emitter).last_anchor_id = 0 as libc::c_int; (*emitter).last_anchor_id = 0_i32;
let fresh7 = addr_of_mut!((*emitter).document); let fresh7 = addr_of_mut!((*emitter).document);
*fresh7 = ptr::null_mut::<yaml_document_t>(); *fresh7 = ptr::null_mut::<yaml_document_t>();
} }
unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_int) { unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_int) {
let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start) let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start)
.wrapping_offset(index as isize) .wrapping_offset(index as isize)
.wrapping_offset(-(1 as libc::c_int as isize)); .wrapping_offset(-(1_i32 as isize));
let mut item: *mut yaml_node_item_t; let mut item: *mut yaml_node_item_t;
let mut pair: *mut yaml_node_pair_t; let mut pair: *mut yaml_node_pair_t;
let fresh8 = addr_of_mut!( let fresh8 =
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).references addr_of_mut!((*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).references);
);
*fresh8 += 1; *fresh8 += 1;
if (*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).references if (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).references == 1_i32 {
== 1 as libc::c_int
{
match (*node).type_0 as libc::c_uint { match (*node).type_0 as libc::c_uint {
2 => { 2 => {
item = (*node).data.sequence.items.start; item = (*node).data.sequence.items.start;
@ -230,21 +227,18 @@ unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_
} }
_ => {} _ => {}
} }
} else if (*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)) } else if (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).references == 2_i32
.references
== 2 as libc::c_int
{ {
let fresh9 = addr_of_mut!((*emitter).last_anchor_id); let fresh9 = addr_of_mut!((*emitter).last_anchor_id);
*fresh9 += 1; *fresh9 += 1;
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).anchor = (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).anchor = *fresh9;
*fresh9;
} }
} }
unsafe fn yaml_emitter_generate_anchor( unsafe fn yaml_emitter_generate_anchor(
_emitter: *mut yaml_emitter_t, _emitter: *mut yaml_emitter_t,
anchor_id: libc::c_int, anchor_id: libc::c_int,
) -> *mut yaml_char_t { ) -> *mut yaml_char_t {
let anchor: *mut yaml_char_t = yaml_malloc(16 as libc::c_int as size_t) as *mut yaml_char_t; let anchor: *mut yaml_char_t = yaml_malloc(16_i32 as size_t) as *mut yaml_char_t;
if anchor.is_null() { if anchor.is_null() {
return ptr::null_mut::<yaml_char_t>(); return ptr::null_mut::<yaml_char_t>();
} }
@ -255,22 +249,20 @@ unsafe fn yaml_emitter_generate_anchor(
unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_int) -> libc::c_int { unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_int) -> libc::c_int {
let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start) let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start)
.wrapping_offset(index as isize) .wrapping_offset(index as isize)
.wrapping_offset(-(1 as libc::c_int as isize)); .wrapping_offset(-(1_i32 as isize));
let anchor_id: libc::c_int = let anchor_id: libc::c_int =
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).anchor; (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).anchor;
let mut anchor: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>(); let mut anchor: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
if anchor_id != 0 { if anchor_id != 0 {
anchor = yaml_emitter_generate_anchor(emitter, anchor_id); anchor = yaml_emitter_generate_anchor(emitter, anchor_id);
if anchor.is_null() { if anchor.is_null() {
return 0 as libc::c_int; return 0_i32;
} }
} }
if (*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).serialized != 0 if (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).serialized != 0 {
{
return yaml_emitter_dump_alias(emitter, anchor); return yaml_emitter_dump_alias(emitter, anchor);
} }
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).serialized = (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).serialized = 1_i32;
1 as libc::c_int;
match (*node).type_0 as libc::c_uint { match (*node).type_0 as libc::c_uint {
1 => yaml_emitter_dump_scalar(emitter, node, anchor), 1 => yaml_emitter_dump_scalar(emitter, node, anchor),
2 => yaml_emitter_dump_sequence(emitter, node, anchor), 2 => yaml_emitter_dump_sequence(emitter, node, anchor),
@ -285,13 +277,13 @@ unsafe fn yaml_emitter_dump_alias(
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_ALIAS_EVENT; (*event).type_0 = YAML_ALIAS_EVENT;
@ -308,21 +300,21 @@ unsafe fn yaml_emitter_dump_scalar(
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
let plain_implicit: libc::c_int = (strcmp( let plain_implicit: libc::c_int = (strcmp(
(*node).tag as *mut libc::c_char, (*node).tag as *mut libc::c_char,
b"tag:yaml.org,2002:str\0" as *const u8 as *const libc::c_char, b"tag:yaml.org,2002:str\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int) as libc::c_int; ) == 0_i32) as libc::c_int;
let quoted_implicit: libc::c_int = (strcmp( let quoted_implicit: libc::c_int = (strcmp(
(*node).tag as *mut libc::c_char, (*node).tag as *mut libc::c_char,
b"tag:yaml.org,2002:str\0" as *const u8 as *const libc::c_char, b"tag:yaml.org,2002:str\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int) as libc::c_int; ) == 0_i32) as libc::c_int;
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_SCALAR_EVENT; (*event).type_0 = YAML_SCALAR_EVENT;
@ -345,18 +337,18 @@ unsafe fn yaml_emitter_dump_sequence(
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
let implicit: libc::c_int = (strcmp( let implicit: libc::c_int = (strcmp(
(*node).tag as *mut libc::c_char, (*node).tag as *mut libc::c_char,
b"tag:yaml.org,2002:seq\0" as *const u8 as *const libc::c_char, b"tag:yaml.org,2002:seq\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int) as libc::c_int; ) == 0_i32) as libc::c_int;
let mut item: *mut yaml_node_item_t; let mut item: *mut yaml_node_item_t;
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_SEQUENCE_START_EVENT; (*event).type_0 = YAML_SEQUENCE_START_EVENT;
@ -367,27 +359,27 @@ unsafe fn yaml_emitter_dump_sequence(
(*event).data.sequence_start.implicit = implicit; (*event).data.sequence_start.implicit = implicit;
(*event).data.sequence_start.style = (*node).data.sequence.style; (*event).data.sequence_start.style = (*node).data.sequence.style;
if yaml_emitter_emit(emitter, event) == 0 { if yaml_emitter_emit(emitter, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
item = (*node).data.sequence.items.start; item = (*node).data.sequence.items.start;
while item < (*node).data.sequence.items.top { while item < (*node).data.sequence.items.top {
if yaml_emitter_dump_node(emitter, *item) == 0 { if yaml_emitter_dump_node(emitter, *item) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
item = item.wrapping_offset(1); item = item.wrapping_offset(1);
} }
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_SEQUENCE_END_EVENT; (*event).type_0 = YAML_SEQUENCE_END_EVENT;
(*event).start_mark = mark; (*event).start_mark = mark;
(*event).end_mark = mark; (*event).end_mark = mark;
if yaml_emitter_emit(emitter, event) == 0 { if yaml_emitter_emit(emitter, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
1 as libc::c_int 1_i32
} }
unsafe fn yaml_emitter_dump_mapping( unsafe fn yaml_emitter_dump_mapping(
emitter: *mut yaml_emitter_t, emitter: *mut yaml_emitter_t,
@ -397,18 +389,18 @@ unsafe fn yaml_emitter_dump_mapping(
let mut event = MaybeUninit::<yaml_event_t>::uninit(); let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
let mark = yaml_mark_t { let mark = yaml_mark_t {
index: 0 as libc::c_int as size_t, index: 0_i32 as size_t,
line: 0 as libc::c_int as size_t, line: 0_i32 as size_t,
column: 0 as libc::c_int as size_t, column: 0_i32 as size_t,
}; };
let implicit: libc::c_int = (strcmp( let implicit: libc::c_int = (strcmp(
(*node).tag as *mut libc::c_char, (*node).tag as *mut libc::c_char,
b"tag:yaml.org,2002:map\0" as *const u8 as *const libc::c_char, b"tag:yaml.org,2002:map\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int) as libc::c_int; ) == 0_i32) as libc::c_int;
let mut pair: *mut yaml_node_pair_t; let mut pair: *mut yaml_node_pair_t;
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_MAPPING_START_EVENT; (*event).type_0 = YAML_MAPPING_START_EVENT;
@ -419,28 +411,28 @@ unsafe fn yaml_emitter_dump_mapping(
(*event).data.mapping_start.implicit = implicit; (*event).data.mapping_start.implicit = implicit;
(*event).data.mapping_start.style = (*node).data.mapping.style; (*event).data.mapping_start.style = (*node).data.mapping.style;
if yaml_emitter_emit(emitter, event) == 0 { if yaml_emitter_emit(emitter, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
pair = (*node).data.mapping.pairs.start; pair = (*node).data.mapping.pairs.start;
while pair < (*node).data.mapping.pairs.top { while pair < (*node).data.mapping.pairs.top {
if yaml_emitter_dump_node(emitter, (*pair).key) == 0 { if yaml_emitter_dump_node(emitter, (*pair).key) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
if yaml_emitter_dump_node(emitter, (*pair).value) == 0 { if yaml_emitter_dump_node(emitter, (*pair).value) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
pair = pair.wrapping_offset(1); pair = pair.wrapping_offset(1);
} }
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_event_t>() as libc::c_ulong, size_of::<yaml_event_t>() as libc::c_ulong,
); );
(*event).type_0 = YAML_MAPPING_END_EVENT; (*event).type_0 = YAML_MAPPING_END_EVENT;
(*event).start_mark = mark; (*event).start_mark = mark;
(*event).end_mark = mark; (*event).end_mark = mark;
if yaml_emitter_emit(emitter, event) == 0 { if yaml_emitter_emit(emitter, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
1 as libc::c_int 1_i32
} }

File diff suppressed because it is too large Load diff

View file

@ -45,23 +45,22 @@ pub unsafe fn yaml_parser_load(
__assert!(!document.is_null()); __assert!(!document.is_null());
memset( memset(
document as *mut libc::c_void, document as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_document_t>() as libc::c_ulong, size_of::<yaml_document_t>() as libc::c_ulong,
); );
let fresh0 = addr_of_mut!((*document).nodes.start); let fresh0 = addr_of_mut!((*document).nodes.start);
*fresh0 = yaml_malloc( *fresh0 = yaml_malloc(
(16 as libc::c_int as libc::c_ulong) (16_i32 as libc::c_ulong).wrapping_mul(size_of::<yaml_node_t>() as libc::c_ulong),
.wrapping_mul(size_of::<yaml_node_t>() as libc::c_ulong),
) as *mut yaml_node_t; ) as *mut yaml_node_t;
if !(if !(*fresh0).is_null() { if !(if !(*fresh0).is_null() {
let fresh1 = addr_of_mut!((*document).nodes.top); let fresh1 = addr_of_mut!((*document).nodes.top);
*fresh1 = (*document).nodes.start; *fresh1 = (*document).nodes.start;
let fresh2 = addr_of_mut!((*document).nodes.end); let fresh2 = addr_of_mut!((*document).nodes.end);
*fresh2 = ((*document).nodes.start).wrapping_offset(16 as libc::c_int as isize); *fresh2 = ((*document).nodes.start).wrapping_offset(16_i32 as isize);
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
if (*parser).stream_start_produced == 0 { if (*parser).stream_start_produced == 0 {
@ -81,31 +80,29 @@ pub unsafe fn yaml_parser_load(
6234624449317607669 => {} 6234624449317607669 => {}
_ => { _ => {
if (*parser).stream_end_produced != 0 { if (*parser).stream_end_produced != 0 {
return 1 as libc::c_int; return 1_i32;
} }
if !(yaml_parser_parse(parser, event) == 0) { if !(yaml_parser_parse(parser, event) == 0) {
if (*event).type_0 as libc::c_uint if (*event).type_0 as libc::c_uint
== YAML_STREAM_END_EVENT as libc::c_int as libc::c_uint == YAML_STREAM_END_EVENT as libc::c_int as libc::c_uint
{ {
return 1 as libc::c_int; return 1_i32;
} }
let fresh3 = addr_of_mut!((*parser).aliases.start); let fresh3 = addr_of_mut!((*parser).aliases.start);
*fresh3 = *fresh3 = yaml_malloc((16_i32 as libc::c_ulong).wrapping_mul(size_of::<
yaml_malloc((16 as libc::c_int as libc::c_ulong).wrapping_mul(size_of::< yaml_alias_data_t,
yaml_alias_data_t, >(
>( )
) as libc::c_ulong)) as *mut yaml_alias_data_t;
as libc::c_ulong)) as *mut yaml_alias_data_t;
if !(if !(*fresh3).is_null() { if !(if !(*fresh3).is_null() {
let fresh4 = addr_of_mut!((*parser).aliases.top); let fresh4 = addr_of_mut!((*parser).aliases.top);
*fresh4 = (*parser).aliases.start; *fresh4 = (*parser).aliases.start;
let fresh5 = addr_of_mut!((*parser).aliases.end); let fresh5 = addr_of_mut!((*parser).aliases.end);
*fresh5 = *fresh5 = ((*parser).aliases.start).wrapping_offset(16_i32 as isize);
((*parser).aliases.start).wrapping_offset(16 as libc::c_int as isize); 1_i32
1 as libc::c_int
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
let fresh6 = addr_of_mut!((*parser).document); let fresh6 = addr_of_mut!((*parser).document);
@ -114,7 +111,7 @@ pub unsafe fn yaml_parser_load(
yaml_parser_delete_aliases(parser); yaml_parser_delete_aliases(parser);
let fresh7 = addr_of_mut!((*parser).document); let fresh7 = addr_of_mut!((*parser).document);
*fresh7 = ptr::null_mut::<yaml_document_t>(); *fresh7 = ptr::null_mut::<yaml_document_t>();
return 1 as libc::c_int; return 1_i32;
} }
} }
} }
@ -125,7 +122,7 @@ pub unsafe fn yaml_parser_load(
yaml_document_delete(document); yaml_document_delete(document);
let fresh8 = addr_of_mut!((*parser).document); let fresh8 = addr_of_mut!((*parser).document);
*fresh8 = ptr::null_mut::<yaml_document_t>(); *fresh8 = ptr::null_mut::<yaml_document_t>();
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_set_composer_error( unsafe fn yaml_parser_set_composer_error(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -136,7 +133,7 @@ unsafe fn yaml_parser_set_composer_error(
let fresh9 = addr_of_mut!((*parser).problem); let fresh9 = addr_of_mut!((*parser).problem);
*fresh9 = problem; *fresh9 = problem;
(*parser).problem_mark = problem_mark; (*parser).problem_mark = problem_mark;
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_set_composer_error_context( unsafe fn yaml_parser_set_composer_error_context(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -152,7 +149,7 @@ unsafe fn yaml_parser_set_composer_error_context(
let fresh11 = addr_of_mut!((*parser).problem); let fresh11 = addr_of_mut!((*parser).problem);
*fresh11 = problem; *fresh11 = problem;
(*parser).problem_mark = problem_mark; (*parser).problem_mark = problem_mark;
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_delete_aliases(parser: *mut yaml_parser_t) { unsafe fn yaml_parser_delete_aliases(parser: *mut yaml_parser_t) {
while !((*parser).aliases.start == (*parser).aliases.top) { while !((*parser).aliases.start == (*parser).aliases.top) {
@ -189,32 +186,31 @@ unsafe fn yaml_parser_load_document(
(*(*parser).document).start_implicit = (*event).data.document_start.implicit; (*(*parser).document).start_implicit = (*event).data.document_start.implicit;
(*(*parser).document).start_mark = (*event).start_mark; (*(*parser).document).start_mark = (*event).start_mark;
ctx.start = yaml_malloc( ctx.start = yaml_malloc(
(16 as libc::c_int as libc::c_ulong) (16_i32 as libc::c_ulong).wrapping_mul(size_of::<libc::c_int>() as libc::c_ulong),
.wrapping_mul(size_of::<libc::c_int>() as libc::c_ulong),
) as *mut libc::c_int; ) as *mut libc::c_int;
if if !(ctx.start).is_null() { if if !(ctx.start).is_null() {
ctx.top = ctx.start; ctx.top = ctx.start;
ctx.end = (ctx.start).wrapping_offset(16 as libc::c_int as isize); ctx.end = (ctx.start).wrapping_offset(16_i32 as isize);
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)) == 0 { if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)) == 0 {
yaml_free(ctx.start as *mut libc::c_void); yaml_free(ctx.start as *mut libc::c_void);
ctx.end = ptr::null_mut::<libc::c_int>(); ctx.end = ptr::null_mut::<libc::c_int>();
ctx.top = ctx.end; ctx.top = ctx.end;
ctx.start = ctx.top; ctx.start = ctx.top;
return 0 as libc::c_int; return 0_i32;
} }
yaml_free(ctx.start as *mut libc::c_void); yaml_free(ctx.start as *mut libc::c_void);
ctx.end = ptr::null_mut::<libc::c_int>(); ctx.end = ptr::null_mut::<libc::c_int>();
ctx.top = ctx.end; ctx.top = ctx.end;
ctx.start = ctx.top; ctx.start = ctx.top;
1 as libc::c_int 1_i32
} }
unsafe fn yaml_parser_load_nodes( unsafe fn yaml_parser_load_nodes(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -224,37 +220,37 @@ unsafe fn yaml_parser_load_nodes(
let event = event.as_mut_ptr(); let event = event.as_mut_ptr();
loop { loop {
if yaml_parser_parse(parser, event) == 0 { if yaml_parser_parse(parser, event) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
match (*event).type_0 as libc::c_uint { match (*event).type_0 as libc::c_uint {
5 => { 5 => {
if yaml_parser_load_alias(parser, event, ctx) == 0 { if yaml_parser_load_alias(parser, event, ctx) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
6 => { 6 => {
if yaml_parser_load_scalar(parser, event, ctx) == 0 { if yaml_parser_load_scalar(parser, event, ctx) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
7 => { 7 => {
if yaml_parser_load_sequence(parser, event, ctx) == 0 { if yaml_parser_load_sequence(parser, event, ctx) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
8 => { 8 => {
if yaml_parser_load_sequence_end(parser, event, ctx) == 0 { if yaml_parser_load_sequence_end(parser, event, ctx) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
9 => { 9 => {
if yaml_parser_load_mapping(parser, event, ctx) == 0 { if yaml_parser_load_mapping(parser, event, ctx) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
10 => { 10 => {
if yaml_parser_load_mapping_end(parser, event, ctx) == 0 { if yaml_parser_load_mapping_end(parser, event, ctx) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
4 => {} 4 => {}
@ -270,7 +266,7 @@ unsafe fn yaml_parser_load_nodes(
} }
(*(*parser).document).end_implicit = (*event).data.document_end.implicit; (*(*parser).document).end_implicit = (*event).data.document_end.implicit;
(*(*parser).document).end_mark = (*event).end_mark; (*(*parser).document).end_mark = (*event).end_mark;
1 as libc::c_int 1_i32
} }
unsafe fn yaml_parser_register_anchor( unsafe fn yaml_parser_register_anchor(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -288,19 +284,18 @@ unsafe fn yaml_parser_register_anchor(
}; };
let mut alias_data: *mut yaml_alias_data_t; let mut alias_data: *mut yaml_alias_data_t;
if anchor.is_null() { if anchor.is_null() {
return 1 as libc::c_int; return 1_i32;
} }
data.anchor = anchor; data.anchor = anchor;
data.index = index; data.index = index;
data.mark = (*((*(*parser).document).nodes.start) data.mark =
.wrapping_offset((index - 1 as libc::c_int) as isize)) (*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).start_mark;
.start_mark;
alias_data = (*parser).aliases.start; alias_data = (*parser).aliases.start;
while alias_data != (*parser).aliases.top { while alias_data != (*parser).aliases.top {
if strcmp( if strcmp(
(*alias_data).anchor as *mut libc::c_char, (*alias_data).anchor as *mut libc::c_char,
anchor as *mut libc::c_char, anchor as *mut libc::c_char,
) == 0 as libc::c_int ) == 0_i32
{ {
yaml_free(anchor as *mut libc::c_void); yaml_free(anchor as *mut libc::c_void);
return yaml_parser_set_composer_error_context( return yaml_parser_set_composer_error_context(
@ -324,16 +319,16 @@ unsafe fn yaml_parser_register_anchor(
let fresh20 = *fresh19; let fresh20 = *fresh19;
*fresh19 = (*fresh19).wrapping_offset(1); *fresh19 = (*fresh19).wrapping_offset(1);
*fresh20 = data; *fresh20 = data;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
yaml_free(anchor as *mut libc::c_void); yaml_free(anchor as *mut libc::c_void);
return 0 as libc::c_int; return 0_i32;
} }
1 as libc::c_int 1_i32
} }
unsafe fn yaml_parser_load_node_add( unsafe fn yaml_parser_load_node_add(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -341,26 +336,27 @@ unsafe fn yaml_parser_load_node_add(
index: libc::c_int, index: libc::c_int,
) -> libc::c_int { ) -> libc::c_int {
if (*ctx).start == (*ctx).top { if (*ctx).start == (*ctx).top {
return 1 as libc::c_int; return 1_i32;
} }
let parent_index: libc::c_int = *((*ctx).top).wrapping_offset(-(1 as libc::c_int as isize)); let parent_index: libc::c_int = *((*ctx).top).wrapping_offset(-(1_i32 as isize));
let parent: *mut yaml_node_t = addr_of_mut!(*((*(*parser).document).nodes.start) let parent: *mut yaml_node_t = addr_of_mut!(
.wrapping_offset((parent_index - 1 as libc::c_int) as isize)); *((*(*parser).document).nodes.start).wrapping_offset((parent_index - 1_i32) as isize)
);
let current_block_17: u64; let current_block_17: u64;
match (*parent).type_0 as libc::c_uint { match (*parent).type_0 as libc::c_uint {
2 => { 2 => {
if if (((*parent).data.sequence.items.top) if if (((*parent).data.sequence.items.top)
.c_offset_from((*parent).data.sequence.items.start) .c_offset_from((*parent).data.sequence.items.start)
as libc::c_long) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if if (*parent).data.sequence.items.top != (*parent).data.sequence.items.end if if (*parent).data.sequence.items.top != (*parent).data.sequence.items.end
|| yaml_stack_extend( || yaml_stack_extend(
@ -373,21 +369,21 @@ unsafe fn yaml_parser_load_node_add(
let fresh22 = *fresh21; let fresh22 = *fresh21;
*fresh21 = (*fresh21).wrapping_offset(1); *fresh21 = (*fresh21).wrapping_offset(1);
*fresh22 = index; *fresh22 = index;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
} }
3 => { 3 => {
let mut pair = yaml_node_pair_t { key: 0, value: 0 }; let mut pair = yaml_node_pair_t { key: 0, value: 0 };
if !((*parent).data.mapping.pairs.start == (*parent).data.mapping.pairs.top) { if !((*parent).data.mapping.pairs.start == (*parent).data.mapping.pairs.top) {
let mut p: *mut yaml_node_pair_t = ((*parent).data.mapping.pairs.top) let mut p: *mut yaml_node_pair_t =
.wrapping_offset(-(1 as libc::c_int as isize)); ((*parent).data.mapping.pairs.top).wrapping_offset(-(1_i32 as isize));
if (*p).key != 0 as libc::c_int && (*p).value == 0 as libc::c_int { if (*p).key != 0_i32 && (*p).value == 0_i32 {
(*p).value = index; (*p).value = index;
current_block_17 = 11307063007268554308; current_block_17 = 11307063007268554308;
} else { } else {
@ -400,19 +396,19 @@ unsafe fn yaml_parser_load_node_add(
11307063007268554308 => {} 11307063007268554308 => {}
_ => { _ => {
pair.key = index; pair.key = index;
pair.value = 0 as libc::c_int; pair.value = 0_i32;
if if (((*parent).data.mapping.pairs.top) if if (((*parent).data.mapping.pairs.top)
.c_offset_from((*parent).data.mapping.pairs.start) .c_offset_from((*parent).data.mapping.pairs.start)
as libc::c_long) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if if (*parent).data.mapping.pairs.top != (*parent).data.mapping.pairs.end if if (*parent).data.mapping.pairs.top != (*parent).data.mapping.pairs.end
|| yaml_stack_extend( || yaml_stack_extend(
@ -428,13 +424,13 @@ unsafe fn yaml_parser_load_node_add(
let fresh24 = *fresh23; let fresh24 = *fresh23;
*fresh23 = (*fresh23).wrapping_offset(1); *fresh23 = (*fresh23).wrapping_offset(1);
*fresh24 = pair; *fresh24 = pair;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
} }
} }
@ -443,7 +439,7 @@ unsafe fn yaml_parser_load_node_add(
__assert!(false); __assert!(false);
} }
} }
1 as libc::c_int 1_i32
} }
unsafe fn yaml_parser_load_alias( unsafe fn yaml_parser_load_alias(
parser: *mut yaml_parser_t, parser: *mut yaml_parser_t,
@ -457,7 +453,7 @@ unsafe fn yaml_parser_load_alias(
if strcmp( if strcmp(
(*alias_data).anchor as *mut libc::c_char, (*alias_data).anchor as *mut libc::c_char,
anchor as *mut libc::c_char, anchor as *mut libc::c_char,
) == 0 as libc::c_int ) == 0_i32
{ {
yaml_free(anchor as *mut libc::c_void); yaml_free(anchor as *mut libc::c_void);
return yaml_parser_load_node_add(parser, ctx, (*alias_data).index); return yaml_parser_load_node_add(parser, ctx, (*alias_data).index);
@ -502,19 +498,19 @@ unsafe fn yaml_parser_load_scalar(
let mut tag: *mut yaml_char_t = (*event).data.scalar.tag; let mut tag: *mut yaml_char_t = (*event).data.scalar.tag;
if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.start) if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.start)
as libc::c_long) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
if tag.is_null() if tag.is_null()
|| strcmp( || strcmp(
tag as *mut libc::c_char, tag as *mut libc::c_char,
b"!\0" as *const u8 as *const libc::c_char, b"!\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int ) == 0_i32
{ {
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
tag = yaml_strdup( tag = yaml_strdup(
@ -533,7 +529,7 @@ unsafe fn yaml_parser_load_scalar(
_ => { _ => {
memset( memset(
addr_of_mut!(node) as *mut libc::c_void, addr_of_mut!(node) as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_node_t>() as libc::c_ulong, size_of::<yaml_node_t>() as libc::c_ulong,
); );
node.type_0 = YAML_SCALAR_NODE; node.type_0 = YAML_SCALAR_NODE;
@ -554,10 +550,10 @@ unsafe fn yaml_parser_load_scalar(
let fresh26 = *fresh25; let fresh26 = *fresh25;
*fresh25 = (*fresh25).wrapping_offset(1); *fresh25 = (*fresh25).wrapping_offset(1);
*fresh26 = node; *fresh26 = node;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
index = ((*(*parser).document).nodes.top) index = ((*(*parser).document).nodes.top)
@ -565,7 +561,7 @@ unsafe fn yaml_parser_load_scalar(
as libc::c_long as libc::c_int; as libc::c_long as libc::c_int;
if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor) == 0 if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor) == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
return yaml_parser_load_node_add(parser, ctx, index); return yaml_parser_load_node_add(parser, ctx, index);
} }
@ -575,7 +571,7 @@ unsafe fn yaml_parser_load_scalar(
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
yaml_free((*event).data.scalar.anchor as *mut libc::c_void); yaml_free((*event).data.scalar.anchor as *mut libc::c_void);
yaml_free((*event).data.scalar.value as *mut libc::c_void); yaml_free((*event).data.scalar.value as *mut libc::c_void);
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_load_sequence( unsafe fn yaml_parser_load_sequence(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -613,19 +609,19 @@ unsafe fn yaml_parser_load_sequence(
let mut tag: *mut yaml_char_t = (*event).data.sequence_start.tag; let mut tag: *mut yaml_char_t = (*event).data.sequence_start.tag;
if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.start) if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.start)
as libc::c_long) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
if tag.is_null() if tag.is_null()
|| strcmp( || strcmp(
tag as *mut libc::c_char, tag as *mut libc::c_char,
b"!\0" as *const u8 as *const libc::c_char, b"!\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int ) == 0_i32
{ {
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
tag = yaml_strdup( tag = yaml_strdup(
@ -642,24 +638,22 @@ unsafe fn yaml_parser_load_sequence(
match current_block { match current_block {
13474536459355229096 => {} 13474536459355229096 => {}
_ => { _ => {
items.start = items.start = yaml_malloc(
yaml_malloc((16 as libc::c_int as libc::c_ulong).wrapping_mul(size_of::< (16_i32 as libc::c_ulong)
yaml_node_item_t, .wrapping_mul(size_of::<yaml_node_item_t>() as libc::c_ulong),
>( ) as *mut yaml_node_item_t;
)
as libc::c_ulong)) as *mut yaml_node_item_t;
if !(if !(items.start).is_null() { if !(if !(items.start).is_null() {
items.top = items.start; items.top = items.start;
items.end = (items.start).wrapping_offset(16 as libc::c_int as isize); items.end = (items.start).wrapping_offset(16_i32 as isize);
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
memset( memset(
addr_of_mut!(node) as *mut libc::c_void, addr_of_mut!(node) as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_node_t>() as libc::c_ulong, size_of::<yaml_node_t>() as libc::c_ulong,
); );
node.type_0 = YAML_SEQUENCE_NODE; node.type_0 = YAML_SEQUENCE_NODE;
@ -682,10 +676,10 @@ unsafe fn yaml_parser_load_sequence(
let fresh28 = *fresh27; let fresh28 = *fresh27;
*fresh27 = (*fresh27).wrapping_offset(1); *fresh27 = (*fresh27).wrapping_offset(1);
*fresh28 = node; *fresh28 = node;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
index = ((*(*parser).document).nodes.top) index = ((*(*parser).document).nodes.top)
@ -697,21 +691,21 @@ unsafe fn yaml_parser_load_sequence(
(*event).data.sequence_start.anchor, (*event).data.sequence_start.anchor,
) == 0 ) == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if yaml_parser_load_node_add(parser, ctx, index) == 0 { if yaml_parser_load_node_add(parser, ctx, index) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
if if (((*ctx).top).c_offset_from((*ctx).start) as libc::c_long) if if (((*ctx).top).c_offset_from((*ctx).start) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if if (*ctx).top != (*ctx).end if if (*ctx).top != (*ctx).end
|| yaml_stack_extend( || yaml_stack_extend(
@ -724,15 +718,15 @@ unsafe fn yaml_parser_load_sequence(
let fresh30 = *fresh29; let fresh30 = *fresh29;
*fresh29 = (*fresh29).wrapping_offset(1); *fresh29 = (*fresh29).wrapping_offset(1);
*fresh30 = index; *fresh30 = index;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
return 1 as libc::c_int; return 1_i32;
} }
} }
} }
@ -740,27 +734,25 @@ unsafe fn yaml_parser_load_sequence(
} }
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
yaml_free((*event).data.sequence_start.anchor as *mut libc::c_void); yaml_free((*event).data.sequence_start.anchor as *mut libc::c_void);
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_load_sequence_end( unsafe fn yaml_parser_load_sequence_end(
parser: *mut yaml_parser_t, parser: *mut yaml_parser_t,
event: *mut yaml_event_t, event: *mut yaml_event_t,
ctx: *mut loader_ctx, ctx: *mut loader_ctx,
) -> libc::c_int { ) -> libc::c_int {
__assert!(((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0_i32 as libc::c_long);
let index: libc::c_int = *((*ctx).top).wrapping_offset(-(1_i32 as isize));
__assert!( __assert!(
((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0 as libc::c_int as libc::c_long (*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).type_0
); as libc::c_uint
let index: libc::c_int = *((*ctx).top).wrapping_offset(-(1 as libc::c_int as isize));
__assert!(
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1 as libc::c_int) as isize))
.type_0 as libc::c_uint
== YAML_SEQUENCE_NODE as libc::c_int as libc::c_uint == YAML_SEQUENCE_NODE as libc::c_int as libc::c_uint
); );
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1 as libc::c_int) as isize)) (*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).end_mark =
.end_mark = (*event).end_mark; (*event).end_mark;
let fresh31 = addr_of_mut!((*ctx).top); let fresh31 = addr_of_mut!((*ctx).top);
*fresh31 = (*fresh31).wrapping_offset(-1); *fresh31 = (*fresh31).wrapping_offset(-1);
1 as libc::c_int 1_i32
} }
unsafe fn yaml_parser_load_mapping( unsafe fn yaml_parser_load_mapping(
mut parser: *mut yaml_parser_t, mut parser: *mut yaml_parser_t,
@ -798,19 +790,19 @@ unsafe fn yaml_parser_load_mapping(
let mut tag: *mut yaml_char_t = (*event).data.mapping_start.tag; let mut tag: *mut yaml_char_t = (*event).data.mapping_start.tag;
if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.start) if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.start)
as libc::c_long) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
if tag.is_null() if tag.is_null()
|| strcmp( || strcmp(
tag as *mut libc::c_char, tag as *mut libc::c_char,
b"!\0" as *const u8 as *const libc::c_char, b"!\0" as *const u8 as *const libc::c_char,
) == 0 as libc::c_int ) == 0_i32
{ {
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
tag = yaml_strdup( tag = yaml_strdup(
@ -827,24 +819,22 @@ unsafe fn yaml_parser_load_mapping(
match current_block { match current_block {
13635467803606088781 => {} 13635467803606088781 => {}
_ => { _ => {
pairs.start = pairs.start = yaml_malloc(
yaml_malloc((16 as libc::c_int as libc::c_ulong).wrapping_mul(size_of::< (16_i32 as libc::c_ulong)
yaml_node_pair_t, .wrapping_mul(size_of::<yaml_node_pair_t>() as libc::c_ulong),
>( ) as *mut yaml_node_pair_t;
)
as libc::c_ulong)) as *mut yaml_node_pair_t;
if !(if !(pairs.start).is_null() { if !(if !(pairs.start).is_null() {
pairs.top = pairs.start; pairs.top = pairs.start;
pairs.end = (pairs.start).wrapping_offset(16 as libc::c_int as isize); pairs.end = (pairs.start).wrapping_offset(16_i32 as isize);
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
memset( memset(
addr_of_mut!(node) as *mut libc::c_void, addr_of_mut!(node) as *mut libc::c_void,
0 as libc::c_int, 0_i32,
size_of::<yaml_node_t>() as libc::c_ulong, size_of::<yaml_node_t>() as libc::c_ulong,
); );
node.type_0 = YAML_MAPPING_NODE; node.type_0 = YAML_MAPPING_NODE;
@ -867,10 +857,10 @@ unsafe fn yaml_parser_load_mapping(
let fresh33 = *fresh32; let fresh33 = *fresh32;
*fresh32 = (*fresh32).wrapping_offset(1); *fresh32 = (*fresh32).wrapping_offset(1);
*fresh33 = node; *fresh33 = node;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0) } == 0)
{ {
index = ((*(*parser).document).nodes.top) index = ((*(*parser).document).nodes.top)
@ -882,21 +872,21 @@ unsafe fn yaml_parser_load_mapping(
(*event).data.mapping_start.anchor, (*event).data.mapping_start.anchor,
) == 0 ) == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if yaml_parser_load_node_add(parser, ctx, index) == 0 { if yaml_parser_load_node_add(parser, ctx, index) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
if if (((*ctx).top).c_offset_from((*ctx).start) as libc::c_long) if if (((*ctx).top).c_offset_from((*ctx).start) as libc::c_long)
< (2147483647 as libc::c_int - 1 as libc::c_int) as libc::c_long < (2147483647_i32 - 1_i32) as libc::c_long
{ {
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
if if (*ctx).top != (*ctx).end if if (*ctx).top != (*ctx).end
|| yaml_stack_extend( || yaml_stack_extend(
@ -909,15 +899,15 @@ unsafe fn yaml_parser_load_mapping(
let fresh35 = *fresh34; let fresh35 = *fresh34;
*fresh34 = (*fresh34).wrapping_offset(1); *fresh34 = (*fresh34).wrapping_offset(1);
*fresh35 = index; *fresh35 = index;
1 as libc::c_int 1_i32
} else { } else {
(*parser).error = YAML_MEMORY_ERROR; (*parser).error = YAML_MEMORY_ERROR;
0 as libc::c_int 0_i32
} == 0 } == 0
{ {
return 0 as libc::c_int; return 0_i32;
} }
return 1 as libc::c_int; return 1_i32;
} }
} }
} }
@ -925,25 +915,23 @@ unsafe fn yaml_parser_load_mapping(
} }
yaml_free(tag as *mut libc::c_void); yaml_free(tag as *mut libc::c_void);
yaml_free((*event).data.mapping_start.anchor as *mut libc::c_void); yaml_free((*event).data.mapping_start.anchor as *mut libc::c_void);
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_load_mapping_end( unsafe fn yaml_parser_load_mapping_end(
parser: *mut yaml_parser_t, parser: *mut yaml_parser_t,
event: *mut yaml_event_t, event: *mut yaml_event_t,
ctx: *mut loader_ctx, ctx: *mut loader_ctx,
) -> libc::c_int { ) -> libc::c_int {
__assert!(((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0_i32 as libc::c_long);
let index: libc::c_int = *((*ctx).top).wrapping_offset(-(1_i32 as isize));
__assert!( __assert!(
((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0 as libc::c_int as libc::c_long (*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).type_0
); as libc::c_uint
let index: libc::c_int = *((*ctx).top).wrapping_offset(-(1 as libc::c_int as isize));
__assert!(
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1 as libc::c_int) as isize))
.type_0 as libc::c_uint
== YAML_MAPPING_NODE as libc::c_int as libc::c_uint == YAML_MAPPING_NODE as libc::c_int as libc::c_uint
); );
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1 as libc::c_int) as isize)) (*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).end_mark =
.end_mark = (*event).end_mark; (*event).end_mark;
let fresh36 = addr_of_mut!((*ctx).top); let fresh36 = addr_of_mut!((*ctx).top);
*fresh36 = (*fresh36).wrapping_offset(-1); *fresh36 = (*fresh36).wrapping_offset(-1);
1 as libc::c_int 1_i32
} }

File diff suppressed because it is too large Load diff

View file

@ -15,75 +15,75 @@ unsafe fn yaml_parser_set_reader_error(
*fresh0 = problem; *fresh0 = problem;
(*parser).problem_offset = offset; (*parser).problem_offset = offset;
(*parser).problem_value = value; (*parser).problem_value = value;
0 as libc::c_int 0_i32
} }
unsafe fn yaml_parser_determine_encoding(mut parser: *mut yaml_parser_t) -> libc::c_int { unsafe fn yaml_parser_determine_encoding(mut parser: *mut yaml_parser_t) -> libc::c_int {
while (*parser).eof == 0 while (*parser).eof == 0
&& (((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) as libc::c_long) && (((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) as libc::c_long)
< 3 as libc::c_int as libc::c_long < 3_i32 as libc::c_long
{ {
if yaml_parser_update_raw_buffer(parser) == 0 { if yaml_parser_update_raw_buffer(parser) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
if ((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) as libc::c_long if ((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) as libc::c_long
>= 2 as libc::c_int as libc::c_long >= 2_i32 as libc::c_long
&& memcmp( && memcmp(
(*parser).raw_buffer.pointer as *const libc::c_void, (*parser).raw_buffer.pointer as *const libc::c_void,
b"\xFF\xFE\0" as *const u8 as *const libc::c_char as *const libc::c_void, b"\xFF\xFE\0" as *const u8 as *const libc::c_char as *const libc::c_void,
2 as libc::c_int as libc::c_ulong, 2_i32 as libc::c_ulong,
) == 0 ) == 0
{ {
(*parser).encoding = YAML_UTF16LE_ENCODING; (*parser).encoding = YAML_UTF16LE_ENCODING;
let fresh1 = addr_of_mut!((*parser).raw_buffer.pointer); let fresh1 = addr_of_mut!((*parser).raw_buffer.pointer);
*fresh1 = (*fresh1).wrapping_offset(2 as libc::c_int as isize); *fresh1 = (*fresh1).wrapping_offset(2_i32 as isize);
let fresh2 = addr_of_mut!((*parser).offset); let fresh2 = addr_of_mut!((*parser).offset);
*fresh2 = (*fresh2 as libc::c_ulong).wrapping_add(2 as libc::c_int as libc::c_ulong) *fresh2 =
as size_t as size_t; (*fresh2 as libc::c_ulong).wrapping_add(2_i32 as libc::c_ulong) as size_t as size_t;
} else if ((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) } else if ((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer)
as libc::c_long as libc::c_long
>= 2 as libc::c_int as libc::c_long >= 2_i32 as libc::c_long
&& memcmp( && memcmp(
(*parser).raw_buffer.pointer as *const libc::c_void, (*parser).raw_buffer.pointer as *const libc::c_void,
b"\xFE\xFF\0" as *const u8 as *const libc::c_char as *const libc::c_void, b"\xFE\xFF\0" as *const u8 as *const libc::c_char as *const libc::c_void,
2 as libc::c_int as libc::c_ulong, 2_i32 as libc::c_ulong,
) == 0 ) == 0
{ {
(*parser).encoding = YAML_UTF16BE_ENCODING; (*parser).encoding = YAML_UTF16BE_ENCODING;
let fresh3 = addr_of_mut!((*parser).raw_buffer.pointer); let fresh3 = addr_of_mut!((*parser).raw_buffer.pointer);
*fresh3 = (*fresh3).wrapping_offset(2 as libc::c_int as isize); *fresh3 = (*fresh3).wrapping_offset(2_i32 as isize);
let fresh4 = addr_of_mut!((*parser).offset); let fresh4 = addr_of_mut!((*parser).offset);
*fresh4 = (*fresh4 as libc::c_ulong).wrapping_add(2 as libc::c_int as libc::c_ulong) *fresh4 =
as size_t as size_t; (*fresh4 as libc::c_ulong).wrapping_add(2_i32 as libc::c_ulong) as size_t as size_t;
} else if ((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) } else if ((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer)
as libc::c_long as libc::c_long
>= 3 as libc::c_int as libc::c_long >= 3_i32 as libc::c_long
&& memcmp( && memcmp(
(*parser).raw_buffer.pointer as *const libc::c_void, (*parser).raw_buffer.pointer as *const libc::c_void,
b"\xEF\xBB\xBF\0" as *const u8 as *const libc::c_char as *const libc::c_void, b"\xEF\xBB\xBF\0" as *const u8 as *const libc::c_char as *const libc::c_void,
3 as libc::c_int as libc::c_ulong, 3_i32 as libc::c_ulong,
) == 0 ) == 0
{ {
(*parser).encoding = YAML_UTF8_ENCODING; (*parser).encoding = YAML_UTF8_ENCODING;
let fresh5 = addr_of_mut!((*parser).raw_buffer.pointer); let fresh5 = addr_of_mut!((*parser).raw_buffer.pointer);
*fresh5 = (*fresh5).wrapping_offset(3 as libc::c_int as isize); *fresh5 = (*fresh5).wrapping_offset(3_i32 as isize);
let fresh6 = addr_of_mut!((*parser).offset); let fresh6 = addr_of_mut!((*parser).offset);
*fresh6 = (*fresh6 as libc::c_ulong).wrapping_add(3 as libc::c_int as libc::c_ulong) *fresh6 =
as size_t as size_t; (*fresh6 as libc::c_ulong).wrapping_add(3_i32 as libc::c_ulong) as size_t as size_t;
} else { } else {
(*parser).encoding = YAML_UTF8_ENCODING; (*parser).encoding = YAML_UTF8_ENCODING;
} }
1 as libc::c_int 1_i32
} }
unsafe fn yaml_parser_update_raw_buffer(mut parser: *mut yaml_parser_t) -> libc::c_int { unsafe fn yaml_parser_update_raw_buffer(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut size_read: size_t = 0 as libc::c_int as size_t; let mut size_read: size_t = 0_i32 as size_t;
if (*parser).raw_buffer.start == (*parser).raw_buffer.pointer if (*parser).raw_buffer.start == (*parser).raw_buffer.pointer
&& (*parser).raw_buffer.last == (*parser).raw_buffer.end && (*parser).raw_buffer.last == (*parser).raw_buffer.end
{ {
return 1 as libc::c_int; return 1_i32;
} }
if (*parser).eof != 0 { if (*parser).eof != 0 {
return 1 as libc::c_int; return 1_i32;
} }
if (*parser).raw_buffer.start < (*parser).raw_buffer.pointer if (*parser).raw_buffer.start < (*parser).raw_buffer.pointer
&& (*parser).raw_buffer.pointer < (*parser).raw_buffer.last && (*parser).raw_buffer.pointer < (*parser).raw_buffer.last
@ -114,28 +114,28 @@ unsafe fn yaml_parser_update_raw_buffer(mut parser: *mut yaml_parser_t) -> libc:
parser, parser,
b"input error\0" as *const u8 as *const libc::c_char, b"input error\0" as *const u8 as *const libc::c_char,
(*parser).offset, (*parser).offset,
-(1 as libc::c_int), -1_i32,
); );
} }
let fresh9 = addr_of_mut!((*parser).raw_buffer.last); let fresh9 = addr_of_mut!((*parser).raw_buffer.last);
*fresh9 = (*fresh9).wrapping_offset(size_read as isize); *fresh9 = (*fresh9).wrapping_offset(size_read as isize);
if size_read == 0 { if size_read == 0 {
(*parser).eof = 1 as libc::c_int; (*parser).eof = 1_i32;
} }
1 as libc::c_int 1_i32
} }
pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size_t) -> libc::c_int { pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size_t) -> libc::c_int {
let mut first: libc::c_int = 1 as libc::c_int; let mut first: libc::c_int = 1_i32;
__assert!(((*parser).read_handler).is_some()); __assert!(((*parser).read_handler).is_some());
if (*parser).eof != 0 && (*parser).raw_buffer.pointer == (*parser).raw_buffer.last { if (*parser).eof != 0 && (*parser).raw_buffer.pointer == (*parser).raw_buffer.last {
return 1 as libc::c_int; return 1_i32;
} }
if (*parser).unread >= length { if (*parser).unread >= length {
return 1 as libc::c_int; return 1_i32;
} }
if (*parser).encoding as u64 == 0 { if (*parser).encoding as u64 == 0 {
if yaml_parser_determine_encoding(parser) == 0 { if yaml_parser_determine_encoding(parser) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
if (*parser).buffer.start < (*parser).buffer.pointer if (*parser).buffer.start < (*parser).buffer.pointer
@ -161,16 +161,16 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
while (*parser).unread < length { while (*parser).unread < length {
if first == 0 || (*parser).raw_buffer.pointer == (*parser).raw_buffer.last { if first == 0 || (*parser).raw_buffer.pointer == (*parser).raw_buffer.last {
if yaml_parser_update_raw_buffer(parser) == 0 { if yaml_parser_update_raw_buffer(parser) == 0 {
return 0 as libc::c_int; return 0_i32;
} }
} }
first = 0 as libc::c_int; first = 0_i32;
while (*parser).raw_buffer.pointer != (*parser).raw_buffer.last { while (*parser).raw_buffer.pointer != (*parser).raw_buffer.last {
let mut value: libc::c_uint = 0 as libc::c_int as libc::c_uint; let mut value: libc::c_uint = 0_i32 as libc::c_uint;
let value2: libc::c_uint; let value2: libc::c_uint;
let mut incomplete: libc::c_int = 0 as libc::c_int; let mut incomplete: libc::c_int = 0_i32;
let mut octet: libc::c_uchar; let mut octet: libc::c_uchar;
let mut width: libc::c_uint = 0 as libc::c_int as libc::c_uint; let mut width: libc::c_uint = 0_i32 as libc::c_uint;
let low: libc::c_int; let low: libc::c_int;
let high: libc::c_int; let high: libc::c_int;
let mut k: size_t; let mut k: size_t;
@ -179,18 +179,17 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
as libc::c_long as size_t; as libc::c_long as size_t;
match (*parser).encoding as libc::c_uint { match (*parser).encoding as libc::c_uint {
1 => { 1 => {
octet = octet = *((*parser).raw_buffer.pointer).wrapping_offset(0_i32 as isize);
*((*parser).raw_buffer.pointer).wrapping_offset(0 as libc::c_int as isize); width = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
width = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int { 1_i32
1 as libc::c_int } else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int { 2_i32
2 as libc::c_int } else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int { 3_i32
3 as libc::c_int } else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
} else if octet as libc::c_int & 0xf8 as libc::c_int == 0xf0 as libc::c_int { 4_i32
4 as libc::c_int
} else { } else {
0 as libc::c_int 0_i32
}) as libc::c_uint; }) as libc::c_uint;
if width == 0 { if width == 0 {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
@ -207,29 +206,26 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
b"incomplete UTF-8 octet sequence\0" as *const u8 b"incomplete UTF-8 octet sequence\0" as *const u8
as *const libc::c_char, as *const libc::c_char,
(*parser).offset, (*parser).offset,
-(1 as libc::c_int), -1_i32,
); );
} }
incomplete = 1 as libc::c_int; incomplete = 1_i32;
} else { } else {
value = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int { value = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
octet as libc::c_int & 0x7f as libc::c_int octet as libc::c_int & 0x7f_i32
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int } else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
{ octet as libc::c_int & 0x1f_i32
octet as libc::c_int & 0x1f as libc::c_int } else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int octet as libc::c_int & 0xf_i32
{ } else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
octet as libc::c_int & 0xf as libc::c_int octet as libc::c_int & 0x7_i32
} else if octet as libc::c_int & 0xf8 as libc::c_int == 0xf0 as libc::c_int
{
octet as libc::c_int & 0x7 as libc::c_int
} else { } else {
0 as libc::c_int 0_i32
}) as libc::c_uint; }) as libc::c_uint;
k = 1 as libc::c_int as size_t; k = 1_i32 as size_t;
while k < width as libc::c_ulong { while k < width as libc::c_ulong {
octet = *((*parser).raw_buffer.pointer).wrapping_offset(k as isize); octet = *((*parser).raw_buffer.pointer).wrapping_offset(k as isize);
if octet as libc::c_int & 0xc0 as libc::c_int != 0x80 as libc::c_int { if octet as libc::c_int & 0xc0_i32 != 0x80_i32 {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"invalid trailing UTF-8 octet\0" as *const u8 b"invalid trailing UTF-8 octet\0" as *const u8
@ -238,30 +234,27 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
octet as libc::c_int, octet as libc::c_int,
); );
} }
value = (value << 6 as libc::c_int).wrapping_add( value = (value << 6_i32)
(octet as libc::c_int & 0x3f as libc::c_int) as libc::c_uint, .wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
);
k = k.wrapping_add(1); k = k.wrapping_add(1);
} }
if !(width == 1 as libc::c_int as libc::c_uint if !(width == 1_i32 as libc::c_uint
|| width == 2 as libc::c_int as libc::c_uint || width == 2_i32 as libc::c_uint && value >= 0x80_i32 as libc::c_uint
&& value >= 0x80 as libc::c_int as libc::c_uint || width == 3_i32 as libc::c_uint && value >= 0x800_i32 as libc::c_uint
|| width == 3 as libc::c_int as libc::c_uint || width == 4_i32 as libc::c_uint
&& value >= 0x800 as libc::c_int as libc::c_uint && value >= 0x10000_i32 as libc::c_uint)
|| width == 4 as libc::c_int as libc::c_uint
&& value >= 0x10000 as libc::c_int as libc::c_uint)
{ {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"invalid length of a UTF-8 sequence\0" as *const u8 b"invalid length of a UTF-8 sequence\0" as *const u8
as *const libc::c_char, as *const libc::c_char,
(*parser).offset, (*parser).offset,
-(1 as libc::c_int), -1_i32,
); );
} }
if value >= 0xd800 as libc::c_int as libc::c_uint if value >= 0xd800_i32 as libc::c_uint
&& value <= 0xdfff as libc::c_int as libc::c_uint && value <= 0xdfff_i32 as libc::c_uint
|| value > 0x10ffff as libc::c_int as libc::c_uint || value > 0x10ffff_i32 as libc::c_uint
{ {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
@ -276,38 +269,35 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
low = if (*parser).encoding as libc::c_uint low = if (*parser).encoding as libc::c_uint
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint == YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
{ {
0 as libc::c_int 0_i32
} else { } else {
1 as libc::c_int 1_i32
}; };
high = if (*parser).encoding as libc::c_uint high = if (*parser).encoding as libc::c_uint
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint == YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
{ {
1 as libc::c_int 1_i32
} else { } else {
0 as libc::c_int 0_i32
}; };
if raw_unread < 2 as libc::c_int as libc::c_ulong { if raw_unread < 2_i32 as libc::c_ulong {
if (*parser).eof != 0 { if (*parser).eof != 0 {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"incomplete UTF-16 character\0" as *const u8 b"incomplete UTF-16 character\0" as *const u8
as *const libc::c_char, as *const libc::c_char,
(*parser).offset, (*parser).offset,
-(1 as libc::c_int), -1_i32,
); );
} }
incomplete = 1 as libc::c_int; incomplete = 1_i32;
} else { } else {
value = (*((*parser).raw_buffer.pointer).wrapping_offset(low as isize) value = (*((*parser).raw_buffer.pointer).wrapping_offset(low as isize)
as libc::c_int as libc::c_int
+ ((*((*parser).raw_buffer.pointer).wrapping_offset(high as isize) + ((*((*parser).raw_buffer.pointer).wrapping_offset(high as isize)
as libc::c_int) as libc::c_int)
<< 8 as libc::c_int)) << 8_i32)) as libc::c_uint;
as libc::c_uint; if value & 0xfc00_i32 as libc::c_uint == 0xdc00_i32 as libc::c_uint {
if value & 0xfc00 as libc::c_int as libc::c_uint
== 0xdc00 as libc::c_int as libc::c_uint
{
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"unexpected low surrogate area\0" as *const u8 b"unexpected low surrogate area\0" as *const u8
@ -316,51 +306,44 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
value as libc::c_int, value as libc::c_int,
); );
} }
if value & 0xfc00 as libc::c_int as libc::c_uint if value & 0xfc00_i32 as libc::c_uint == 0xd800_i32 as libc::c_uint {
== 0xd800 as libc::c_int as libc::c_uint width = 4_i32 as libc::c_uint;
{ if raw_unread < 4_i32 as libc::c_ulong {
width = 4 as libc::c_int as libc::c_uint;
if raw_unread < 4 as libc::c_int as libc::c_ulong {
if (*parser).eof != 0 { if (*parser).eof != 0 {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"incomplete UTF-16 surrogate pair\0" as *const u8 b"incomplete UTF-16 surrogate pair\0" as *const u8
as *const libc::c_char, as *const libc::c_char,
(*parser).offset, (*parser).offset,
-(1 as libc::c_int), -1_i32,
); );
} }
incomplete = 1 as libc::c_int; incomplete = 1_i32;
} else { } else {
value2 = (*((*parser).raw_buffer.pointer) value2 = (*((*parser).raw_buffer.pointer)
.wrapping_offset((low + 2 as libc::c_int) as isize) .wrapping_offset((low + 2_i32) as isize)
as libc::c_int as libc::c_int
+ ((*((*parser).raw_buffer.pointer) + ((*((*parser).raw_buffer.pointer)
.wrapping_offset((high + 2 as libc::c_int) as isize) .wrapping_offset((high + 2_i32) as isize)
as libc::c_int) as libc::c_int)
<< 8 as libc::c_int)) << 8_i32))
as libc::c_uint; as libc::c_uint;
if value2 & 0xfc00 as libc::c_int as libc::c_uint if value2 & 0xfc00_i32 as libc::c_uint != 0xdc00_i32 as libc::c_uint
!= 0xdc00 as libc::c_int as libc::c_uint
{ {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"expected low surrogate area\0" as *const u8 b"expected low surrogate area\0" as *const u8
as *const libc::c_char, as *const libc::c_char,
((*parser).offset) ((*parser).offset).wrapping_add(2_i32 as libc::c_ulong),
.wrapping_add(2 as libc::c_int as libc::c_ulong),
value2 as libc::c_int, value2 as libc::c_int,
); );
} }
value = (0x10000 as libc::c_int as libc::c_uint) value = (0x10000_i32 as libc::c_uint)
.wrapping_add( .wrapping_add((value & 0x3ff_i32 as libc::c_uint) << 10_i32)
(value & 0x3ff as libc::c_int as libc::c_uint) .wrapping_add(value2 & 0x3ff_i32 as libc::c_uint);
<< 10 as libc::c_int,
)
.wrapping_add(value2 & 0x3ff as libc::c_int as libc::c_uint);
} }
} else { } else {
width = 2 as libc::c_int as libc::c_uint; width = 2_i32 as libc::c_uint;
} }
} }
} }
@ -369,18 +352,14 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
if incomplete != 0 { if incomplete != 0 {
break; break;
} }
if !(value == 0x9 as libc::c_int as libc::c_uint if !(value == 0x9_i32 as libc::c_uint
|| value == 0xa as libc::c_int as libc::c_uint || value == 0xa_i32 as libc::c_uint
|| value == 0xd as libc::c_int as libc::c_uint || value == 0xd_i32 as libc::c_uint
|| value >= 0x20 as libc::c_int as libc::c_uint || value >= 0x20_i32 as libc::c_uint && value <= 0x7e_i32 as libc::c_uint
&& value <= 0x7e as libc::c_int as libc::c_uint || value == 0x85_i32 as libc::c_uint
|| value == 0x85 as libc::c_int as libc::c_uint || value >= 0xa0_i32 as libc::c_uint && value <= 0xd7ff_i32 as libc::c_uint
|| value >= 0xa0 as libc::c_int as libc::c_uint || value >= 0xe000_i32 as libc::c_uint && value <= 0xfffd_i32 as libc::c_uint
&& value <= 0xd7ff as libc::c_int as libc::c_uint || value >= 0x10000_i32 as libc::c_uint && value <= 0x10ffff_i32 as libc::c_uint)
|| value >= 0xe000 as libc::c_int as libc::c_uint
&& value <= 0xfffd as libc::c_int as libc::c_uint
|| value >= 0x10000 as libc::c_int as libc::c_uint
&& value <= 0x10ffff as libc::c_int as libc::c_uint)
{ {
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
@ -394,67 +373,58 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
let fresh15 = addr_of_mut!((*parser).offset); let fresh15 = addr_of_mut!((*parser).offset);
*fresh15 = (*fresh15 as libc::c_ulong).wrapping_add(width as libc::c_ulong) as size_t *fresh15 = (*fresh15 as libc::c_ulong).wrapping_add(width as libc::c_ulong) as size_t
as size_t; as size_t;
if value <= 0x7f as libc::c_int as libc::c_uint { if value <= 0x7f_i32 as libc::c_uint {
let fresh16 = addr_of_mut!((*parser).buffer.last); let fresh16 = addr_of_mut!((*parser).buffer.last);
let fresh17 = *fresh16; let fresh17 = *fresh16;
*fresh16 = (*fresh16).wrapping_offset(1); *fresh16 = (*fresh16).wrapping_offset(1);
*fresh17 = value as yaml_char_t; *fresh17 = value as yaml_char_t;
} else if value <= 0x7ff as libc::c_int as libc::c_uint { } else if value <= 0x7ff_i32 as libc::c_uint {
let fresh18 = addr_of_mut!((*parser).buffer.last); let fresh18 = addr_of_mut!((*parser).buffer.last);
let fresh19 = *fresh18; let fresh19 = *fresh18;
*fresh18 = (*fresh18).wrapping_offset(1); *fresh18 = (*fresh18).wrapping_offset(1);
*fresh19 = (0xc0 as libc::c_int as libc::c_uint) *fresh19 = (0xc0_i32 as libc::c_uint).wrapping_add(value >> 6_i32) as yaml_char_t;
.wrapping_add(value >> 6 as libc::c_int)
as yaml_char_t;
let fresh20 = addr_of_mut!((*parser).buffer.last); let fresh20 = addr_of_mut!((*parser).buffer.last);
let fresh21 = *fresh20; let fresh21 = *fresh20;
*fresh20 = (*fresh20).wrapping_offset(1); *fresh20 = (*fresh20).wrapping_offset(1);
*fresh21 = (0x80 as libc::c_int as libc::c_uint) *fresh21 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
.wrapping_add(value & 0x3f as libc::c_int as libc::c_uint)
as yaml_char_t; as yaml_char_t;
} else if value <= 0xffff as libc::c_int as libc::c_uint { } else if value <= 0xffff_i32 as libc::c_uint {
let fresh22 = addr_of_mut!((*parser).buffer.last); let fresh22 = addr_of_mut!((*parser).buffer.last);
let fresh23 = *fresh22; let fresh23 = *fresh22;
*fresh22 = (*fresh22).wrapping_offset(1); *fresh22 = (*fresh22).wrapping_offset(1);
*fresh23 = (0xe0 as libc::c_int as libc::c_uint) *fresh23 = (0xe0_i32 as libc::c_uint).wrapping_add(value >> 12_i32) as yaml_char_t;
.wrapping_add(value >> 12 as libc::c_int)
as yaml_char_t;
let fresh24 = addr_of_mut!((*parser).buffer.last); let fresh24 = addr_of_mut!((*parser).buffer.last);
let fresh25 = *fresh24; let fresh25 = *fresh24;
*fresh24 = (*fresh24).wrapping_offset(1); *fresh24 = (*fresh24).wrapping_offset(1);
*fresh25 = (0x80 as libc::c_int as libc::c_uint) *fresh25 = (0x80_i32 as libc::c_uint)
.wrapping_add(value >> 6 as libc::c_int & 0x3f as libc::c_int as libc::c_uint) .wrapping_add(value >> 6_i32 & 0x3f_i32 as libc::c_uint)
as yaml_char_t; as yaml_char_t;
let fresh26 = addr_of_mut!((*parser).buffer.last); let fresh26 = addr_of_mut!((*parser).buffer.last);
let fresh27 = *fresh26; let fresh27 = *fresh26;
*fresh26 = (*fresh26).wrapping_offset(1); *fresh26 = (*fresh26).wrapping_offset(1);
*fresh27 = (0x80 as libc::c_int as libc::c_uint) *fresh27 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
.wrapping_add(value & 0x3f as libc::c_int as libc::c_uint)
as yaml_char_t; as yaml_char_t;
} else { } else {
let fresh28 = addr_of_mut!((*parser).buffer.last); let fresh28 = addr_of_mut!((*parser).buffer.last);
let fresh29 = *fresh28; let fresh29 = *fresh28;
*fresh28 = (*fresh28).wrapping_offset(1); *fresh28 = (*fresh28).wrapping_offset(1);
*fresh29 = (0xf0 as libc::c_int as libc::c_uint) *fresh29 = (0xf0_i32 as libc::c_uint).wrapping_add(value >> 18_i32) as yaml_char_t;
.wrapping_add(value >> 18 as libc::c_int)
as yaml_char_t;
let fresh30 = addr_of_mut!((*parser).buffer.last); let fresh30 = addr_of_mut!((*parser).buffer.last);
let fresh31 = *fresh30; let fresh31 = *fresh30;
*fresh30 = (*fresh30).wrapping_offset(1); *fresh30 = (*fresh30).wrapping_offset(1);
*fresh31 = (0x80 as libc::c_int as libc::c_uint) *fresh31 = (0x80_i32 as libc::c_uint)
.wrapping_add(value >> 12 as libc::c_int & 0x3f as libc::c_int as libc::c_uint) .wrapping_add(value >> 12_i32 & 0x3f_i32 as libc::c_uint)
as yaml_char_t; as yaml_char_t;
let fresh32 = addr_of_mut!((*parser).buffer.last); let fresh32 = addr_of_mut!((*parser).buffer.last);
let fresh33 = *fresh32; let fresh33 = *fresh32;
*fresh32 = (*fresh32).wrapping_offset(1); *fresh32 = (*fresh32).wrapping_offset(1);
*fresh33 = (0x80 as libc::c_int as libc::c_uint) *fresh33 = (0x80_i32 as libc::c_uint)
.wrapping_add(value >> 6 as libc::c_int & 0x3f as libc::c_int as libc::c_uint) .wrapping_add(value >> 6_i32 & 0x3f_i32 as libc::c_uint)
as yaml_char_t; as yaml_char_t;
let fresh34 = addr_of_mut!((*parser).buffer.last); let fresh34 = addr_of_mut!((*parser).buffer.last);
let fresh35 = *fresh34; let fresh35 = *fresh34;
*fresh34 = (*fresh34).wrapping_offset(1); *fresh34 = (*fresh34).wrapping_offset(1);
*fresh35 = (0x80 as libc::c_int as libc::c_uint) *fresh35 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
.wrapping_add(value & 0x3f as libc::c_int as libc::c_uint)
as yaml_char_t; as yaml_char_t;
} }
let fresh36 = addr_of_mut!((*parser).unread); let fresh36 = addr_of_mut!((*parser).unread);
@ -467,18 +437,16 @@ pub unsafe fn yaml_parser_update_buffer(parser: *mut yaml_parser_t, length: size
*fresh38 = '\0' as i32 as yaml_char_t; *fresh38 = '\0' as i32 as yaml_char_t;
let fresh39 = addr_of_mut!((*parser).unread); let fresh39 = addr_of_mut!((*parser).unread);
*fresh39 = (*fresh39).wrapping_add(1); *fresh39 = (*fresh39).wrapping_add(1);
return 1 as libc::c_int; return 1_i32;
} }
} }
if (*parser).offset if (*parser).offset >= (!(0_i32 as size_t)).wrapping_div(2_i32 as libc::c_ulong) {
>= (!(0 as libc::c_int as size_t)).wrapping_div(2 as libc::c_int as libc::c_ulong)
{
return yaml_parser_set_reader_error( return yaml_parser_set_reader_error(
parser, parser,
b"input is too long\0" as *const u8 as *const libc::c_char, b"input is too long\0" as *const u8 as *const libc::c_char,
(*parser).offset, (*parser).offset,
-(1 as libc::c_int), -1_i32,
); );
} }
1 as libc::c_int 1_i32
} }

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@ unsafe fn yaml_emitter_set_writer_error(
(*emitter).error = YAML_WRITER_ERROR; (*emitter).error = YAML_WRITER_ERROR;
let fresh0 = addr_of_mut!((*emitter).problem); let fresh0 = addr_of_mut!((*emitter).problem);
*fresh0 = problem; *fresh0 = problem;
0 as libc::c_int 0_i32
} }
pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int { pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
__assert!(!emitter.is_null()); __assert!(!emitter.is_null());
@ -21,7 +21,7 @@ pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
let fresh2 = addr_of_mut!((*emitter).buffer.pointer); let fresh2 = addr_of_mut!((*emitter).buffer.pointer);
*fresh2 = (*emitter).buffer.start; *fresh2 = (*emitter).buffer.start;
if (*emitter).buffer.start == (*emitter).buffer.last { if (*emitter).buffer.start == (*emitter).buffer.last {
return 1 as libc::c_int; return 1_i32;
} }
if (*emitter).encoding as libc::c_uint == YAML_UTF8_ENCODING as libc::c_int as libc::c_uint { if (*emitter).encoding as libc::c_uint == YAML_UTF8_ENCODING as libc::c_int as libc::c_uint {
if ((*emitter).write_handler).expect("non-null function pointer")( if ((*emitter).write_handler).expect("non-null function pointer")(
@ -35,7 +35,7 @@ pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
*fresh3 = (*emitter).buffer.start; *fresh3 = (*emitter).buffer.start;
let fresh4 = addr_of_mut!((*emitter).buffer.pointer); let fresh4 = addr_of_mut!((*emitter).buffer.pointer);
*fresh4 = (*emitter).buffer.start; *fresh4 = (*emitter).buffer.start;
return 1 as libc::c_int; return 1_i32;
} else { } else {
return yaml_emitter_set_writer_error( return yaml_emitter_set_writer_error(
emitter, emitter,
@ -46,76 +46,73 @@ pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
let low: libc::c_int = if (*emitter).encoding as libc::c_uint let low: libc::c_int = if (*emitter).encoding as libc::c_uint
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint == YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
{ {
0 as libc::c_int 0_i32
} else { } else {
1 as libc::c_int 1_i32
}; };
let high: libc::c_int = if (*emitter).encoding as libc::c_uint let high: libc::c_int = if (*emitter).encoding as libc::c_uint
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint == YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
{ {
1 as libc::c_int 1_i32
} else { } else {
0 as libc::c_int 0_i32
}; };
while (*emitter).buffer.pointer != (*emitter).buffer.last { while (*emitter).buffer.pointer != (*emitter).buffer.last {
let mut octet: libc::c_uchar; let mut octet: libc::c_uchar;
let mut value: libc::c_uint; let mut value: libc::c_uint;
let mut k: size_t; let mut k: size_t;
octet = *((*emitter).buffer.pointer).wrapping_offset(0 as libc::c_int as isize); octet = *((*emitter).buffer.pointer).wrapping_offset(0_i32 as isize);
let width: libc::c_uint = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int let width: libc::c_uint = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
{ 1_i32
1 as libc::c_int } else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int { 2_i32
2 as libc::c_int } else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int { 3_i32
3 as libc::c_int } else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
} else if octet as libc::c_int & 0xf8 as libc::c_int == 0xf0 as libc::c_int { 4_i32
4 as libc::c_int
} else { } else {
0 as libc::c_int 0_i32
}) as libc::c_uint; }) as libc::c_uint;
value = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int { value = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
octet as libc::c_int & 0x7f as libc::c_int octet as libc::c_int & 0x7f_i32
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int { } else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
octet as libc::c_int & 0x1f as libc::c_int octet as libc::c_int & 0x1f_i32
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int { } else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
octet as libc::c_int & 0xf as libc::c_int octet as libc::c_int & 0xf_i32
} else if octet as libc::c_int & 0xf8 as libc::c_int == 0xf0 as libc::c_int { } else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
octet as libc::c_int & 0x7 as libc::c_int octet as libc::c_int & 0x7_i32
} else { } else {
0 as libc::c_int 0_i32
}) as libc::c_uint; }) as libc::c_uint;
k = 1 as libc::c_int as size_t; k = 1_i32 as size_t;
while k < width as libc::c_ulong { while k < width as libc::c_ulong {
octet = *((*emitter).buffer.pointer).wrapping_offset(k as isize); octet = *((*emitter).buffer.pointer).wrapping_offset(k as isize);
value = (value << 6 as libc::c_int) value =
.wrapping_add((octet as libc::c_int & 0x3f as libc::c_int) as libc::c_uint); (value << 6_i32).wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
k = k.wrapping_add(1); k = k.wrapping_add(1);
} }
let fresh5 = addr_of_mut!((*emitter).buffer.pointer); let fresh5 = addr_of_mut!((*emitter).buffer.pointer);
*fresh5 = (*fresh5).wrapping_offset(width as isize); *fresh5 = (*fresh5).wrapping_offset(width as isize);
if value < 0x10000 as libc::c_int as libc::c_uint { if value < 0x10000_i32 as libc::c_uint {
*((*emitter).raw_buffer.last).wrapping_offset(high as isize) = *((*emitter).raw_buffer.last).wrapping_offset(high as isize) =
(value >> 8 as libc::c_int) as libc::c_uchar; (value >> 8_i32) as libc::c_uchar;
*((*emitter).raw_buffer.last).wrapping_offset(low as isize) = *((*emitter).raw_buffer.last).wrapping_offset(low as isize) =
(value & 0xff as libc::c_int as libc::c_uint) as libc::c_uchar; (value & 0xff_i32 as libc::c_uint) as libc::c_uchar;
let fresh6 = addr_of_mut!((*emitter).raw_buffer.last); let fresh6 = addr_of_mut!((*emitter).raw_buffer.last);
*fresh6 = (*fresh6).wrapping_offset(2 as libc::c_int as isize); *fresh6 = (*fresh6).wrapping_offset(2_i32 as isize);
} else { } else {
value = value.wrapping_sub(0x10000 as libc::c_int as libc::c_uint); value = value.wrapping_sub(0x10000_i32 as libc::c_uint);
*((*emitter).raw_buffer.last).wrapping_offset(high as isize) = *((*emitter).raw_buffer.last).wrapping_offset(high as isize) =
(0xd8 as libc::c_int as libc::c_uint).wrapping_add(value >> 18 as libc::c_int) (0xd8_i32 as libc::c_uint).wrapping_add(value >> 18_i32) as libc::c_uchar;
as libc::c_uchar;
*((*emitter).raw_buffer.last).wrapping_offset(low as isize) = *((*emitter).raw_buffer.last).wrapping_offset(low as isize) =
(value >> 10 as libc::c_int & 0xff as libc::c_int as libc::c_uint) as libc::c_uchar; (value >> 10_i32 & 0xff_i32 as libc::c_uint) as libc::c_uchar;
*((*emitter).raw_buffer.last).wrapping_offset((high + 2 as libc::c_int) as isize) = *((*emitter).raw_buffer.last).wrapping_offset((high + 2_i32) as isize) =
(0xdc as libc::c_int as libc::c_uint) (0xdc_i32 as libc::c_uint).wrapping_add(value >> 8_i32 & 0xff_i32 as libc::c_uint)
.wrapping_add(value >> 8 as libc::c_int & 0xff as libc::c_int as libc::c_uint)
as libc::c_uchar; as libc::c_uchar;
*((*emitter).raw_buffer.last).wrapping_offset((low + 2 as libc::c_int) as isize) = *((*emitter).raw_buffer.last).wrapping_offset((low + 2_i32) as isize) =
(value & 0xff as libc::c_int as libc::c_uint) as libc::c_uchar; (value & 0xff_i32 as libc::c_uint) as libc::c_uchar;
let fresh7 = addr_of_mut!((*emitter).raw_buffer.last); let fresh7 = addr_of_mut!((*emitter).raw_buffer.last);
*fresh7 = (*fresh7).wrapping_offset(4 as libc::c_int as isize); *fresh7 = (*fresh7).wrapping_offset(4_i32 as isize);
} }
} }
if ((*emitter).write_handler).expect("non-null function pointer")( if ((*emitter).write_handler).expect("non-null function pointer")(
@ -133,7 +130,7 @@ pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
*fresh10 = (*emitter).raw_buffer.start; *fresh10 = (*emitter).raw_buffer.start;
let fresh11 = addr_of_mut!((*emitter).raw_buffer.pointer); let fresh11 = addr_of_mut!((*emitter).raw_buffer.pointer);
*fresh11 = (*emitter).raw_buffer.start; *fresh11 = (*emitter).raw_buffer.start;
1 as libc::c_int 1_i32
} else { } else {
yaml_emitter_set_writer_error( yaml_emitter_set_writer_error(
emitter, emitter,