mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-23 11:53:03 +00:00
Resolve unnecessary_cast lints
This commit is contained in:
parent
501b058987
commit
7f726a96a4
10 changed files with 5220 additions and 6486 deletions
691
src/api.rs
691
src/api.rs
File diff suppressed because it is too large
Load diff
|
@ -44,14 +44,14 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
let event = event.as_mut_ptr();
|
||||
let version_directive: *mut yaml_version_directive_t =
|
||||
ptr::null_mut::<yaml_version_directive_t>();
|
||||
let canonical: libc::c_int = 0 as libc::c_int;
|
||||
let unicode: libc::c_int = 0 as libc::c_int;
|
||||
let canonical: libc::c_int = 0_i32;
|
||||
let unicode: libc::c_int = 0_i32;
|
||||
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) {
|
||||
if foundfile == 0 {
|
||||
input = File::open(arg).ok();
|
||||
foundfile = 1 as libc::c_int;
|
||||
foundfile = 1_i32;
|
||||
}
|
||||
}
|
||||
let input = input.unwrap_or_else(|| __assert!(false));
|
||||
|
@ -92,28 +92,28 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
if strncmp(
|
||||
line,
|
||||
b"+STR\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
ok = yaml_stream_start_event_initialize(event, YAML_UTF8_ENCODING);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"-STR\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
ok = yaml_stream_end_event_initialize(event);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"+DOC\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
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,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) != 0 as libc::c_int) as libc::c_int;
|
||||
4_i32 as libc::c_ulong,
|
||||
) != 0_i32) as libc::c_int;
|
||||
ok = yaml_document_start_event_initialize(
|
||||
event,
|
||||
version_directive,
|
||||
|
@ -124,20 +124,20 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
} else if strncmp(
|
||||
line,
|
||||
b"-DOC\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
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,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) != 0 as libc::c_int) as libc::c_int;
|
||||
4_i32 as libc::c_ulong,
|
||||
) != 0_i32) as libc::c_int;
|
||||
ok = yaml_document_end_event_initialize(event, implicit);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"+MAP\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
style = YAML_BLOCK_MAPPING_STYLE as libc::c_int;
|
||||
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())
|
||||
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,
|
||||
);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"-MAP\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
ok = yaml_mapping_end_event_initialize(event);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"+SEQ\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
style = YAML_BLOCK_SEQUENCE_STYLE as libc::c_int;
|
||||
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())
|
||||
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,
|
||||
);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"-SEQ\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
ok = yaml_sequence_end_event_initialize(event);
|
||||
} else if strncmp(
|
||||
line,
|
||||
b"=VAL\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
let mut value: [libc::c_char; 1024] = [0; 1024];
|
||||
let mut style_0: libc::c_int = 0;
|
||||
|
@ -195,7 +195,7 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
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,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
implicit,
|
||||
implicit,
|
||||
style_0 as yaml_scalar_style_t,
|
||||
|
@ -203,8 +203,8 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
} else if strncmp(
|
||||
line,
|
||||
b"=ALI\0" as *const u8 as *const libc::c_char,
|
||||
4 as libc::c_int as libc::c_ulong,
|
||||
) == 0 as libc::c_int
|
||||
4_i32 as libc::c_ulong,
|
||||
) == 0_i32
|
||||
{
|
||||
ok = yaml_alias_event_initialize(
|
||||
event,
|
||||
|
@ -350,13 +350,11 @@ pub unsafe fn get_tag(line: *mut libc::c_char, tag: *mut libc::c_char) -> *mut l
|
|||
}
|
||||
memcpy(
|
||||
tag as *mut libc::c_void,
|
||||
start.offset(1 as libc::c_int as isize) as *const libc::c_void,
|
||||
(end.offset_from(start) as libc::c_long - 1 as libc::c_int as libc::c_long)
|
||||
as libc::c_ulong,
|
||||
start.offset(1_i32 as isize) as *const libc::c_void,
|
||||
(end.offset_from(start) as libc::c_long - 1_i32 as libc::c_long) as libc::c_ulong,
|
||||
);
|
||||
*tag.offset(
|
||||
(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;
|
||||
*tag.offset((end.offset_from(start) as libc::c_long - 1_i32 as libc::c_long) as isize) =
|
||||
'\0' as i32 as libc::c_char;
|
||||
tag
|
||||
}
|
||||
pub unsafe fn get_value(
|
||||
|
@ -364,15 +362,15 @@ pub unsafe fn get_value(
|
|||
value: *mut libc::c_char,
|
||||
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 start: *mut libc::c_char = ptr::null_mut::<libc::c_char>();
|
||||
let end: *mut libc::c_char = line.offset(strlen(line) as isize);
|
||||
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 {
|
||||
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 {
|
||||
*style = YAML_PLAIN_SCALAR_STYLE as libc::c_int;
|
||||
current_block_8 = 17407779659766490442;
|
||||
|
|
|
@ -32,11 +32,11 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
let parser = parser.as_mut_ptr();
|
||||
let mut event = MaybeUninit::<yaml_event_t>::uninit();
|
||||
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) {
|
||||
if foundfile == 0 {
|
||||
input = fs::read(arg).ok();
|
||||
foundfile = 1 as libc::c_int;
|
||||
foundfile = 1_i32;
|
||||
} else {
|
||||
return usage(ExitCode::FAILURE);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ unsafe fn unsafe_main() -> ExitCode {
|
|||
ptr::copy_nonoverlapping((*remaining).as_ptr().cast(), buffer, n);
|
||||
*remaining = &(*remaining)[n..];
|
||||
*size_read = n as size_t;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
let mut remaining = input.as_slice();
|
||||
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!(
|
||||
io::stderr(),
|
||||
"Line: {} Column: {}",
|
||||
((*parser).problem_mark.line).wrapping_add(1 as libc::c_int as libc::c_ulong),
|
||||
((*parser).problem_mark.column).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_i32 as libc::c_ulong),
|
||||
);
|
||||
}
|
||||
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) {
|
||||
let mut i: libc::c_int;
|
||||
let mut c: libc::c_char;
|
||||
i = 0 as libc::c_int;
|
||||
i = 0_i32;
|
||||
while (i as libc::c_ulong) < length {
|
||||
c = *str.offset(i as isize) as libc::c_char;
|
||||
if c as libc::c_int == '\\' as i32 {
|
||||
|
|
150
src/dumper.rs
150
src/dumper.rs
|
@ -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 event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
__assert!(!emitter.is_null());
|
||||
__assert!((*emitter).opened == 0);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*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).data.stream_start.encoding = YAML_ANY_ENCODING;
|
||||
if yaml_emitter_emit(emitter, event) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
(*emitter).opened = 1 as libc::c_int;
|
||||
1 as libc::c_int
|
||||
(*emitter).opened = 1_i32;
|
||||
1_i32
|
||||
}
|
||||
pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> libc::c_int {
|
||||
let mut event = MaybeUninit::<yaml_event_t>::uninit();
|
||||
let event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
__assert!(!emitter.is_null());
|
||||
__assert!((*emitter).opened != 0);
|
||||
if (*emitter).closed != 0 {
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_0 = YAML_STREAM_END_EVENT;
|
||||
(*event).start_mark = mark;
|
||||
(*event).end_mark = mark;
|
||||
if yaml_emitter_emit(emitter, event) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
(*emitter).closed = 1 as libc::c_int;
|
||||
1 as libc::c_int
|
||||
(*emitter).closed = 1_i32;
|
||||
1_i32
|
||||
}
|
||||
pub unsafe fn yaml_emitter_dump(
|
||||
emitter: *mut yaml_emitter_t,
|
||||
|
@ -71,9 +71,9 @@ pub unsafe fn yaml_emitter_dump(
|
|||
let mut event = MaybeUninit::<yaml_event_t>::uninit();
|
||||
let event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
__assert!(!emitter.is_null());
|
||||
__assert!(!document.is_null());
|
||||
|
@ -93,7 +93,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
if (*document).nodes.start == (*document).nodes.top {
|
||||
if !(yaml_emitter_close(emitter) == 0) {
|
||||
yaml_emitter_delete_document_and_anchors(emitter);
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
} else {
|
||||
__assert!((*emitter).opened != 0);
|
||||
|
@ -105,7 +105,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
if !((*emitter).anchors).is_null() {
|
||||
memset(
|
||||
(*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(
|
||||
((*document).nodes.top).c_offset_from((*document).nodes.start)
|
||||
as libc::c_long as libc::c_ulong,
|
||||
|
@ -113,7 +113,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_0 = YAML_DOCUMENT_START_EVENT;
|
||||
|
@ -126,11 +126,11 @@ pub unsafe fn yaml_emitter_dump(
|
|||
(*document).tag_directives.end;
|
||||
(*event).data.document_start.implicit = (*document).start_implicit;
|
||||
if !(yaml_emitter_emit(emitter, event) == 0) {
|
||||
yaml_emitter_anchor_node(emitter, 1 as libc::c_int);
|
||||
if !(yaml_emitter_dump_node(emitter, 1 as libc::c_int) == 0) {
|
||||
yaml_emitter_anchor_node(emitter, 1_i32);
|
||||
if !(yaml_emitter_dump_node(emitter, 1_i32) == 0) {
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*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;
|
||||
if !(yaml_emitter_emit(emitter, event) == 0) {
|
||||
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);
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitter_t) {
|
||||
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>();
|
||||
return;
|
||||
}
|
||||
index = 0 as libc::c_int;
|
||||
index = 0_i32;
|
||||
while ((*(*emitter).document).nodes.start).wrapping_offset(index as isize)
|
||||
< (*(*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);
|
||||
let fresh6 = addr_of_mut!((*emitter).anchors);
|
||||
*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);
|
||||
*fresh7 = ptr::null_mut::<yaml_document_t>();
|
||||
}
|
||||
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)
|
||||
.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 pair: *mut yaml_node_pair_t;
|
||||
let fresh8 = addr_of_mut!(
|
||||
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).references
|
||||
);
|
||||
let fresh8 =
|
||||
addr_of_mut!((*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).references);
|
||||
*fresh8 += 1;
|
||||
if (*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).references
|
||||
== 1 as libc::c_int
|
||||
{
|
||||
if (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).references == 1_i32 {
|
||||
match (*node).type_0 as libc::c_uint {
|
||||
2 => {
|
||||
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))
|
||||
.references
|
||||
== 2 as libc::c_int
|
||||
} else if (*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).references == 2_i32
|
||||
{
|
||||
let fresh9 = addr_of_mut!((*emitter).last_anchor_id);
|
||||
*fresh9 += 1;
|
||||
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).anchor =
|
||||
*fresh9;
|
||||
(*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).anchor = *fresh9;
|
||||
}
|
||||
}
|
||||
unsafe fn yaml_emitter_generate_anchor(
|
||||
_emitter: *mut yaml_emitter_t,
|
||||
anchor_id: libc::c_int,
|
||||
) -> *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() {
|
||||
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 {
|
||||
let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start)
|
||||
.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 =
|
||||
(*((*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>();
|
||||
if anchor_id != 0 {
|
||||
anchor = yaml_emitter_generate_anchor(emitter, anchor_id);
|
||||
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);
|
||||
}
|
||||
(*((*emitter).anchors).wrapping_offset((index - 1 as libc::c_int) as isize)).serialized =
|
||||
1 as libc::c_int;
|
||||
(*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).serialized = 1_i32;
|
||||
match (*node).type_0 as libc::c_uint {
|
||||
1 => yaml_emitter_dump_scalar(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 event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*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 event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
let plain_implicit: libc::c_int = (strcmp(
|
||||
(*node).tag as *mut 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(
|
||||
(*node).tag as *mut 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(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*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 event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
let implicit: libc::c_int = (strcmp(
|
||||
(*node).tag as *mut 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;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*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.style = (*node).data.sequence.style;
|
||||
if yaml_emitter_emit(emitter, event) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
item = (*node).data.sequence.items.start;
|
||||
while item < (*node).data.sequence.items.top {
|
||||
if yaml_emitter_dump_node(emitter, *item) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
item = item.wrapping_offset(1);
|
||||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_0 = YAML_SEQUENCE_END_EVENT;
|
||||
(*event).start_mark = mark;
|
||||
(*event).end_mark = mark;
|
||||
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(
|
||||
emitter: *mut yaml_emitter_t,
|
||||
|
@ -397,18 +389,18 @@ unsafe fn yaml_emitter_dump_mapping(
|
|||
let mut event = MaybeUninit::<yaml_event_t>::uninit();
|
||||
let event = event.as_mut_ptr();
|
||||
let mark = yaml_mark_t {
|
||||
index: 0 as libc::c_int as size_t,
|
||||
line: 0 as libc::c_int as size_t,
|
||||
column: 0 as libc::c_int as size_t,
|
||||
index: 0_i32 as size_t,
|
||||
line: 0_i32 as size_t,
|
||||
column: 0_i32 as size_t,
|
||||
};
|
||||
let implicit: libc::c_int = (strcmp(
|
||||
(*node).tag as *mut 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;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*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.style = (*node).data.mapping.style;
|
||||
if yaml_emitter_emit(emitter, event) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
pair = (*node).data.mapping.pairs.start;
|
||||
while pair < (*node).data.mapping.pairs.top {
|
||||
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 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
pair = pair.wrapping_offset(1);
|
||||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_0 = YAML_MAPPING_END_EVENT;
|
||||
(*event).start_mark = mark;
|
||||
(*event).end_mark = mark;
|
||||
if yaml_emitter_emit(emitter, event) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
|
|
3802
src/emitter.rs
3802
src/emitter.rs
File diff suppressed because it is too large
Load diff
292
src/loader.rs
292
src/loader.rs
|
@ -45,23 +45,22 @@ pub unsafe fn yaml_parser_load(
|
|||
__assert!(!document.is_null());
|
||||
memset(
|
||||
document as *mut libc::c_void,
|
||||
0 as libc::c_int,
|
||||
0_i32,
|
||||
size_of::<yaml_document_t>() as libc::c_ulong,
|
||||
);
|
||||
let fresh0 = addr_of_mut!((*document).nodes.start);
|
||||
*fresh0 = yaml_malloc(
|
||||
(16 as libc::c_int as libc::c_ulong)
|
||||
.wrapping_mul(size_of::<yaml_node_t>() as libc::c_ulong),
|
||||
(16_i32 as libc::c_ulong).wrapping_mul(size_of::<yaml_node_t>() as libc::c_ulong),
|
||||
) as *mut yaml_node_t;
|
||||
if !(if !(*fresh0).is_null() {
|
||||
let fresh1 = addr_of_mut!((*document).nodes.top);
|
||||
*fresh1 = (*document).nodes.start;
|
||||
let fresh2 = addr_of_mut!((*document).nodes.end);
|
||||
*fresh2 = ((*document).nodes.start).wrapping_offset(16 as libc::c_int as isize);
|
||||
1 as libc::c_int
|
||||
*fresh2 = ((*document).nodes.start).wrapping_offset(16_i32 as isize);
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
if (*parser).stream_start_produced == 0 {
|
||||
|
@ -81,31 +80,29 @@ pub unsafe fn yaml_parser_load(
|
|||
6234624449317607669 => {}
|
||||
_ => {
|
||||
if (*parser).stream_end_produced != 0 {
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
if !(yaml_parser_parse(parser, event) == 0) {
|
||||
if (*event).type_0 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);
|
||||
*fresh3 =
|
||||
yaml_malloc((16 as libc::c_int as libc::c_ulong).wrapping_mul(size_of::<
|
||||
yaml_alias_data_t,
|
||||
>(
|
||||
)
|
||||
as libc::c_ulong)) as *mut yaml_alias_data_t;
|
||||
*fresh3 = yaml_malloc((16_i32 as libc::c_ulong).wrapping_mul(size_of::<
|
||||
yaml_alias_data_t,
|
||||
>(
|
||||
)
|
||||
as libc::c_ulong)) as *mut yaml_alias_data_t;
|
||||
if !(if !(*fresh3).is_null() {
|
||||
let fresh4 = addr_of_mut!((*parser).aliases.top);
|
||||
*fresh4 = (*parser).aliases.start;
|
||||
let fresh5 = addr_of_mut!((*parser).aliases.end);
|
||||
*fresh5 =
|
||||
((*parser).aliases.start).wrapping_offset(16 as libc::c_int as isize);
|
||||
1 as libc::c_int
|
||||
*fresh5 = ((*parser).aliases.start).wrapping_offset(16_i32 as isize);
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
let fresh6 = addr_of_mut!((*parser).document);
|
||||
|
@ -114,7 +111,7 @@ pub unsafe fn yaml_parser_load(
|
|||
yaml_parser_delete_aliases(parser);
|
||||
let fresh7 = addr_of_mut!((*parser).document);
|
||||
*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);
|
||||
let fresh8 = addr_of_mut!((*parser).document);
|
||||
*fresh8 = ptr::null_mut::<yaml_document_t>();
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_parser_set_composer_error(
|
||||
mut parser: *mut yaml_parser_t,
|
||||
|
@ -136,7 +133,7 @@ unsafe fn yaml_parser_set_composer_error(
|
|||
let fresh9 = addr_of_mut!((*parser).problem);
|
||||
*fresh9 = problem;
|
||||
(*parser).problem_mark = problem_mark;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_parser_set_composer_error_context(
|
||||
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);
|
||||
*fresh11 = problem;
|
||||
(*parser).problem_mark = problem_mark;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_parser_delete_aliases(parser: *mut yaml_parser_t) {
|
||||
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_mark = (*event).start_mark;
|
||||
ctx.start = yaml_malloc(
|
||||
(16 as libc::c_int as libc::c_ulong)
|
||||
.wrapping_mul(size_of::<libc::c_int>() as libc::c_ulong),
|
||||
(16_i32 as libc::c_ulong).wrapping_mul(size_of::<libc::c_int>() as libc::c_ulong),
|
||||
) as *mut libc::c_int;
|
||||
if if !(ctx.start).is_null() {
|
||||
ctx.top = ctx.start;
|
||||
ctx.end = (ctx.start).wrapping_offset(16 as libc::c_int as isize);
|
||||
1 as libc::c_int
|
||||
ctx.end = (ctx.start).wrapping_offset(16_i32 as isize);
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)) == 0 {
|
||||
yaml_free(ctx.start as *mut libc::c_void);
|
||||
ctx.end = ptr::null_mut::<libc::c_int>();
|
||||
ctx.top = ctx.end;
|
||||
ctx.start = ctx.top;
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
yaml_free(ctx.start as *mut libc::c_void);
|
||||
ctx.end = ptr::null_mut::<libc::c_int>();
|
||||
ctx.top = ctx.end;
|
||||
ctx.start = ctx.top;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
unsafe fn yaml_parser_load_nodes(
|
||||
mut parser: *mut yaml_parser_t,
|
||||
|
@ -224,37 +220,37 @@ unsafe fn yaml_parser_load_nodes(
|
|||
let event = event.as_mut_ptr();
|
||||
loop {
|
||||
if yaml_parser_parse(parser, event) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
match (*event).type_0 as libc::c_uint {
|
||||
5 => {
|
||||
if yaml_parser_load_alias(parser, event, ctx) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
6 => {
|
||||
if yaml_parser_load_scalar(parser, event, ctx) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
7 => {
|
||||
if yaml_parser_load_sequence(parser, event, ctx) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
8 => {
|
||||
if yaml_parser_load_sequence_end(parser, event, ctx) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
9 => {
|
||||
if yaml_parser_load_mapping(parser, event, ctx) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
10 => {
|
||||
if yaml_parser_load_mapping_end(parser, event, ctx) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
4 => {}
|
||||
|
@ -270,7 +266,7 @@ unsafe fn yaml_parser_load_nodes(
|
|||
}
|
||||
(*(*parser).document).end_implicit = (*event).data.document_end.implicit;
|
||||
(*(*parser).document).end_mark = (*event).end_mark;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
unsafe fn yaml_parser_register_anchor(
|
||||
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;
|
||||
if anchor.is_null() {
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
data.anchor = anchor;
|
||||
data.index = index;
|
||||
data.mark = (*((*(*parser).document).nodes.start)
|
||||
.wrapping_offset((index - 1 as libc::c_int) as isize))
|
||||
.start_mark;
|
||||
data.mark =
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).start_mark;
|
||||
alias_data = (*parser).aliases.start;
|
||||
while alias_data != (*parser).aliases.top {
|
||||
if strcmp(
|
||||
(*alias_data).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);
|
||||
return yaml_parser_set_composer_error_context(
|
||||
|
@ -324,16 +319,16 @@ unsafe fn yaml_parser_register_anchor(
|
|||
let fresh20 = *fresh19;
|
||||
*fresh19 = (*fresh19).wrapping_offset(1);
|
||||
*fresh20 = data;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
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(
|
||||
mut parser: *mut yaml_parser_t,
|
||||
|
@ -341,26 +336,27 @@ unsafe fn yaml_parser_load_node_add(
|
|||
index: libc::c_int,
|
||||
) -> libc::c_int {
|
||||
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: *mut yaml_node_t = addr_of_mut!(*((*(*parser).document).nodes.start)
|
||||
.wrapping_offset((parent_index - 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).wrapping_offset((parent_index - 1_i32) as isize)
|
||||
);
|
||||
let current_block_17: u64;
|
||||
match (*parent).type_0 as libc::c_uint {
|
||||
2 => {
|
||||
if if (((*parent).data.sequence.items.top)
|
||||
.c_offset_from((*parent).data.sequence.items.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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
if if (*parent).data.sequence.items.top != (*parent).data.sequence.items.end
|
||||
|| yaml_stack_extend(
|
||||
|
@ -373,21 +369,21 @@ unsafe fn yaml_parser_load_node_add(
|
|||
let fresh22 = *fresh21;
|
||||
*fresh21 = (*fresh21).wrapping_offset(1);
|
||||
*fresh22 = index;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
3 => {
|
||||
let mut pair = yaml_node_pair_t { key: 0, value: 0 };
|
||||
if !((*parent).data.mapping.pairs.start == (*parent).data.mapping.pairs.top) {
|
||||
let mut p: *mut yaml_node_pair_t = ((*parent).data.mapping.pairs.top)
|
||||
.wrapping_offset(-(1 as libc::c_int as isize));
|
||||
if (*p).key != 0 as libc::c_int && (*p).value == 0 as libc::c_int {
|
||||
let mut p: *mut yaml_node_pair_t =
|
||||
((*parent).data.mapping.pairs.top).wrapping_offset(-(1_i32 as isize));
|
||||
if (*p).key != 0_i32 && (*p).value == 0_i32 {
|
||||
(*p).value = index;
|
||||
current_block_17 = 11307063007268554308;
|
||||
} else {
|
||||
|
@ -400,19 +396,19 @@ unsafe fn yaml_parser_load_node_add(
|
|||
11307063007268554308 => {}
|
||||
_ => {
|
||||
pair.key = index;
|
||||
pair.value = 0 as libc::c_int;
|
||||
pair.value = 0_i32;
|
||||
if if (((*parent).data.mapping.pairs.top)
|
||||
.c_offset_from((*parent).data.mapping.pairs.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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
if if (*parent).data.mapping.pairs.top != (*parent).data.mapping.pairs.end
|
||||
|| yaml_stack_extend(
|
||||
|
@ -428,13 +424,13 @@ unsafe fn yaml_parser_load_node_add(
|
|||
let fresh24 = *fresh23;
|
||||
*fresh23 = (*fresh23).wrapping_offset(1);
|
||||
*fresh24 = pair;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -443,7 +439,7 @@ unsafe fn yaml_parser_load_node_add(
|
|||
__assert!(false);
|
||||
}
|
||||
}
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
unsafe fn yaml_parser_load_alias(
|
||||
parser: *mut yaml_parser_t,
|
||||
|
@ -457,7 +453,7 @@ unsafe fn yaml_parser_load_alias(
|
|||
if strcmp(
|
||||
(*alias_data).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);
|
||||
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;
|
||||
if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
if tag.is_null()
|
||||
|| strcmp(
|
||||
tag as *mut 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);
|
||||
tag = yaml_strdup(
|
||||
|
@ -533,7 +529,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
_ => {
|
||||
memset(
|
||||
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,
|
||||
);
|
||||
node.type_0 = YAML_SCALAR_NODE;
|
||||
|
@ -554,10 +550,10 @@ unsafe fn yaml_parser_load_scalar(
|
|||
let fresh26 = *fresh25;
|
||||
*fresh25 = (*fresh25).wrapping_offset(1);
|
||||
*fresh26 = node;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
index = ((*(*parser).document).nodes.top)
|
||||
|
@ -565,7 +561,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
as libc::c_long as libc::c_int;
|
||||
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);
|
||||
}
|
||||
|
@ -575,7 +571,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
yaml_free(tag 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);
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_parser_load_sequence(
|
||||
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;
|
||||
if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
if tag.is_null()
|
||||
|| strcmp(
|
||||
tag as *mut 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);
|
||||
tag = yaml_strdup(
|
||||
|
@ -642,24 +638,22 @@ unsafe fn yaml_parser_load_sequence(
|
|||
match current_block {
|
||||
13474536459355229096 => {}
|
||||
_ => {
|
||||
items.start =
|
||||
yaml_malloc((16 as libc::c_int as libc::c_ulong).wrapping_mul(size_of::<
|
||||
yaml_node_item_t,
|
||||
>(
|
||||
)
|
||||
as libc::c_ulong)) as *mut yaml_node_item_t;
|
||||
items.start = yaml_malloc(
|
||||
(16_i32 as libc::c_ulong)
|
||||
.wrapping_mul(size_of::<yaml_node_item_t>() as libc::c_ulong),
|
||||
) as *mut yaml_node_item_t;
|
||||
if !(if !(items.start).is_null() {
|
||||
items.top = items.start;
|
||||
items.end = (items.start).wrapping_offset(16 as libc::c_int as isize);
|
||||
1 as libc::c_int
|
||||
items.end = (items.start).wrapping_offset(16_i32 as isize);
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
memset(
|
||||
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,
|
||||
);
|
||||
node.type_0 = YAML_SEQUENCE_NODE;
|
||||
|
@ -682,10 +676,10 @@ unsafe fn yaml_parser_load_sequence(
|
|||
let fresh28 = *fresh27;
|
||||
*fresh27 = (*fresh27).wrapping_offset(1);
|
||||
*fresh28 = node;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
index = ((*(*parser).document).nodes.top)
|
||||
|
@ -697,21 +691,21 @@ unsafe fn yaml_parser_load_sequence(
|
|||
(*event).data.sequence_start.anchor,
|
||||
) == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
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)
|
||||
< (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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
if if (*ctx).top != (*ctx).end
|
||||
|| yaml_stack_extend(
|
||||
|
@ -724,15 +718,15 @@ unsafe fn yaml_parser_load_sequence(
|
|||
let fresh30 = *fresh29;
|
||||
*fresh29 = (*fresh29).wrapping_offset(1);
|
||||
*fresh30 = index;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 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((*event).data.sequence_start.anchor as *mut libc::c_void);
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_parser_load_sequence_end(
|
||||
parser: *mut yaml_parser_t,
|
||||
event: *mut yaml_event_t,
|
||||
ctx: *mut loader_ctx,
|
||||
) -> 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!(
|
||||
((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0 as libc::c_int as libc::c_long
|
||||
);
|
||||
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
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).type_0
|
||||
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))
|
||||
.end_mark = (*event).end_mark;
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).end_mark =
|
||||
(*event).end_mark;
|
||||
let fresh31 = addr_of_mut!((*ctx).top);
|
||||
*fresh31 = (*fresh31).wrapping_offset(-1);
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
unsafe fn yaml_parser_load_mapping(
|
||||
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;
|
||||
if !(if (((*(*parser).document).nodes.top).c_offset_from((*(*parser).document).nodes.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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
if tag.is_null()
|
||||
|| strcmp(
|
||||
tag as *mut 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);
|
||||
tag = yaml_strdup(
|
||||
|
@ -827,24 +819,22 @@ unsafe fn yaml_parser_load_mapping(
|
|||
match current_block {
|
||||
13635467803606088781 => {}
|
||||
_ => {
|
||||
pairs.start =
|
||||
yaml_malloc((16 as libc::c_int as libc::c_ulong).wrapping_mul(size_of::<
|
||||
yaml_node_pair_t,
|
||||
>(
|
||||
)
|
||||
as libc::c_ulong)) as *mut yaml_node_pair_t;
|
||||
pairs.start = yaml_malloc(
|
||||
(16_i32 as libc::c_ulong)
|
||||
.wrapping_mul(size_of::<yaml_node_pair_t>() as libc::c_ulong),
|
||||
) as *mut yaml_node_pair_t;
|
||||
if !(if !(pairs.start).is_null() {
|
||||
pairs.top = pairs.start;
|
||||
pairs.end = (pairs.start).wrapping_offset(16 as libc::c_int as isize);
|
||||
1 as libc::c_int
|
||||
pairs.end = (pairs.start).wrapping_offset(16_i32 as isize);
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
memset(
|
||||
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,
|
||||
);
|
||||
node.type_0 = YAML_MAPPING_NODE;
|
||||
|
@ -867,10 +857,10 @@ unsafe fn yaml_parser_load_mapping(
|
|||
let fresh33 = *fresh32;
|
||||
*fresh32 = (*fresh32).wrapping_offset(1);
|
||||
*fresh33 = node;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0)
|
||||
{
|
||||
index = ((*(*parser).document).nodes.top)
|
||||
|
@ -882,21 +872,21 @@ unsafe fn yaml_parser_load_mapping(
|
|||
(*event).data.mapping_start.anchor,
|
||||
) == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
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)
|
||||
< (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 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 0
|
||||
{
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
if if (*ctx).top != (*ctx).end
|
||||
|| yaml_stack_extend(
|
||||
|
@ -909,15 +899,15 @@ unsafe fn yaml_parser_load_mapping(
|
|||
let fresh35 = *fresh34;
|
||||
*fresh34 = (*fresh34).wrapping_offset(1);
|
||||
*fresh35 = index;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} == 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((*event).data.mapping_start.anchor as *mut libc::c_void);
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
unsafe fn yaml_parser_load_mapping_end(
|
||||
parser: *mut yaml_parser_t,
|
||||
event: *mut yaml_event_t,
|
||||
ctx: *mut loader_ctx,
|
||||
) -> 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!(
|
||||
((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0 as libc::c_int as libc::c_long
|
||||
);
|
||||
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
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).type_0
|
||||
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))
|
||||
.end_mark = (*event).end_mark;
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).end_mark =
|
||||
(*event).end_mark;
|
||||
let fresh36 = addr_of_mut!((*ctx).top);
|
||||
*fresh36 = (*fresh36).wrapping_offset(-1);
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
|
|
454
src/parser.rs
454
src/parser.rs
File diff suppressed because it is too large
Load diff
268
src/reader.rs
268
src/reader.rs
|
@ -15,75 +15,75 @@ unsafe fn yaml_parser_set_reader_error(
|
|||
*fresh0 = problem;
|
||||
(*parser).problem_offset = offset;
|
||||
(*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 {
|
||||
while (*parser).eof == 0
|
||||
&& (((*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 {
|
||||
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
|
||||
>= 2 as libc::c_int as libc::c_long
|
||||
>= 2_i32 as libc::c_long
|
||||
&& memcmp(
|
||||
(*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,
|
||||
2 as libc::c_int as libc::c_ulong,
|
||||
2_i32 as libc::c_ulong,
|
||||
) == 0
|
||||
{
|
||||
(*parser).encoding = YAML_UTF16LE_ENCODING;
|
||||
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);
|
||||
*fresh2 = (*fresh2 as libc::c_ulong).wrapping_add(2 as libc::c_int as libc::c_ulong)
|
||||
as size_t as size_t;
|
||||
*fresh2 =
|
||||
(*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)
|
||||
as libc::c_long
|
||||
>= 2 as libc::c_int as libc::c_long
|
||||
>= 2_i32 as libc::c_long
|
||||
&& memcmp(
|
||||
(*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,
|
||||
2 as libc::c_int as libc::c_ulong,
|
||||
2_i32 as libc::c_ulong,
|
||||
) == 0
|
||||
{
|
||||
(*parser).encoding = YAML_UTF16BE_ENCODING;
|
||||
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);
|
||||
*fresh4 = (*fresh4 as libc::c_ulong).wrapping_add(2 as libc::c_int as libc::c_ulong)
|
||||
as size_t as size_t;
|
||||
*fresh4 =
|
||||
(*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)
|
||||
as libc::c_long
|
||||
>= 3 as libc::c_int as libc::c_long
|
||||
>= 3_i32 as libc::c_long
|
||||
&& memcmp(
|
||||
(*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,
|
||||
3 as libc::c_int as libc::c_ulong,
|
||||
3_i32 as libc::c_ulong,
|
||||
) == 0
|
||||
{
|
||||
(*parser).encoding = YAML_UTF8_ENCODING;
|
||||
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);
|
||||
*fresh6 = (*fresh6 as libc::c_ulong).wrapping_add(3 as libc::c_int as libc::c_ulong)
|
||||
as size_t as size_t;
|
||||
*fresh6 =
|
||||
(*fresh6 as libc::c_ulong).wrapping_add(3_i32 as libc::c_ulong) as size_t as size_t;
|
||||
} else {
|
||||
(*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 {
|
||||
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
|
||||
&& (*parser).raw_buffer.last == (*parser).raw_buffer.end
|
||||
{
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
if (*parser).eof != 0 {
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
if (*parser).raw_buffer.start < (*parser).raw_buffer.pointer
|
||||
&& (*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,
|
||||
b"input error\0" as *const u8 as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
);
|
||||
}
|
||||
let fresh9 = addr_of_mut!((*parser).raw_buffer.last);
|
||||
*fresh9 = (*fresh9).wrapping_offset(size_read as isize);
|
||||
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 {
|
||||
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());
|
||||
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 {
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
if (*parser).encoding as u64 == 0 {
|
||||
if yaml_parser_determine_encoding(parser) == 0 {
|
||||
return 0 as libc::c_int;
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
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 {
|
||||
if first == 0 || (*parser).raw_buffer.pointer == (*parser).raw_buffer.last {
|
||||
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 {
|
||||
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 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 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 high: libc::c_int;
|
||||
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;
|
||||
match (*parser).encoding as libc::c_uint {
|
||||
1 => {
|
||||
octet =
|
||||
*((*parser).raw_buffer.pointer).wrapping_offset(0 as libc::c_int as isize);
|
||||
width = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int {
|
||||
1 as libc::c_int
|
||||
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int {
|
||||
2 as libc::c_int
|
||||
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int {
|
||||
3 as libc::c_int
|
||||
} else if octet as libc::c_int & 0xf8 as libc::c_int == 0xf0 as libc::c_int {
|
||||
4 as libc::c_int
|
||||
octet = *((*parser).raw_buffer.pointer).wrapping_offset(0_i32 as isize);
|
||||
width = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
|
||||
1_i32
|
||||
} else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
|
||||
2_i32
|
||||
} else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
|
||||
3_i32
|
||||
} else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
|
||||
4_i32
|
||||
} else {
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}) as libc::c_uint;
|
||||
if width == 0 {
|
||||
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
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
);
|
||||
}
|
||||
incomplete = 1 as libc::c_int;
|
||||
incomplete = 1_i32;
|
||||
} else {
|
||||
value = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int {
|
||||
octet as libc::c_int & 0x7f as libc::c_int
|
||||
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int
|
||||
{
|
||||
octet as libc::c_int & 0x1f as libc::c_int
|
||||
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int
|
||||
{
|
||||
octet as libc::c_int & 0xf as libc::c_int
|
||||
} 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
|
||||
value = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
|
||||
octet as libc::c_int & 0x7f_i32
|
||||
} else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
|
||||
octet as libc::c_int & 0x1f_i32
|
||||
} else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
|
||||
octet as libc::c_int & 0xf_i32
|
||||
} else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
|
||||
octet as libc::c_int & 0x7_i32
|
||||
} else {
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}) 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 {
|
||||
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(
|
||||
parser,
|
||||
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,
|
||||
);
|
||||
}
|
||||
value = (value << 6 as libc::c_int).wrapping_add(
|
||||
(octet as libc::c_int & 0x3f as libc::c_int) as libc::c_uint,
|
||||
);
|
||||
value = (value << 6_i32)
|
||||
.wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
|
||||
k = k.wrapping_add(1);
|
||||
}
|
||||
if !(width == 1 as libc::c_int as libc::c_uint
|
||||
|| width == 2 as libc::c_int as libc::c_uint
|
||||
&& value >= 0x80 as libc::c_int as libc::c_uint
|
||||
|| width == 3 as libc::c_int as libc::c_uint
|
||||
&& value >= 0x800 as libc::c_int as libc::c_uint
|
||||
|| width == 4 as libc::c_int as libc::c_uint
|
||||
&& value >= 0x10000 as libc::c_int as libc::c_uint)
|
||||
if !(width == 1_i32 as libc::c_uint
|
||||
|| width == 2_i32 as libc::c_uint && value >= 0x80_i32 as libc::c_uint
|
||||
|| width == 3_i32 as libc::c_uint && value >= 0x800_i32 as libc::c_uint
|
||||
|| width == 4_i32 as libc::c_uint
|
||||
&& value >= 0x10000_i32 as libc::c_uint)
|
||||
{
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"invalid length of a UTF-8 sequence\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
);
|
||||
}
|
||||
if value >= 0xd800 as libc::c_int as libc::c_uint
|
||||
&& value <= 0xdfff as libc::c_int as libc::c_uint
|
||||
|| value > 0x10ffff as libc::c_int as libc::c_uint
|
||||
if value >= 0xd800_i32 as libc::c_uint
|
||||
&& value <= 0xdfff_i32 as libc::c_uint
|
||||
|| value > 0x10ffff_i32 as libc::c_uint
|
||||
{
|
||||
return yaml_parser_set_reader_error(
|
||||
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
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} else {
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
};
|
||||
high = if (*parser).encoding as libc::c_uint
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} 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 {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"incomplete UTF-16 character\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
);
|
||||
}
|
||||
incomplete = 1 as libc::c_int;
|
||||
incomplete = 1_i32;
|
||||
} else {
|
||||
value = (*((*parser).raw_buffer.pointer).wrapping_offset(low as isize)
|
||||
as libc::c_int
|
||||
+ ((*((*parser).raw_buffer.pointer).wrapping_offset(high as isize)
|
||||
as libc::c_int)
|
||||
<< 8 as libc::c_int))
|
||||
as libc::c_uint;
|
||||
if value & 0xfc00 as libc::c_int as libc::c_uint
|
||||
== 0xdc00 as libc::c_int as libc::c_uint
|
||||
{
|
||||
<< 8_i32)) as libc::c_uint;
|
||||
if value & 0xfc00_i32 as libc::c_uint == 0xdc00_i32 as libc::c_uint {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
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,
|
||||
);
|
||||
}
|
||||
if value & 0xfc00 as libc::c_int as libc::c_uint
|
||||
== 0xd800 as libc::c_int as libc::c_uint
|
||||
{
|
||||
width = 4 as libc::c_int as libc::c_uint;
|
||||
if raw_unread < 4 as libc::c_int as libc::c_ulong {
|
||||
if value & 0xfc00_i32 as libc::c_uint == 0xd800_i32 as libc::c_uint {
|
||||
width = 4_i32 as libc::c_uint;
|
||||
if raw_unread < 4_i32 as libc::c_ulong {
|
||||
if (*parser).eof != 0 {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"incomplete UTF-16 surrogate pair\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
);
|
||||
}
|
||||
incomplete = 1 as libc::c_int;
|
||||
incomplete = 1_i32;
|
||||
} else {
|
||||
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
|
||||
+ ((*((*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)
|
||||
<< 8 as libc::c_int))
|
||||
<< 8_i32))
|
||||
as libc::c_uint;
|
||||
if value2 & 0xfc00 as libc::c_int as libc::c_uint
|
||||
!= 0xdc00 as libc::c_int as libc::c_uint
|
||||
if value2 & 0xfc00_i32 as libc::c_uint != 0xdc00_i32 as libc::c_uint
|
||||
{
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"expected low surrogate area\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
((*parser).offset)
|
||||
.wrapping_add(2 as libc::c_int as libc::c_ulong),
|
||||
((*parser).offset).wrapping_add(2_i32 as libc::c_ulong),
|
||||
value2 as libc::c_int,
|
||||
);
|
||||
}
|
||||
value = (0x10000 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(
|
||||
(value & 0x3ff as libc::c_int as libc::c_uint)
|
||||
<< 10 as libc::c_int,
|
||||
)
|
||||
.wrapping_add(value2 & 0x3ff as libc::c_int as libc::c_uint);
|
||||
value = (0x10000_i32 as libc::c_uint)
|
||||
.wrapping_add((value & 0x3ff_i32 as libc::c_uint) << 10_i32)
|
||||
.wrapping_add(value2 & 0x3ff_i32 as libc::c_uint);
|
||||
}
|
||||
} 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 {
|
||||
break;
|
||||
}
|
||||
if !(value == 0x9 as libc::c_int as libc::c_uint
|
||||
|| value == 0xa as libc::c_int as libc::c_uint
|
||||
|| value == 0xd as libc::c_int as libc::c_uint
|
||||
|| value >= 0x20 as libc::c_int as libc::c_uint
|
||||
&& value <= 0x7e as libc::c_int as libc::c_uint
|
||||
|| value == 0x85 as libc::c_int as libc::c_uint
|
||||
|| value >= 0xa0 as libc::c_int as libc::c_uint
|
||||
&& value <= 0xd7ff as libc::c_int 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)
|
||||
if !(value == 0x9_i32 as libc::c_uint
|
||||
|| value == 0xa_i32 as libc::c_uint
|
||||
|| value == 0xd_i32 as libc::c_uint
|
||||
|| value >= 0x20_i32 as libc::c_uint && value <= 0x7e_i32 as libc::c_uint
|
||||
|| value == 0x85_i32 as libc::c_uint
|
||||
|| value >= 0xa0_i32 as libc::c_uint && value <= 0xd7ff_i32 as libc::c_uint
|
||||
|| value >= 0xe000_i32 as libc::c_uint && value <= 0xfffd_i32 as libc::c_uint
|
||||
|| value >= 0x10000_i32 as libc::c_uint && value <= 0x10ffff_i32 as libc::c_uint)
|
||||
{
|
||||
return yaml_parser_set_reader_error(
|
||||
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);
|
||||
*fresh15 = (*fresh15 as libc::c_ulong).wrapping_add(width as libc::c_ulong) 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 fresh17 = *fresh16;
|
||||
*fresh16 = (*fresh16).wrapping_offset(1);
|
||||
*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 fresh19 = *fresh18;
|
||||
*fresh18 = (*fresh18).wrapping_offset(1);
|
||||
*fresh19 = (0xc0 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 6 as libc::c_int)
|
||||
as yaml_char_t;
|
||||
*fresh19 = (0xc0_i32 as libc::c_uint).wrapping_add(value >> 6_i32) as yaml_char_t;
|
||||
let fresh20 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh21 = *fresh20;
|
||||
*fresh20 = (*fresh20).wrapping_offset(1);
|
||||
*fresh21 = (0x80 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value & 0x3f as libc::c_int as libc::c_uint)
|
||||
*fresh21 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
|
||||
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 fresh23 = *fresh22;
|
||||
*fresh22 = (*fresh22).wrapping_offset(1);
|
||||
*fresh23 = (0xe0 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 12 as libc::c_int)
|
||||
as yaml_char_t;
|
||||
*fresh23 = (0xe0_i32 as libc::c_uint).wrapping_add(value >> 12_i32) as yaml_char_t;
|
||||
let fresh24 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh25 = *fresh24;
|
||||
*fresh24 = (*fresh24).wrapping_offset(1);
|
||||
*fresh25 = (0x80 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 6 as libc::c_int & 0x3f as libc::c_int as libc::c_uint)
|
||||
*fresh25 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 6_i32 & 0x3f_i32 as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
let fresh26 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh27 = *fresh26;
|
||||
*fresh26 = (*fresh26).wrapping_offset(1);
|
||||
*fresh27 = (0x80 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value & 0x3f as libc::c_int as libc::c_uint)
|
||||
*fresh27 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
} else {
|
||||
let fresh28 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh29 = *fresh28;
|
||||
*fresh28 = (*fresh28).wrapping_offset(1);
|
||||
*fresh29 = (0xf0 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 18 as libc::c_int)
|
||||
as yaml_char_t;
|
||||
*fresh29 = (0xf0_i32 as libc::c_uint).wrapping_add(value >> 18_i32) as yaml_char_t;
|
||||
let fresh30 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh31 = *fresh30;
|
||||
*fresh30 = (*fresh30).wrapping_offset(1);
|
||||
*fresh31 = (0x80 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 12 as libc::c_int & 0x3f as libc::c_int as libc::c_uint)
|
||||
*fresh31 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 12_i32 & 0x3f_i32 as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
let fresh32 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh33 = *fresh32;
|
||||
*fresh32 = (*fresh32).wrapping_offset(1);
|
||||
*fresh33 = (0x80 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 6 as libc::c_int & 0x3f as libc::c_int as libc::c_uint)
|
||||
*fresh33 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 6_i32 & 0x3f_i32 as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
let fresh34 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh35 = *fresh34;
|
||||
*fresh34 = (*fresh34).wrapping_offset(1);
|
||||
*fresh35 = (0x80 as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value & 0x3f as libc::c_int as libc::c_uint)
|
||||
*fresh35 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
}
|
||||
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;
|
||||
let fresh39 = addr_of_mut!((*parser).unread);
|
||||
*fresh39 = (*fresh39).wrapping_add(1);
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
}
|
||||
}
|
||||
if (*parser).offset
|
||||
>= (!(0 as libc::c_int as size_t)).wrapping_div(2 as libc::c_int as libc::c_ulong)
|
||||
{
|
||||
if (*parser).offset >= (!(0_i32 as size_t)).wrapping_div(2_i32 as libc::c_ulong) {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"input is too long\0" as *const u8 as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-(1 as libc::c_int),
|
||||
-1_i32,
|
||||
);
|
||||
}
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
}
|
||||
|
|
5868
src/scanner.rs
5868
src/scanner.rs
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,7 @@ unsafe fn yaml_emitter_set_writer_error(
|
|||
(*emitter).error = YAML_WRITER_ERROR;
|
||||
let fresh0 = addr_of_mut!((*emitter).problem);
|
||||
*fresh0 = problem;
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}
|
||||
pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
|
||||
__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);
|
||||
*fresh2 = (*emitter).buffer.start;
|
||||
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).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;
|
||||
let fresh4 = addr_of_mut!((*emitter).buffer.pointer);
|
||||
*fresh4 = (*emitter).buffer.start;
|
||||
return 1 as libc::c_int;
|
||||
return 1_i32;
|
||||
} else {
|
||||
return yaml_emitter_set_writer_error(
|
||||
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
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
} else {
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
};
|
||||
let high: libc::c_int = if (*emitter).encoding as libc::c_uint
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
};
|
||||
while (*emitter).buffer.pointer != (*emitter).buffer.last {
|
||||
let mut octet: libc::c_uchar;
|
||||
let mut value: libc::c_uint;
|
||||
let mut k: size_t;
|
||||
octet = *((*emitter).buffer.pointer).wrapping_offset(0 as libc::c_int as isize);
|
||||
let width: libc::c_uint = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int
|
||||
{
|
||||
1 as libc::c_int
|
||||
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int {
|
||||
2 as libc::c_int
|
||||
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int {
|
||||
3 as libc::c_int
|
||||
} else if octet as libc::c_int & 0xf8 as libc::c_int == 0xf0 as libc::c_int {
|
||||
4 as libc::c_int
|
||||
octet = *((*emitter).buffer.pointer).wrapping_offset(0_i32 as isize);
|
||||
let width: libc::c_uint = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
|
||||
1_i32
|
||||
} else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
|
||||
2_i32
|
||||
} else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
|
||||
3_i32
|
||||
} else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
|
||||
4_i32
|
||||
} else {
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}) as libc::c_uint;
|
||||
value = (if octet as libc::c_int & 0x80 as libc::c_int == 0 as libc::c_int {
|
||||
octet as libc::c_int & 0x7f as libc::c_int
|
||||
} else if octet as libc::c_int & 0xe0 as libc::c_int == 0xc0 as libc::c_int {
|
||||
octet as libc::c_int & 0x1f as libc::c_int
|
||||
} else if octet as libc::c_int & 0xf0 as libc::c_int == 0xe0 as libc::c_int {
|
||||
octet as libc::c_int & 0xf as libc::c_int
|
||||
} 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
|
||||
value = (if octet as libc::c_int & 0x80_i32 == 0_i32 {
|
||||
octet as libc::c_int & 0x7f_i32
|
||||
} else if octet as libc::c_int & 0xe0_i32 == 0xc0_i32 {
|
||||
octet as libc::c_int & 0x1f_i32
|
||||
} else if octet as libc::c_int & 0xf0_i32 == 0xe0_i32 {
|
||||
octet as libc::c_int & 0xf_i32
|
||||
} else if octet as libc::c_int & 0xf8_i32 == 0xf0_i32 {
|
||||
octet as libc::c_int & 0x7_i32
|
||||
} else {
|
||||
0 as libc::c_int
|
||||
0_i32
|
||||
}) 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 {
|
||||
octet = *((*emitter).buffer.pointer).wrapping_offset(k as isize);
|
||||
value = (value << 6 as libc::c_int)
|
||||
.wrapping_add((octet as libc::c_int & 0x3f as libc::c_int) as libc::c_uint);
|
||||
value =
|
||||
(value << 6_i32).wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
|
||||
k = k.wrapping_add(1);
|
||||
}
|
||||
let fresh5 = addr_of_mut!((*emitter).buffer.pointer);
|
||||
*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) =
|
||||
(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) =
|
||||
(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);
|
||||
*fresh6 = (*fresh6).wrapping_offset(2 as libc::c_int as isize);
|
||||
*fresh6 = (*fresh6).wrapping_offset(2_i32 as isize);
|
||||
} 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) =
|
||||
(0xd8 as libc::c_int as libc::c_uint).wrapping_add(value >> 18 as libc::c_int)
|
||||
as libc::c_uchar;
|
||||
(0xd8_i32 as libc::c_uint).wrapping_add(value >> 18_i32) as libc::c_uchar;
|
||||
*((*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;
|
||||
*((*emitter).raw_buffer.last).wrapping_offset((high + 2 as libc::c_int) as isize) =
|
||||
(0xdc as libc::c_int as libc::c_uint)
|
||||
.wrapping_add(value >> 8 as libc::c_int & 0xff as libc::c_int as libc::c_uint)
|
||||
(value >> 10_i32 & 0xff_i32 as libc::c_uint) as libc::c_uchar;
|
||||
*((*emitter).raw_buffer.last).wrapping_offset((high + 2_i32) as isize) =
|
||||
(0xdc_i32 as libc::c_uint).wrapping_add(value >> 8_i32 & 0xff_i32 as libc::c_uint)
|
||||
as libc::c_uchar;
|
||||
*((*emitter).raw_buffer.last).wrapping_offset((low + 2 as libc::c_int) as isize) =
|
||||
(value & 0xff as libc::c_int as libc::c_uint) as libc::c_uchar;
|
||||
*((*emitter).raw_buffer.last).wrapping_offset((low + 2_i32) as isize) =
|
||||
(value & 0xff_i32 as libc::c_uint) as libc::c_uchar;
|
||||
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")(
|
||||
|
@ -133,7 +130,7 @@ pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> libc::c_int {
|
|||
*fresh10 = (*emitter).raw_buffer.start;
|
||||
let fresh11 = addr_of_mut!((*emitter).raw_buffer.pointer);
|
||||
*fresh11 = (*emitter).raw_buffer.start;
|
||||
1 as libc::c_int
|
||||
1_i32
|
||||
} else {
|
||||
yaml_emitter_set_writer_error(
|
||||
emitter,
|
||||
|
|
Loading…
Reference in a new issue