mirror of
https://github.com/simonask/libyaml-safer
synced 2025-02-17 04:48:29 +00:00
Remove unneeded integer suffixes
sed -i 's/_i32//' src/*.rs
This commit is contained in:
parent
08913865a8
commit
39bf233ca6
9 changed files with 733 additions and 829 deletions
155
src/api.rs
155
src/api.rs
|
@ -39,9 +39,9 @@ pub unsafe fn yaml_get_version(
|
|||
minor: *mut libc::c_int,
|
||||
patch: *mut libc::c_int,
|
||||
) {
|
||||
*major = 0_i32;
|
||||
*minor = 2_i32;
|
||||
*patch = 5_i32;
|
||||
*major = 0;
|
||||
*minor = 2;
|
||||
*patch = 5;
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn yaml_malloc(size: size_t) -> *mut libc::c_void {
|
||||
|
@ -84,7 +84,7 @@ pub(crate) unsafe fn yaml_string_extend(
|
|||
memset(
|
||||
new_start.wrapping_offset((*end).c_offset_from(*start) as libc::c_long as isize)
|
||||
as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
(*end).c_offset_from(*start) as libc::c_long as libc::c_ulong,
|
||||
);
|
||||
*pointer = new_start.wrapping_offset((*pointer).c_offset_from(*start) as libc::c_long as isize);
|
||||
|
@ -128,7 +128,7 @@ pub(crate) unsafe fn yaml_stack_extend(
|
|||
end: *mut *mut libc::c_void,
|
||||
) -> Success {
|
||||
if (*end as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long
|
||||
>= (2147483647_i32 / 2_i32) as libc::c_long
|
||||
>= (2147483647 / 2) as libc::c_long
|
||||
{
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ pub unsafe fn yaml_parser_initialize(parser: *mut yaml_parser_t) -> Success {
|
|||
__assert!(!parser.is_null());
|
||||
memset(
|
||||
parser as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_parser_t>() as libc::c_ulong,
|
||||
);
|
||||
if BUFFER_INIT!(parser, (*parser).raw_buffer, INPUT_RAW_BUFFER_SIZE).ok {
|
||||
|
@ -265,7 +265,7 @@ pub unsafe fn yaml_parser_delete(parser: *mut yaml_parser_t) {
|
|||
STACK_DEL!((*parser).tag_directives);
|
||||
memset(
|
||||
parser as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_parser_t>() as libc::c_ulong,
|
||||
);
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ unsafe fn yaml_string_read_handler(
|
|||
let parser: *mut yaml_parser_t = data as *mut yaml_parser_t;
|
||||
if (*parser).input.string.current == (*parser).input.string.end {
|
||||
*size_read = 0_u64;
|
||||
return 1_i32;
|
||||
return 1;
|
||||
}
|
||||
if size
|
||||
> (*parser)
|
||||
|
@ -302,7 +302,7 @@ unsafe fn yaml_string_read_handler(
|
|||
let fresh80 = addr_of_mut!((*parser).input.string.current);
|
||||
*fresh80 = (*fresh80).wrapping_offset(size as isize);
|
||||
*size_read = size;
|
||||
1_i32
|
||||
1
|
||||
}
|
||||
|
||||
/// Set a string input.
|
||||
|
@ -363,7 +363,7 @@ pub unsafe fn yaml_emitter_initialize(mut emitter: *mut yaml_emitter_t) -> Succe
|
|||
__assert!(!emitter.is_null());
|
||||
memset(
|
||||
emitter as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_emitter_t>() as libc::c_ulong,
|
||||
);
|
||||
if BUFFER_INIT!(emitter, (*emitter).buffer, OUTPUT_BUFFER_SIZE).ok {
|
||||
|
@ -409,7 +409,7 @@ pub unsafe fn yaml_emitter_delete(emitter: *mut yaml_emitter_t) {
|
|||
yaml_free((*emitter).anchors as *mut libc::c_void);
|
||||
memset(
|
||||
emitter as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_emitter_t>() as libc::c_ulong,
|
||||
);
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ unsafe fn yaml_string_write_handler(
|
|||
.wrapping_sub(*(*emitter).output.string.size_written),
|
||||
);
|
||||
*(*emitter).output.string.size_written = (*emitter).output.string.size;
|
||||
return 0_i32;
|
||||
return 0;
|
||||
}
|
||||
memcpy(
|
||||
(*emitter)
|
||||
|
@ -456,7 +456,7 @@ unsafe fn yaml_string_write_handler(
|
|||
);
|
||||
let fresh153 = addr_of_mut!((*(*emitter).output.string.size_written));
|
||||
*fresh153 = (*fresh153 as libc::c_ulong).wrapping_add(size) as size_t as size_t;
|
||||
1_i32
|
||||
1
|
||||
}
|
||||
|
||||
/// Set a string output.
|
||||
|
@ -518,29 +518,25 @@ pub unsafe fn yaml_emitter_set_encoding(
|
|||
/// specification.
|
||||
pub unsafe fn yaml_emitter_set_canonical(mut emitter: *mut yaml_emitter_t, canonical: libc::c_int) {
|
||||
__assert!(!emitter.is_null());
|
||||
(*emitter).canonical = (canonical != 0_i32) as libc::c_int;
|
||||
(*emitter).canonical = (canonical != 0) as libc::c_int;
|
||||
}
|
||||
|
||||
/// Set the indentation increment.
|
||||
pub unsafe fn yaml_emitter_set_indent(mut emitter: *mut yaml_emitter_t, indent: libc::c_int) {
|
||||
__assert!(!emitter.is_null());
|
||||
(*emitter).best_indent = if 1_i32 < indent && indent < 10_i32 {
|
||||
indent
|
||||
} else {
|
||||
2_i32
|
||||
};
|
||||
(*emitter).best_indent = if 1 < indent && indent < 10 { indent } else { 2 };
|
||||
}
|
||||
|
||||
/// Set the preferred line width. -1 means unlimited.
|
||||
pub unsafe fn yaml_emitter_set_width(mut emitter: *mut yaml_emitter_t, width: libc::c_int) {
|
||||
__assert!(!emitter.is_null());
|
||||
(*emitter).best_width = if width >= 0_i32 { width } else { -1_i32 };
|
||||
(*emitter).best_width = if width >= 0 { width } else { -1 };
|
||||
}
|
||||
|
||||
/// Set if unescaped non-ASCII characters are allowed.
|
||||
pub unsafe fn yaml_emitter_set_unicode(mut emitter: *mut yaml_emitter_t, unicode: libc::c_int) {
|
||||
__assert!(!emitter.is_null());
|
||||
(*emitter).unicode = (unicode != 0_i32) as libc::c_int;
|
||||
(*emitter).unicode = (unicode != 0) as libc::c_int;
|
||||
}
|
||||
|
||||
/// Set the preferred line break.
|
||||
|
@ -574,7 +570,7 @@ pub unsafe fn yaml_token_delete(token: *mut yaml_token_t) {
|
|||
}
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
}
|
||||
|
@ -587,27 +583,27 @@ unsafe fn yaml_check_utf8(start: *const yaml_char_t, length: size_t) -> Success
|
|||
let mut value: libc::c_uint;
|
||||
let mut k: size_t;
|
||||
octet = *pointer;
|
||||
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
|
||||
let width: libc::c_uint = if octet as libc::c_int & 0x80 == 0 {
|
||||
1
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
2
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
3
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
4
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
} as libc::c_uint;
|
||||
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
|
||||
value = if octet as libc::c_int & 0x80 == 0 {
|
||||
octet as libc::c_int & 0x7f
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
octet as libc::c_int & 0x1f
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
octet as libc::c_int & 0xf
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
octet as libc::c_int & 0x7
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
} as libc::c_uint;
|
||||
if width == 0 {
|
||||
return FAIL;
|
||||
|
@ -618,17 +614,16 @@ unsafe fn yaml_check_utf8(start: *const yaml_char_t, length: size_t) -> Success
|
|||
k = 1_u64;
|
||||
while k < width as libc::c_ulong {
|
||||
octet = *pointer.wrapping_offset(k as isize);
|
||||
if octet as libc::c_int & 0xc0_i32 != 0x80_i32 {
|
||||
if octet as libc::c_int & 0xc0 != 0x80 {
|
||||
return FAIL;
|
||||
}
|
||||
value =
|
||||
(value << 6_i32).wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
|
||||
value = (value << 6).wrapping_add((octet as libc::c_int & 0x3f) as libc::c_uint);
|
||||
k = k.wrapping_add(1);
|
||||
}
|
||||
if !(width == 1_u32
|
||||
|| width == 2_u32 && value >= 0x80_i32 as libc::c_uint
|
||||
|| width == 3_u32 && value >= 0x800_i32 as libc::c_uint
|
||||
|| width == 4_u32 && value >= 0x10000_i32 as libc::c_uint)
|
||||
|| width == 2_u32 && value >= 0x80 as libc::c_uint
|
||||
|| width == 3_u32 && value >= 0x800 as libc::c_uint
|
||||
|| width == 4_u32 && value >= 0x10000 as libc::c_uint)
|
||||
{
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -650,7 +645,7 @@ pub unsafe fn yaml_stream_start_event_initialize(
|
|||
__assert!(!event.is_null());
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_STREAM_START_EVENT;
|
||||
|
@ -670,7 +665,7 @@ pub unsafe fn yaml_stream_end_event_initialize(mut event: *mut yaml_event_t) ->
|
|||
__assert!(!event.is_null());
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_STREAM_END_EVENT;
|
||||
|
@ -795,7 +790,7 @@ pub unsafe fn yaml_document_start_event_initialize(
|
|||
_ => {
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_START_EVENT;
|
||||
|
@ -842,7 +837,7 @@ pub unsafe fn yaml_document_end_event_initialize(
|
|||
__assert!(!event.is_null());
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_END_EVENT;
|
||||
|
@ -873,7 +868,7 @@ pub unsafe fn yaml_alias_event_initialize(
|
|||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_ALIAS_EVENT;
|
||||
|
@ -945,11 +940,11 @@ pub unsafe fn yaml_scalar_event_initialize(
|
|||
match current_block {
|
||||
16285396129609901221 => {}
|
||||
_ => {
|
||||
if length < 0_i32 {
|
||||
if length < 0 {
|
||||
length = strlen(value as *mut libc::c_char) as libc::c_int;
|
||||
}
|
||||
if yaml_check_utf8(value, length as size_t).ok {
|
||||
value_copy = yaml_malloc((length + 1_i32) as size_t) as *mut yaml_char_t;
|
||||
value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t;
|
||||
if !value_copy.is_null() {
|
||||
memcpy(
|
||||
value_copy as *mut libc::c_void,
|
||||
|
@ -959,7 +954,7 @@ pub unsafe fn yaml_scalar_event_initialize(
|
|||
*value_copy.wrapping_offset(length as isize) = b'\0';
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SCALAR_EVENT;
|
||||
|
@ -1045,7 +1040,7 @@ pub unsafe fn yaml_sequence_start_event_initialize(
|
|||
_ => {
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_START_EVENT;
|
||||
|
@ -1078,7 +1073,7 @@ pub unsafe fn yaml_sequence_end_event_initialize(mut event: *mut yaml_event_t) -
|
|||
__assert!(!event.is_null());
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_END_EVENT;
|
||||
|
@ -1143,7 +1138,7 @@ pub unsafe fn yaml_mapping_start_event_initialize(
|
|||
_ => {
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_START_EVENT;
|
||||
|
@ -1176,7 +1171,7 @@ pub unsafe fn yaml_mapping_end_event_initialize(mut event: *mut yaml_event_t) ->
|
|||
__assert!(!event.is_null());
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_END_EVENT;
|
||||
|
@ -1220,7 +1215,7 @@ pub unsafe fn yaml_event_delete(event: *mut yaml_event_t) {
|
|||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
}
|
||||
|
@ -1352,7 +1347,7 @@ pub unsafe fn yaml_document_initialize(
|
|||
_ => {
|
||||
memset(
|
||||
document as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_document_t>() as libc::c_ulong,
|
||||
);
|
||||
let fresh176 = addr_of_mut!((*document).nodes.start);
|
||||
|
@ -1423,7 +1418,7 @@ pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) {
|
|||
yaml_free((*document).tag_directives.start as *mut libc::c_void);
|
||||
memset(
|
||||
document as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_document_t>() as libc::c_ulong,
|
||||
);
|
||||
}
|
||||
|
@ -1439,8 +1434,7 @@ pub unsafe fn yaml_document_get_node(
|
|||
index: libc::c_int,
|
||||
) -> *mut yaml_node_t {
|
||||
__assert!(!document.is_null());
|
||||
if index > 0_i32
|
||||
&& (*document).nodes.start.wrapping_offset(index as isize) <= (*document).nodes.top
|
||||
if index > 0 && (*document).nodes.start.wrapping_offset(index as isize) <= (*document).nodes.top
|
||||
{
|
||||
return (*document)
|
||||
.nodes
|
||||
|
@ -1502,11 +1496,11 @@ pub unsafe fn yaml_document_add_scalar(
|
|||
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).ok {
|
||||
tag_copy = yaml_strdup(tag);
|
||||
if !tag_copy.is_null() {
|
||||
if length < 0_i32 {
|
||||
if length < 0 {
|
||||
length = strlen(value as *mut libc::c_char) as libc::c_int;
|
||||
}
|
||||
if yaml_check_utf8(value, length as size_t).ok {
|
||||
value_copy = yaml_malloc((length + 1_i32) as size_t) as *mut yaml_char_t;
|
||||
value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t;
|
||||
if !value_copy.is_null() {
|
||||
memcpy(
|
||||
value_copy as *mut libc::c_void,
|
||||
|
@ -1516,7 +1510,7 @@ pub unsafe fn yaml_document_add_scalar(
|
|||
*value_copy.wrapping_offset(length as isize) = b'\0';
|
||||
memset(
|
||||
node as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_node_t>() as libc::c_ulong,
|
||||
);
|
||||
(*node).type_ = YAML_SCALAR_NODE;
|
||||
|
@ -1536,7 +1530,7 @@ pub unsafe fn yaml_document_add_scalar(
|
|||
}
|
||||
yaml_free(tag_copy as *mut libc::c_void);
|
||||
yaml_free(value_copy as *mut libc::c_void);
|
||||
0_i32
|
||||
0
|
||||
}
|
||||
|
||||
/// Create a SEQUENCE node and attach it to the document.
|
||||
|
@ -1581,7 +1575,7 @@ pub unsafe fn yaml_document_add_sequence(
|
|||
if STACK_INIT!(addr_of_mut!(context), items, yaml_node_item_t).ok {
|
||||
memset(
|
||||
node as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_node_t>() as libc::c_ulong,
|
||||
);
|
||||
(*node).type_ = YAML_SEQUENCE_NODE;
|
||||
|
@ -1601,7 +1595,7 @@ pub unsafe fn yaml_document_add_sequence(
|
|||
}
|
||||
STACK_DEL!(items);
|
||||
yaml_free(tag_copy as *mut libc::c_void);
|
||||
0_i32
|
||||
0
|
||||
}
|
||||
|
||||
/// Create a MAPPING node and attach it to the document.
|
||||
|
@ -1646,7 +1640,7 @@ pub unsafe fn yaml_document_add_mapping(
|
|||
if STACK_INIT!(addr_of_mut!(context), pairs, yaml_node_pair_t).ok {
|
||||
memset(
|
||||
node as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_node_t>() as libc::c_ulong,
|
||||
);
|
||||
(*node).type_ = YAML_MAPPING_NODE;
|
||||
|
@ -1666,7 +1660,7 @@ pub unsafe fn yaml_document_add_mapping(
|
|||
}
|
||||
STACK_DEL!(pairs);
|
||||
yaml_free(tag_copy as *mut libc::c_void);
|
||||
0_i32
|
||||
0
|
||||
}
|
||||
|
||||
/// Add an item to a SEQUENCE node.
|
||||
|
@ -1680,17 +1674,16 @@ pub unsafe fn yaml_document_append_sequence_item(
|
|||
};
|
||||
__assert!(!document.is_null());
|
||||
__assert!(
|
||||
sequence > 0_i32
|
||||
sequence > 0
|
||||
&& ((*document).nodes.start).wrapping_offset(sequence as isize)
|
||||
<= (*document).nodes.top
|
||||
);
|
||||
__assert!(
|
||||
(*((*document).nodes.start).wrapping_offset((sequence - 1_i32) as isize)).type_
|
||||
as libc::c_uint
|
||||
(*((*document).nodes.start).wrapping_offset((sequence - 1) as isize)).type_ as libc::c_uint
|
||||
== YAML_SEQUENCE_NODE as libc::c_int as libc::c_uint
|
||||
);
|
||||
__assert!(
|
||||
item > 0_i32
|
||||
item > 0
|
||||
&& ((*document).nodes.start).wrapping_offset(item as isize) <= (*document).nodes.top
|
||||
);
|
||||
if PUSH!(
|
||||
|
@ -1720,26 +1713,24 @@ pub unsafe fn yaml_document_append_mapping_pair(
|
|||
};
|
||||
__assert!(!document.is_null());
|
||||
__assert!(
|
||||
mapping > 0_i32
|
||||
mapping > 0
|
||||
&& ((*document).nodes.start).wrapping_offset(mapping as isize) <= (*document).nodes.top
|
||||
);
|
||||
__assert!(
|
||||
(*((*document).nodes.start).wrapping_offset((mapping - 1_i32) as isize)).type_
|
||||
as libc::c_uint
|
||||
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize)).type_ as libc::c_uint
|
||||
== YAML_MAPPING_NODE as libc::c_int as libc::c_uint
|
||||
);
|
||||
__assert!(
|
||||
key > 0_i32
|
||||
&& ((*document).nodes.start).wrapping_offset(key as isize) <= (*document).nodes.top
|
||||
key > 0 && ((*document).nodes.start).wrapping_offset(key as isize) <= (*document).nodes.top
|
||||
);
|
||||
__assert!(
|
||||
value > 0_i32
|
||||
value > 0
|
||||
&& ((*document).nodes.start).wrapping_offset(value as isize) <= (*document).nodes.top
|
||||
);
|
||||
let pair = yaml_node_pair_t { key, value };
|
||||
if PUSH!(
|
||||
addr_of_mut!(context),
|
||||
(*((*document).nodes.start).wrapping_offset((mapping - 1_i32) as isize))
|
||||
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize))
|
||||
.data
|
||||
.mapping
|
||||
.pairs,
|
||||
|
|
|
@ -28,7 +28,7 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> Success {
|
|||
__assert!((*emitter).opened == 0);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_STREAM_START_EVENT;
|
||||
|
@ -38,7 +38,7 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> Success {
|
|||
if yaml_emitter_emit(emitter, event).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*emitter).opened = 1_i32;
|
||||
(*emitter).opened = 1;
|
||||
OK
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> Success {
|
|||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_STREAM_END_EVENT;
|
||||
|
@ -69,7 +69,7 @@ pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> Success {
|
|||
if yaml_emitter_emit(emitter, event).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*emitter).closed = 1_i32;
|
||||
(*emitter).closed = 1;
|
||||
OK
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
if !(*emitter).anchors.is_null() {
|
||||
memset(
|
||||
(*emitter).anchors as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
(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,
|
||||
|
@ -130,7 +130,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_START_EVENT;
|
||||
|
@ -143,11 +143,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).ok {
|
||||
yaml_emitter_anchor_node(emitter, 1_i32);
|
||||
if yaml_emitter_dump_node(emitter, 1_i32).ok {
|
||||
yaml_emitter_anchor_node(emitter, 1);
|
||||
if yaml_emitter_dump_node(emitter, 1).ok {
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_END_EVENT;
|
||||
|
@ -177,7 +177,7 @@ unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitte
|
|||
*fresh2 = ptr::null_mut::<yaml_document_t>();
|
||||
return;
|
||||
}
|
||||
index = 0_i32;
|
||||
index = 0;
|
||||
while (*(*emitter).document)
|
||||
.nodes
|
||||
.start
|
||||
|
@ -206,7 +206,7 @@ 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_i32;
|
||||
(*emitter).last_anchor_id = 0;
|
||||
let fresh7 = addr_of_mut!((*emitter).document);
|
||||
*fresh7 = ptr::null_mut::<yaml_document_t>();
|
||||
}
|
||||
|
@ -220,9 +220,9 @@ unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_
|
|||
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_i32) as isize)).references);
|
||||
addr_of_mut!((*((*emitter).anchors).wrapping_offset((index - 1) as isize)).references);
|
||||
*fresh8 += 1;
|
||||
if (*(*emitter).anchors.wrapping_offset((index - 1_i32) as isize)).references == 1_i32 {
|
||||
if (*(*emitter).anchors.wrapping_offset((index - 1) as isize)).references == 1 {
|
||||
match (*node).type_ as libc::c_uint {
|
||||
2 => {
|
||||
item = (*node).data.sequence.items.start;
|
||||
|
@ -241,10 +241,10 @@ unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
} else if (*(*emitter).anchors.wrapping_offset((index - 1_i32) as isize)).references == 2_i32 {
|
||||
} else if (*(*emitter).anchors.wrapping_offset((index - 1) as isize)).references == 2 {
|
||||
let fresh9 = addr_of_mut!((*emitter).last_anchor_id);
|
||||
*fresh9 += 1;
|
||||
(*(*emitter).anchors.wrapping_offset((index - 1_i32) as isize)).anchor = *fresh9;
|
||||
(*(*emitter).anchors.wrapping_offset((index - 1) as isize)).anchor = *fresh9;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,7 @@ unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_in
|
|||
.start
|
||||
.wrapping_offset(index as isize)
|
||||
.wrapping_offset(-1_isize);
|
||||
let anchor_id: libc::c_int =
|
||||
(*(*emitter).anchors.wrapping_offset((index - 1_i32) as isize)).anchor;
|
||||
let anchor_id: libc::c_int = (*(*emitter).anchors.wrapping_offset((index - 1) 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);
|
||||
|
@ -275,10 +274,10 @@ unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_in
|
|||
return FAIL;
|
||||
}
|
||||
}
|
||||
if (*(*emitter).anchors.wrapping_offset((index - 1_i32) as isize)).serialized != 0 {
|
||||
if (*(*emitter).anchors.wrapping_offset((index - 1) as isize)).serialized != 0 {
|
||||
return yaml_emitter_dump_alias(emitter, anchor);
|
||||
}
|
||||
(*(*emitter).anchors.wrapping_offset((index - 1_i32) as isize)).serialized = 1_i32;
|
||||
(*(*emitter).anchors.wrapping_offset((index - 1) as isize)).serialized = 1;
|
||||
match (*node).type_ as libc::c_uint {
|
||||
1 => yaml_emitter_dump_scalar(emitter, node, anchor),
|
||||
2 => yaml_emitter_dump_sequence(emitter, node, anchor),
|
||||
|
@ -300,7 +299,7 @@ unsafe fn yaml_emitter_dump_alias(
|
|||
};
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_ALIAS_EVENT;
|
||||
|
@ -325,14 +324,14 @@ unsafe fn yaml_emitter_dump_scalar(
|
|||
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_i32) as libc::c_int;
|
||||
) == 0) 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_i32) as libc::c_int;
|
||||
) == 0) as libc::c_int;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SCALAR_EVENT;
|
||||
|
@ -363,11 +362,11 @@ unsafe fn yaml_emitter_dump_sequence(
|
|||
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_i32) as libc::c_int;
|
||||
) == 0) as libc::c_int;
|
||||
let mut item: *mut yaml_node_item_t;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_START_EVENT;
|
||||
|
@ -389,7 +388,7 @@ unsafe fn yaml_emitter_dump_sequence(
|
|||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_END_EVENT;
|
||||
|
@ -416,11 +415,11 @@ unsafe fn yaml_emitter_dump_mapping(
|
|||
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_i32) as libc::c_int;
|
||||
) == 0) as libc::c_int;
|
||||
let mut pair: *mut yaml_node_pair_t;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_START_EVENT;
|
||||
|
@ -445,7 +444,7 @@ unsafe fn yaml_emitter_dump_mapping(
|
|||
}
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_END_EVENT;
|
||||
|
|
639
src/emitter.rs
639
src/emitter.rs
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,7 @@ pub unsafe fn yaml_parser_load(
|
|||
__assert!(!document.is_null());
|
||||
memset(
|
||||
document as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_document_t>() as libc::c_ulong,
|
||||
);
|
||||
if STACK_INIT!(parser, (*document).nodes, yaml_node_t).ok {
|
||||
|
@ -231,14 +231,14 @@ unsafe fn yaml_parser_register_anchor(
|
|||
(*data).mark = (*(*(*parser).document)
|
||||
.nodes
|
||||
.start
|
||||
.wrapping_offset((index - 1_i32) as isize))
|
||||
.wrapping_offset((index - 1) 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_i32
|
||||
) == 0
|
||||
{
|
||||
yaml_free(anchor as *mut libc::c_void);
|
||||
return yaml_parser_set_composer_error_context(
|
||||
|
@ -268,7 +268,7 @@ unsafe fn yaml_parser_load_node_add(
|
|||
}
|
||||
let parent_index: libc::c_int = *(*ctx).top.wrapping_offset(-1_isize);
|
||||
let parent: *mut yaml_node_t = addr_of_mut!(
|
||||
*((*(*parser).document).nodes.start).wrapping_offset((parent_index - 1_i32) as isize)
|
||||
*((*(*parser).document).nodes.start).wrapping_offset((parent_index - 1) as isize)
|
||||
);
|
||||
let current_block_17: u64;
|
||||
match (*parent).type_ as libc::c_uint {
|
||||
|
@ -286,7 +286,7 @@ unsafe fn yaml_parser_load_node_add(
|
|||
if !STACK_EMPTY!((*parent).data.mapping.pairs) {
|
||||
let mut p: *mut yaml_node_pair_t =
|
||||
(*parent).data.mapping.pairs.top.wrapping_offset(-1_isize);
|
||||
if (*p).key != 0_i32 && (*p).value == 0_i32 {
|
||||
if (*p).key != 0 && (*p).value == 0 {
|
||||
(*p).value = index;
|
||||
current_block_17 = 11307063007268554308;
|
||||
} else {
|
||||
|
@ -299,7 +299,7 @@ unsafe fn yaml_parser_load_node_add(
|
|||
11307063007268554308 => {}
|
||||
_ => {
|
||||
(*pair).key = index;
|
||||
(*pair).value = 0_i32;
|
||||
(*pair).value = 0;
|
||||
if STACK_LIMIT!(parser, (*parent).data.mapping.pairs).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ unsafe fn yaml_parser_load_alias(
|
|||
if strcmp(
|
||||
(*alias_data).anchor as *mut libc::c_char,
|
||||
anchor as *mut libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
yaml_free(anchor as *mut libc::c_void);
|
||||
return yaml_parser_load_node_add(parser, ctx, (*alias_data).index);
|
||||
|
@ -358,7 +358,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
|| strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
b"!\0" as *const u8 as *const libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
yaml_free(tag as *mut libc::c_void);
|
||||
tag = yaml_strdup(
|
||||
|
@ -377,7 +377,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
_ => {
|
||||
memset(
|
||||
node as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_node_t>() as libc::c_ulong,
|
||||
);
|
||||
(*node).type_ = YAML_SCALAR_NODE;
|
||||
|
@ -433,7 +433,7 @@ unsafe fn yaml_parser_load_sequence(
|
|||
|| strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
b"!\0" as *const u8 as *const libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
yaml_free(tag as *mut libc::c_void);
|
||||
tag = yaml_strdup(
|
||||
|
@ -453,7 +453,7 @@ unsafe fn yaml_parser_load_sequence(
|
|||
if STACK_INIT!(parser, items, yaml_node_item_t).ok {
|
||||
memset(
|
||||
node as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_node_t>() as libc::c_ulong,
|
||||
);
|
||||
(*node).type_ = YAML_SEQUENCE_NODE;
|
||||
|
@ -507,14 +507,14 @@ unsafe fn yaml_parser_load_sequence_end(
|
|||
__assert!(((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0_i64);
|
||||
let index: libc::c_int = *(*ctx).top.wrapping_offset(-1_isize);
|
||||
__assert!(
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).type_
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1) as isize)).type_
|
||||
as libc::c_uint
|
||||
== YAML_SEQUENCE_NODE as libc::c_int as libc::c_uint
|
||||
);
|
||||
(*(*(*parser).document)
|
||||
.nodes
|
||||
.start
|
||||
.wrapping_offset((index - 1_i32) as isize))
|
||||
.wrapping_offset((index - 1) as isize))
|
||||
.end_mark = (*event).end_mark;
|
||||
let _ = POP!(*ctx);
|
||||
OK
|
||||
|
@ -545,7 +545,7 @@ unsafe fn yaml_parser_load_mapping(
|
|||
|| strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
b"!\0" as *const u8 as *const libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
yaml_free(tag as *mut libc::c_void);
|
||||
tag = yaml_strdup(
|
||||
|
@ -565,7 +565,7 @@ unsafe fn yaml_parser_load_mapping(
|
|||
if STACK_INIT!(parser, pairs, yaml_node_pair_t).ok {
|
||||
memset(
|
||||
node as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_node_t>() as libc::c_ulong,
|
||||
);
|
||||
(*node).type_ = YAML_MAPPING_NODE;
|
||||
|
@ -619,14 +619,14 @@ unsafe fn yaml_parser_load_mapping_end(
|
|||
__assert!(((*ctx).top).c_offset_from((*ctx).start) as libc::c_long > 0_i64);
|
||||
let index: libc::c_int = *(*ctx).top.wrapping_offset(-1_isize);
|
||||
__assert!(
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1_i32) as isize)).type_
|
||||
(*((*(*parser).document).nodes.start).wrapping_offset((index - 1) as isize)).type_
|
||||
as libc::c_uint
|
||||
== YAML_MAPPING_NODE as libc::c_int as libc::c_uint
|
||||
);
|
||||
(*(*(*parser).document)
|
||||
.nodes
|
||||
.start
|
||||
.wrapping_offset((index - 1_i32) as isize))
|
||||
.wrapping_offset((index - 1) as isize))
|
||||
.end_mark = (*event).end_mark;
|
||||
let _ = POP!(*ctx);
|
||||
OK
|
||||
|
|
|
@ -86,7 +86,7 @@ macro_rules! CLEAR {
|
|||
$string.pointer = $string.start;
|
||||
memset(
|
||||
$string.start as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
$string.end.c_offset_from($string.start) as libc::c_ulong,
|
||||
);
|
||||
}};
|
||||
|
@ -306,15 +306,15 @@ macro_rules! IS_BLANKZ {
|
|||
macro_rules! WIDTH_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
if *$string.pointer.wrapping_offset($offset as isize) & 0x80 == 0x00 {
|
||||
1_i32
|
||||
1
|
||||
} else if *$string.pointer.wrapping_offset($offset as isize) & 0xE0 == 0xC0 {
|
||||
2_i32
|
||||
2
|
||||
} else if *$string.pointer.wrapping_offset($offset as isize) & 0xF0 == 0xE0 {
|
||||
3_i32
|
||||
3
|
||||
} else if *$string.pointer.wrapping_offset($offset as isize) & 0xF8 == 0xF0 {
|
||||
4_i32
|
||||
4
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
139
src/parser.rs
139
src/parser.rs
|
@ -41,7 +41,7 @@ unsafe fn PEEK_TOKEN(parser: *mut yaml_parser_t) -> *mut yaml_token_t {
|
|||
}
|
||||
|
||||
unsafe fn SKIP_TOKEN(parser: *mut yaml_parser_t) {
|
||||
(*parser).token_available = 0_i32;
|
||||
(*parser).token_available = 0;
|
||||
let fresh3 = addr_of_mut!((*parser).tokens_parsed);
|
||||
*fresh3 = (*fresh3).wrapping_add(1);
|
||||
(*parser).stream_end_produced = ((*(*parser).tokens.head).type_ as libc::c_uint
|
||||
|
@ -68,7 +68,7 @@ pub unsafe fn yaml_parser_parse(parser: *mut yaml_parser_t, event: *mut yaml_eve
|
|||
__assert!(!event.is_null());
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
if (*parser).stream_end_produced != 0
|
||||
|
@ -113,45 +113,45 @@ unsafe fn yaml_parser_state_machine(
|
|||
) -> Success {
|
||||
match (*parser).state as libc::c_uint {
|
||||
0 => return yaml_parser_parse_stream_start(parser, event),
|
||||
1 => return yaml_parser_parse_document_start(parser, event, 1_i32),
|
||||
2 => return yaml_parser_parse_document_start(parser, event, 0_i32),
|
||||
1 => return yaml_parser_parse_document_start(parser, event, 1),
|
||||
2 => return yaml_parser_parse_document_start(parser, event, 0),
|
||||
3 => return yaml_parser_parse_document_content(parser, event),
|
||||
4 => return yaml_parser_parse_document_end(parser, event),
|
||||
5 => {
|
||||
return yaml_parser_parse_node(parser, event, 1_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 1, 0);
|
||||
}
|
||||
6 => {
|
||||
return yaml_parser_parse_node(parser, event, 1_i32, 1_i32);
|
||||
return yaml_parser_parse_node(parser, event, 1, 1);
|
||||
}
|
||||
7 => {
|
||||
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 0, 0);
|
||||
}
|
||||
8 => {
|
||||
return yaml_parser_parse_block_sequence_entry(parser, event, 1_i32);
|
||||
return yaml_parser_parse_block_sequence_entry(parser, event, 1);
|
||||
}
|
||||
9 => {
|
||||
return yaml_parser_parse_block_sequence_entry(parser, event, 0_i32);
|
||||
return yaml_parser_parse_block_sequence_entry(parser, event, 0);
|
||||
}
|
||||
10 => return yaml_parser_parse_indentless_sequence_entry(parser, event),
|
||||
11 => return yaml_parser_parse_block_mapping_key(parser, event, 1_i32),
|
||||
12 => return yaml_parser_parse_block_mapping_key(parser, event, 0_i32),
|
||||
11 => return yaml_parser_parse_block_mapping_key(parser, event, 1),
|
||||
12 => return yaml_parser_parse_block_mapping_key(parser, event, 0),
|
||||
13 => return yaml_parser_parse_block_mapping_value(parser, event),
|
||||
14 => {
|
||||
return yaml_parser_parse_flow_sequence_entry(parser, event, 1_i32);
|
||||
return yaml_parser_parse_flow_sequence_entry(parser, event, 1);
|
||||
}
|
||||
15 => {
|
||||
return yaml_parser_parse_flow_sequence_entry(parser, event, 0_i32);
|
||||
return yaml_parser_parse_flow_sequence_entry(parser, event, 0);
|
||||
}
|
||||
16 => return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event),
|
||||
17 => return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event),
|
||||
18 => return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event),
|
||||
19 => return yaml_parser_parse_flow_mapping_key(parser, event, 1_i32),
|
||||
20 => return yaml_parser_parse_flow_mapping_key(parser, event, 0_i32),
|
||||
19 => return yaml_parser_parse_flow_mapping_key(parser, event, 1),
|
||||
20 => return yaml_parser_parse_flow_mapping_key(parser, event, 0),
|
||||
21 => {
|
||||
return yaml_parser_parse_flow_mapping_value(parser, event, 0_i32);
|
||||
return yaml_parser_parse_flow_mapping_value(parser, event, 0);
|
||||
}
|
||||
22 => {
|
||||
return yaml_parser_parse_flow_mapping_value(parser, event, 1_i32);
|
||||
return yaml_parser_parse_flow_mapping_value(parser, event, 1);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ unsafe fn yaml_parser_parse_stream_start(
|
|||
(*parser).state = YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_STREAM_START_EVENT;
|
||||
|
@ -243,7 +243,7 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
(*parser).state = YAML_PARSE_BLOCK_NODE_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_START_EVENT;
|
||||
|
@ -255,7 +255,7 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
*fresh10 = ptr::null_mut::<yaml_tag_directive_t>();
|
||||
let fresh11 = addr_of_mut!((*event).data.document_start.tag_directives.end);
|
||||
*fresh11 = ptr::null_mut::<yaml_tag_directive_t>();
|
||||
(*event).data.document_start.implicit = 1_i32;
|
||||
(*event).data.document_start.implicit = 1;
|
||||
OK
|
||||
} else if (*token).type_ as libc::c_uint != YAML_STREAM_END_TOKEN as libc::c_int as libc::c_uint
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
end_mark = (*token).end_mark;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_START_EVENT;
|
||||
|
@ -298,7 +298,7 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
*fresh15 = tag_directives.start;
|
||||
let fresh16 = addr_of_mut!((*event).data.document_start.tag_directives.end);
|
||||
*fresh16 = tag_directives.end;
|
||||
(*event).data.document_start.implicit = 0_i32;
|
||||
(*event).data.document_start.implicit = 0;
|
||||
SKIP_TOKEN(parser);
|
||||
tag_directives.end = ptr::null_mut::<yaml_tag_directive_t>();
|
||||
tag_directives.start = tag_directives.end;
|
||||
|
@ -317,7 +317,7 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
(*parser).state = YAML_PARSE_END_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_STREAM_END_EVENT;
|
||||
|
@ -346,7 +346,7 @@ unsafe fn yaml_parser_parse_document_content(
|
|||
(*parser).state = POP!((*parser).states);
|
||||
yaml_parser_process_empty_scalar(parser, event, (*token).start_mark)
|
||||
} else {
|
||||
yaml_parser_parse_node(parser, event, 1_i32, 0_i32)
|
||||
yaml_parser_parse_node(parser, event, 1, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ unsafe fn yaml_parser_parse_document_end(
|
|||
mut event: *mut yaml_event_t,
|
||||
) -> Success {
|
||||
let mut end_mark: yaml_mark_t;
|
||||
let mut implicit: libc::c_int = 1_i32;
|
||||
let mut implicit: libc::c_int = 1;
|
||||
let token: *mut yaml_token_t = PEEK_TOKEN(parser);
|
||||
if token.is_null() {
|
||||
return FAIL;
|
||||
|
@ -365,7 +365,7 @@ unsafe fn yaml_parser_parse_document_end(
|
|||
if (*token).type_ as libc::c_uint == YAML_DOCUMENT_END_TOKEN as libc::c_int as libc::c_uint {
|
||||
end_mark = (*token).end_mark;
|
||||
SKIP_TOKEN(parser);
|
||||
implicit = 0_i32;
|
||||
implicit = 0;
|
||||
}
|
||||
while !STACK_EMPTY!((*parser).tag_directives) {
|
||||
let tag_directive = POP!((*parser).tag_directives);
|
||||
|
@ -375,7 +375,7 @@ unsafe fn yaml_parser_parse_document_end(
|
|||
(*parser).state = YAML_PARSE_DOCUMENT_START_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_DOCUMENT_END_EVENT;
|
||||
|
@ -413,7 +413,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = POP!((*parser).states);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_ALIAS_EVENT;
|
||||
|
@ -499,7 +499,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
if strcmp(
|
||||
(*tag_directive).handle as *mut libc::c_char,
|
||||
tag_handle as *mut libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
let prefix_len: size_t =
|
||||
strlen((*tag_directive).prefix as *mut libc::c_char);
|
||||
|
@ -572,7 +572,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_START_EVENT;
|
||||
|
@ -588,8 +588,8 @@ unsafe fn yaml_parser_parse_node(
|
|||
} else if (*token).type_ as libc::c_uint
|
||||
== YAML_SCALAR_TOKEN as libc::c_int as libc::c_uint
|
||||
{
|
||||
let mut plain_implicit: libc::c_int = 0_i32;
|
||||
let mut quoted_implicit: libc::c_int = 0_i32;
|
||||
let mut plain_implicit: libc::c_int = 0;
|
||||
let mut quoted_implicit: libc::c_int = 0;
|
||||
end_mark = (*token).end_mark;
|
||||
if (*token).data.scalar.style as libc::c_uint
|
||||
== YAML_PLAIN_SCALAR_STYLE as libc::c_int as libc::c_uint
|
||||
|
@ -598,16 +598,16 @@ unsafe fn yaml_parser_parse_node(
|
|||
&& strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
b"!\0" as *const u8 as *const libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
plain_implicit = 1_i32;
|
||||
plain_implicit = 1;
|
||||
} else if tag.is_null() {
|
||||
quoted_implicit = 1_i32;
|
||||
quoted_implicit = 1;
|
||||
}
|
||||
(*parser).state = POP!((*parser).states);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SCALAR_EVENT;
|
||||
|
@ -632,7 +632,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_START_EVENT;
|
||||
|
@ -652,7 +652,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_START_EVENT;
|
||||
|
@ -673,7 +673,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_START_EVENT;
|
||||
|
@ -694,7 +694,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_START_EVENT;
|
||||
|
@ -716,7 +716,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
(*parser).state = POP!((*parser).states);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SCALAR_EVENT;
|
||||
|
@ -730,7 +730,7 @@ unsafe fn yaml_parser_parse_node(
|
|||
*fresh56 = value;
|
||||
(*event).data.scalar.length = 0_u64;
|
||||
(*event).data.scalar.plain_implicit = implicit;
|
||||
(*event).data.scalar.quoted_implicit = 0_i32;
|
||||
(*event).data.scalar.quoted_implicit = 0;
|
||||
(*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
|
||||
return OK;
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_parse_node(parser, event, 1_i32, 0_i32)
|
||||
yaml_parser_parse_node(parser, event, 1, 0)
|
||||
} else {
|
||||
(*parser).state = YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE;
|
||||
yaml_parser_process_empty_scalar(parser, event, mark)
|
||||
|
@ -810,7 +810,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
|
|||
let _ = POP!((*parser).marks);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_END_EVENT;
|
||||
|
@ -860,7 +860,7 @@ unsafe fn yaml_parser_parse_indentless_sequence_entry(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_parse_node(parser, event, 1_i32, 0_i32)
|
||||
yaml_parser_parse_node(parser, event, 1, 0)
|
||||
} else {
|
||||
(*parser).state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
|
||||
yaml_parser_process_empty_scalar(parser, event, mark)
|
||||
|
@ -869,7 +869,7 @@ unsafe fn yaml_parser_parse_indentless_sequence_entry(
|
|||
(*parser).state = POP!((*parser).states);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_END_EVENT;
|
||||
|
@ -916,7 +916,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_parse_node(parser, event, 1_i32, 1_i32)
|
||||
yaml_parser_parse_node(parser, event, 1, 1)
|
||||
} else {
|
||||
(*parser).state = YAML_PARSE_BLOCK_MAPPING_VALUE_STATE;
|
||||
yaml_parser_process_empty_scalar(parser, event, mark)
|
||||
|
@ -927,7 +927,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
|
|||
let _ = POP!((*parser).marks);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_END_EVENT;
|
||||
|
@ -970,7 +970,7 @@ unsafe fn yaml_parser_parse_block_mapping_value(
|
|||
if PUSH!(parser, (*parser).states, YAML_PARSE_BLOCK_MAPPING_KEY_STATE).fail {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_parse_node(parser, event, 1_i32, 1_i32)
|
||||
yaml_parser_parse_node(parser, event, 1, 1)
|
||||
} else {
|
||||
(*parser).state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
|
||||
yaml_parser_process_empty_scalar(parser, event, mark)
|
||||
|
@ -1024,7 +1024,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
|
|||
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_START_EVENT;
|
||||
|
@ -1034,7 +1034,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
|
|||
*fresh99 = ptr::null_mut::<yaml_char_t>();
|
||||
let fresh100 = addr_of_mut!((*event).data.mapping_start.tag);
|
||||
*fresh100 = ptr::null_mut::<yaml_char_t>();
|
||||
(*event).data.mapping_start.implicit = 1_i32;
|
||||
(*event).data.mapping_start.implicit = 1;
|
||||
(*event).data.mapping_start.style = YAML_FLOW_MAPPING_STYLE;
|
||||
SKIP_TOKEN(parser);
|
||||
return OK;
|
||||
|
@ -1050,14 +1050,14 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 0, 0);
|
||||
}
|
||||
}
|
||||
(*parser).state = POP!((*parser).states);
|
||||
let _ = POP!((*parser).marks);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SEQUENCE_END_EVENT;
|
||||
|
@ -1089,7 +1089,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_key(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_parse_node(parser, event, 0_i32, 0_i32)
|
||||
yaml_parser_parse_node(parser, event, 0, 0)
|
||||
} else {
|
||||
let mark: yaml_mark_t = (*token).end_mark;
|
||||
SKIP_TOKEN(parser);
|
||||
|
@ -1126,7 +1126,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_value(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 0, 0);
|
||||
}
|
||||
}
|
||||
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE;
|
||||
|
@ -1144,7 +1144,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_end(
|
|||
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE;
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_END_EVENT;
|
||||
|
@ -1213,7 +1213,7 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 0, 0);
|
||||
} else {
|
||||
(*parser).state = YAML_PARSE_FLOW_MAPPING_VALUE_STATE;
|
||||
return yaml_parser_process_empty_scalar(parser, event, (*token).start_mark);
|
||||
|
@ -1230,14 +1230,14 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 0, 0);
|
||||
}
|
||||
}
|
||||
(*parser).state = POP!((*parser).states);
|
||||
let _ = POP!((*parser).marks);
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_MAPPING_END_EVENT;
|
||||
|
@ -1274,7 +1274,7 @@ unsafe fn yaml_parser_parse_flow_mapping_value(
|
|||
if PUSH!(parser, (*parser).states, YAML_PARSE_FLOW_MAPPING_KEY_STATE).fail {
|
||||
return FAIL;
|
||||
}
|
||||
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
|
||||
return yaml_parser_parse_node(parser, event, 0, 0);
|
||||
}
|
||||
}
|
||||
(*parser).state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
|
||||
|
@ -1294,7 +1294,7 @@ unsafe fn yaml_parser_process_empty_scalar(
|
|||
*value = b'\0';
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_event_t>() as libc::c_ulong,
|
||||
);
|
||||
(*event).type_ = YAML_SCALAR_EVENT;
|
||||
|
@ -1307,8 +1307,8 @@ unsafe fn yaml_parser_process_empty_scalar(
|
|||
let fresh140 = addr_of_mut!((*event).data.scalar.value);
|
||||
*fresh140 = value;
|
||||
(*event).data.scalar.length = 0_u64;
|
||||
(*event).data.scalar.plain_implicit = 1_i32;
|
||||
(*event).data.scalar.quoted_implicit = 0_i32;
|
||||
(*event).data.scalar.plain_implicit = 1;
|
||||
(*event).data.scalar.quoted_implicit = 0;
|
||||
(*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
|
||||
OK
|
||||
}
|
||||
|
@ -1372,9 +1372,9 @@ unsafe fn yaml_parser_process_directives(
|
|||
);
|
||||
current_block = 17143798186130252483;
|
||||
break;
|
||||
} else if (*token).data.version_directive.major != 1_i32
|
||||
|| (*token).data.version_directive.minor != 1_i32
|
||||
&& (*token).data.version_directive.minor != 2_i32
|
||||
} else if (*token).data.version_directive.major != 1
|
||||
|| (*token).data.version_directive.minor != 1
|
||||
&& (*token).data.version_directive.minor != 2
|
||||
{
|
||||
yaml_parser_set_parser_error(
|
||||
parser,
|
||||
|
@ -1404,8 +1404,7 @@ unsafe fn yaml_parser_process_directives(
|
|||
handle: (*token).data.tag_directive.handle,
|
||||
prefix: (*token).data.tag_directive.prefix,
|
||||
};
|
||||
if yaml_parser_append_tag_directive(parser, value, 0_i32, (*token).start_mark)
|
||||
.fail
|
||||
if yaml_parser_append_tag_directive(parser, value, 0, (*token).start_mark).fail
|
||||
{
|
||||
current_block = 17143798186130252483;
|
||||
break;
|
||||
|
@ -1434,7 +1433,7 @@ unsafe fn yaml_parser_process_directives(
|
|||
if yaml_parser_append_tag_directive(
|
||||
parser,
|
||||
*default_tag_directive,
|
||||
1_i32,
|
||||
1,
|
||||
(*token).start_mark,
|
||||
)
|
||||
.fail
|
||||
|
@ -1499,7 +1498,7 @@ unsafe fn yaml_parser_append_tag_directive(
|
|||
if strcmp(
|
||||
value.handle as *mut libc::c_char,
|
||||
(*tag_directive).handle as *mut libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
if allow_duplicates != 0 {
|
||||
return OK;
|
||||
|
|
151
src/reader.rs
151
src/reader.rs
|
@ -137,13 +137,13 @@ unsafe fn yaml_parser_update_raw_buffer(mut parser: *mut yaml_parser_t) -> Succe
|
|||
parser,
|
||||
b"input error\0" as *const u8 as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-1_i32,
|
||||
-1,
|
||||
);
|
||||
}
|
||||
let fresh9 = addr_of_mut!((*parser).raw_buffer.last);
|
||||
*fresh9 = (*fresh9).wrapping_offset(size_read as isize);
|
||||
if size_read == 0 {
|
||||
(*parser).eof = 1_i32;
|
||||
(*parser).eof = 1;
|
||||
}
|
||||
OK
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
parser: *mut yaml_parser_t,
|
||||
length: size_t,
|
||||
) -> Success {
|
||||
let mut first: libc::c_int = 1_i32;
|
||||
let mut first: libc::c_int = 1;
|
||||
__assert!(((*parser).read_handler).is_some());
|
||||
if (*parser).eof != 0 && (*parser).raw_buffer.pointer == (*parser).raw_buffer.last {
|
||||
return OK;
|
||||
|
@ -194,11 +194,11 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
return FAIL;
|
||||
}
|
||||
}
|
||||
first = 0_i32;
|
||||
first = 0;
|
||||
while (*parser).raw_buffer.pointer != (*parser).raw_buffer.last {
|
||||
let mut value: libc::c_uint = 0_u32;
|
||||
let value2: libc::c_uint;
|
||||
let mut incomplete: libc::c_int = 0_i32;
|
||||
let mut incomplete: libc::c_int = 0;
|
||||
let mut octet: libc::c_uchar;
|
||||
let mut width: libc::c_uint = 0_u32;
|
||||
let low: libc::c_int;
|
||||
|
@ -212,16 +212,16 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
match (*parser).encoding as libc::c_uint {
|
||||
1 => {
|
||||
octet = *(*parser).raw_buffer.pointer;
|
||||
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
|
||||
width = if octet as libc::c_int & 0x80 == 0 {
|
||||
1
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
2
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
3
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
4
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
} as libc::c_uint;
|
||||
if width == 0 {
|
||||
return yaml_parser_set_reader_error(
|
||||
|
@ -238,26 +238,26 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
b"incomplete UTF-8 octet sequence\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-1_i32,
|
||||
-1,
|
||||
);
|
||||
}
|
||||
incomplete = 1_i32;
|
||||
incomplete = 1;
|
||||
} else {
|
||||
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
|
||||
value = if octet as libc::c_int & 0x80 == 0 {
|
||||
octet as libc::c_int & 0x7f
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
octet as libc::c_int & 0x1f
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
octet as libc::c_int & 0xf
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
octet as libc::c_int & 0x7
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
} as libc::c_uint;
|
||||
k = 1_u64;
|
||||
while k < width as libc::c_ulong {
|
||||
octet = *(*parser).raw_buffer.pointer.wrapping_offset(k as isize);
|
||||
if octet as libc::c_int & 0xc0_i32 != 0x80_i32 {
|
||||
if octet as libc::c_int & 0xc0 != 0x80 {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"invalid trailing UTF-8 octet\0" as *const u8
|
||||
|
@ -266,26 +266,25 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
octet as libc::c_int,
|
||||
);
|
||||
}
|
||||
value = (value << 6_i32)
|
||||
.wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
|
||||
value = (value << 6)
|
||||
.wrapping_add((octet as libc::c_int & 0x3f) as libc::c_uint);
|
||||
k = k.wrapping_add(1);
|
||||
}
|
||||
if !(width == 1_u32
|
||||
|| width == 2_u32 && value >= 0x80_i32 as libc::c_uint
|
||||
|| width == 3_u32 && value >= 0x800_i32 as libc::c_uint
|
||||
|| width == 4_u32 && value >= 0x10000_i32 as libc::c_uint)
|
||||
|| width == 2_u32 && value >= 0x80 as libc::c_uint
|
||||
|| width == 3_u32 && value >= 0x800 as libc::c_uint
|
||||
|| width == 4_u32 && value >= 0x10000 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_i32,
|
||||
-1,
|
||||
);
|
||||
}
|
||||
if value >= 0xd800_i32 as libc::c_uint
|
||||
&& value <= 0xdfff_i32 as libc::c_uint
|
||||
|| value > 0x10ffff_i32 as libc::c_uint
|
||||
if value >= 0xd800 as libc::c_uint && value <= 0xdfff as libc::c_uint
|
||||
|| value > 0x10ffff as libc::c_uint
|
||||
{
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
|
@ -300,16 +299,16 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
low = if (*parser).encoding as libc::c_uint
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
0_i32
|
||||
0
|
||||
} else {
|
||||
1_i32
|
||||
1
|
||||
};
|
||||
high = if (*parser).encoding as libc::c_uint
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
1_i32
|
||||
1
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
};
|
||||
if raw_unread < 2_u64 {
|
||||
if (*parser).eof != 0 {
|
||||
|
@ -318,17 +317,17 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
b"incomplete UTF-16 character\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-1_i32,
|
||||
-1,
|
||||
);
|
||||
}
|
||||
incomplete = 1_i32;
|
||||
incomplete = 1;
|
||||
} 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_i32)) as libc::c_uint;
|
||||
if value & 0xfc00_i32 as libc::c_uint == 0xdc00_i32 as libc::c_uint {
|
||||
<< 8)) as libc::c_uint;
|
||||
if value & 0xfc00 as libc::c_uint == 0xdc00 as libc::c_uint {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"unexpected low surrogate area\0" as *const u8
|
||||
|
@ -337,7 +336,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
value as libc::c_int,
|
||||
);
|
||||
}
|
||||
if value & 0xfc00_i32 as libc::c_uint == 0xd800_i32 as libc::c_uint {
|
||||
if value & 0xfc00 as libc::c_uint == 0xd800 as libc::c_uint {
|
||||
width = 4_u32;
|
||||
if raw_unread < 4_u64 {
|
||||
if (*parser).eof != 0 {
|
||||
|
@ -346,25 +345,24 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
b"incomplete UTF-16 surrogate pair\0" as *const u8
|
||||
as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-1_i32,
|
||||
-1,
|
||||
);
|
||||
}
|
||||
incomplete = 1_i32;
|
||||
incomplete = 1;
|
||||
} else {
|
||||
value2 = (*(*parser)
|
||||
.raw_buffer
|
||||
.pointer
|
||||
.wrapping_offset((low + 2_i32) as isize)
|
||||
.wrapping_offset((low + 2) as isize)
|
||||
as libc::c_int
|
||||
+ ((*(*parser)
|
||||
.raw_buffer
|
||||
.pointer
|
||||
.wrapping_offset((high + 2_i32) as isize)
|
||||
.wrapping_offset((high + 2) as isize)
|
||||
as libc::c_int)
|
||||
<< 8_i32))
|
||||
<< 8))
|
||||
as libc::c_uint;
|
||||
if value2 & 0xfc00_i32 as libc::c_uint != 0xdc00_i32 as libc::c_uint
|
||||
{
|
||||
if value2 & 0xfc00 as libc::c_uint != 0xdc00 as libc::c_uint {
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
b"expected low surrogate area\0" as *const u8
|
||||
|
@ -373,9 +371,9 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
value2 as libc::c_int,
|
||||
);
|
||||
}
|
||||
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);
|
||||
value = (0x10000 as libc::c_uint)
|
||||
.wrapping_add((value & 0x3ff as libc::c_uint) << 10)
|
||||
.wrapping_add(value2 & 0x3ff as libc::c_uint);
|
||||
}
|
||||
} else {
|
||||
width = 2_u32;
|
||||
|
@ -387,14 +385,14 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
if incomplete != 0 {
|
||||
break;
|
||||
}
|
||||
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)
|
||||
if !(value == 0x9 as libc::c_uint
|
||||
|| value == 0xa as libc::c_uint
|
||||
|| value == 0xd as libc::c_uint
|
||||
|| value >= 0x20 as libc::c_uint && value <= 0x7e as libc::c_uint
|
||||
|| value == 0x85 as libc::c_uint
|
||||
|| value >= 0xa0 as libc::c_uint && value <= 0xd7ff as libc::c_uint
|
||||
|| value >= 0xe000 as libc::c_uint && value <= 0xfffd as libc::c_uint
|
||||
|| value >= 0x10000 as libc::c_uint && value <= 0x10ffff as libc::c_uint)
|
||||
{
|
||||
return yaml_parser_set_reader_error(
|
||||
parser,
|
||||
|
@ -408,58 +406,55 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
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_i32 as libc::c_uint {
|
||||
if value <= 0x7f 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_i32 as libc::c_uint {
|
||||
} else if value <= 0x7ff as libc::c_uint {
|
||||
let fresh18 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh19 = *fresh18;
|
||||
*fresh18 = (*fresh18).wrapping_offset(1);
|
||||
*fresh19 = (0xc0_i32 as libc::c_uint).wrapping_add(value >> 6_i32) as yaml_char_t;
|
||||
*fresh19 = (0xc0 as libc::c_uint).wrapping_add(value >> 6) as yaml_char_t;
|
||||
let fresh20 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh21 = *fresh20;
|
||||
*fresh20 = (*fresh20).wrapping_offset(1);
|
||||
*fresh21 = (0x80_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
|
||||
*fresh21 = (0x80 as libc::c_uint).wrapping_add(value & 0x3f as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
} else if value <= 0xffff_i32 as libc::c_uint {
|
||||
} else if value <= 0xffff as libc::c_uint {
|
||||
let fresh22 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh23 = *fresh22;
|
||||
*fresh22 = (*fresh22).wrapping_offset(1);
|
||||
*fresh23 = (0xe0_i32 as libc::c_uint).wrapping_add(value >> 12_i32) as yaml_char_t;
|
||||
*fresh23 = (0xe0 as libc::c_uint).wrapping_add(value >> 12) as yaml_char_t;
|
||||
let fresh24 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh25 = *fresh24;
|
||||
*fresh24 = (*fresh24).wrapping_offset(1);
|
||||
*fresh25 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 6_i32 & 0x3f_i32 as libc::c_uint)
|
||||
*fresh25 = (0x80 as libc::c_uint).wrapping_add(value >> 6 & 0x3f 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_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
|
||||
*fresh27 = (0x80 as libc::c_uint).wrapping_add(value & 0x3f 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_i32 as libc::c_uint).wrapping_add(value >> 18_i32) as yaml_char_t;
|
||||
*fresh29 = (0xf0 as libc::c_uint).wrapping_add(value >> 18) as yaml_char_t;
|
||||
let fresh30 = addr_of_mut!((*parser).buffer.last);
|
||||
let fresh31 = *fresh30;
|
||||
*fresh30 = (*fresh30).wrapping_offset(1);
|
||||
*fresh31 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 12_i32 & 0x3f_i32 as libc::c_uint)
|
||||
*fresh31 = (0x80 as libc::c_uint).wrapping_add(value >> 12 & 0x3f 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_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 6_i32 & 0x3f_i32 as libc::c_uint)
|
||||
*fresh33 = (0x80 as libc::c_uint).wrapping_add(value >> 6 & 0x3f 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_i32 as libc::c_uint).wrapping_add(value & 0x3f_i32 as libc::c_uint)
|
||||
*fresh35 = (0x80 as libc::c_uint).wrapping_add(value & 0x3f as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
}
|
||||
let fresh36 = addr_of_mut!((*parser).unread);
|
||||
|
@ -480,7 +475,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
parser,
|
||||
b"input is too long\0" as *const u8 as *const libc::c_char,
|
||||
(*parser).offset,
|
||||
-1_i32,
|
||||
-1,
|
||||
);
|
||||
}
|
||||
OK
|
||||
|
|
308
src/scanner.rs
308
src/scanner.rs
|
@ -150,7 +150,7 @@ pub unsafe fn yaml_parser_scan(
|
|||
__assert!(!token.is_null());
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
if (*parser).stream_end_produced != 0 || (*parser).error as libc::c_uint != 0 {
|
||||
|
@ -162,11 +162,11 @@ pub unsafe fn yaml_parser_scan(
|
|||
}
|
||||
}
|
||||
*token = DEQUEUE!((*parser).tokens);
|
||||
(*parser).token_available = 0_i32;
|
||||
(*parser).token_available = 0;
|
||||
let fresh2 = addr_of_mut!((*parser).tokens_parsed);
|
||||
*fresh2 = (*fresh2).wrapping_add(1);
|
||||
if (*token).type_ as libc::c_uint == YAML_STREAM_END_TOKEN as libc::c_int as libc::c_uint {
|
||||
(*parser).stream_end_produced = 1_i32;
|
||||
(*parser).stream_end_produced = 1;
|
||||
}
|
||||
OK
|
||||
}
|
||||
|
@ -189,9 +189,9 @@ unsafe fn yaml_parser_set_scanner_error(
|
|||
pub(crate) unsafe fn yaml_parser_fetch_more_tokens(mut parser: *mut yaml_parser_t) -> Success {
|
||||
let mut need_more_tokens: libc::c_int;
|
||||
loop {
|
||||
need_more_tokens = 0_i32;
|
||||
need_more_tokens = 0;
|
||||
if (*parser).tokens.head == (*parser).tokens.tail {
|
||||
need_more_tokens = 1_i32;
|
||||
need_more_tokens = 1;
|
||||
} else {
|
||||
let mut simple_key: *mut yaml_simple_key_t;
|
||||
if yaml_parser_stale_simple_keys(parser).fail {
|
||||
|
@ -202,7 +202,7 @@ pub(crate) unsafe fn yaml_parser_fetch_more_tokens(mut parser: *mut yaml_parser_
|
|||
if (*simple_key).possible != 0
|
||||
&& (*simple_key).token_number == (*parser).tokens_parsed
|
||||
{
|
||||
need_more_tokens = 1_i32;
|
||||
need_more_tokens = 1;
|
||||
break;
|
||||
} else {
|
||||
simple_key = simple_key.wrapping_offset(1);
|
||||
|
@ -216,7 +216,7 @@ pub(crate) unsafe fn yaml_parser_fetch_more_tokens(mut parser: *mut yaml_parser_
|
|||
return FAIL;
|
||||
}
|
||||
}
|
||||
(*parser).token_available = 1_i32;
|
||||
(*parser).token_available = 1;
|
||||
OK
|
||||
}
|
||||
|
||||
|
@ -299,16 +299,16 @@ unsafe fn yaml_parser_fetch_next_token(parser: *mut yaml_parser_t) -> Success {
|
|||
return yaml_parser_fetch_tag(parser);
|
||||
}
|
||||
if CHECK!((*parser).buffer, b'|') && (*parser).flow_level == 0 {
|
||||
return yaml_parser_fetch_block_scalar(parser, 1_i32);
|
||||
return yaml_parser_fetch_block_scalar(parser, 1);
|
||||
}
|
||||
if CHECK!((*parser).buffer, b'>') && (*parser).flow_level == 0 {
|
||||
return yaml_parser_fetch_block_scalar(parser, 0_i32);
|
||||
return yaml_parser_fetch_block_scalar(parser, 0);
|
||||
}
|
||||
if CHECK!((*parser).buffer, b'\'') {
|
||||
return yaml_parser_fetch_flow_scalar(parser, 1_i32);
|
||||
return yaml_parser_fetch_flow_scalar(parser, 1);
|
||||
}
|
||||
if CHECK!((*parser).buffer, b'"') {
|
||||
return yaml_parser_fetch_flow_scalar(parser, 0_i32);
|
||||
return yaml_parser_fetch_flow_scalar(parser, 0);
|
||||
}
|
||||
if !(IS_BLANKZ!((*parser).buffer)
|
||||
|| CHECK!((*parser).buffer, b'-')
|
||||
|
@ -363,7 +363,7 @@ unsafe fn yaml_parser_stale_simple_keys(parser: *mut yaml_parser_t) -> Success {
|
|||
);
|
||||
return FAIL;
|
||||
}
|
||||
(*simple_key).possible = 0_i32;
|
||||
(*simple_key).possible = 0;
|
||||
}
|
||||
simple_key = simple_key.wrapping_offset(1);
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ unsafe fn yaml_parser_save_simple_key(parser: *mut yaml_parser_t) -> Success {
|
|||
as libc::c_int;
|
||||
if (*parser).simple_key_allowed != 0 {
|
||||
let simple_key = yaml_simple_key_t {
|
||||
possible: 1_i32,
|
||||
possible: 1,
|
||||
required,
|
||||
token_number: (*parser)
|
||||
.tokens_parsed
|
||||
|
@ -406,14 +406,14 @@ unsafe fn yaml_parser_remove_simple_key(parser: *mut yaml_parser_t) -> Success {
|
|||
return FAIL;
|
||||
}
|
||||
}
|
||||
(*simple_key).possible = 0_i32;
|
||||
(*simple_key).possible = 0;
|
||||
OK
|
||||
}
|
||||
|
||||
unsafe fn yaml_parser_increase_flow_level(mut parser: *mut yaml_parser_t) -> Success {
|
||||
let empty_simple_key = yaml_simple_key_t {
|
||||
possible: 0_i32,
|
||||
required: 0_i32,
|
||||
possible: 0,
|
||||
required: 0,
|
||||
token_number: 0_u64,
|
||||
mark: yaml_mark_t {
|
||||
index: 0_u64,
|
||||
|
@ -424,7 +424,7 @@ unsafe fn yaml_parser_increase_flow_level(mut parser: *mut yaml_parser_t) -> Suc
|
|||
if PUSH!(parser, (*parser).simple_keys, empty_simple_key).fail {
|
||||
return FAIL;
|
||||
}
|
||||
if (*parser).flow_level == 2147483647_i32 {
|
||||
if (*parser).flow_level == 2147483647 {
|
||||
(*parser).error = YAML_MEMORY_ERROR;
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ unsafe fn yaml_parser_roll_indent(
|
|||
(*parser).indent = column as libc::c_int;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = type_;
|
||||
|
@ -498,7 +498,7 @@ unsafe fn yaml_parser_unroll_indent(mut parser: *mut yaml_parser_t, column: ptrd
|
|||
while (*parser).indent as libc::c_long > column {
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_BLOCK_END_TOKEN;
|
||||
|
@ -514,8 +514,8 @@ unsafe fn yaml_parser_unroll_indent(mut parser: *mut yaml_parser_t, column: ptrd
|
|||
|
||||
unsafe fn yaml_parser_fetch_stream_start(mut parser: *mut yaml_parser_t) -> Success {
|
||||
let simple_key = yaml_simple_key_t {
|
||||
possible: 0_i32,
|
||||
required: 0_i32,
|
||||
possible: 0,
|
||||
required: 0,
|
||||
token_number: 0_u64,
|
||||
mark: yaml_mark_t {
|
||||
index: 0_u64,
|
||||
|
@ -525,15 +525,15 @@ unsafe fn yaml_parser_fetch_stream_start(mut parser: *mut yaml_parser_t) -> Succ
|
|||
};
|
||||
let mut token = MaybeUninit::<yaml_token_t>::uninit();
|
||||
let token = token.as_mut_ptr();
|
||||
(*parser).indent = -1_i32;
|
||||
(*parser).indent = -1;
|
||||
if PUSH!(parser, (*parser).simple_keys, simple_key).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).stream_start_produced = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
(*parser).stream_start_produced = 1;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_STREAM_START_TOKEN;
|
||||
|
@ -560,10 +560,10 @@ unsafe fn yaml_parser_fetch_stream_end(mut parser: *mut yaml_parser_t) -> Succes
|
|||
if yaml_parser_remove_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_STREAM_END_TOKEN;
|
||||
|
@ -584,7 +584,7 @@ unsafe fn yaml_parser_fetch_directive(mut parser: *mut yaml_parser_t) -> Success
|
|||
if yaml_parser_remove_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
if yaml_parser_scan_directive(parser, token).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ unsafe fn yaml_parser_fetch_document_indicator(
|
|||
if yaml_parser_remove_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
SKIP(parser);
|
||||
|
@ -615,7 +615,7 @@ unsafe fn yaml_parser_fetch_document_indicator(
|
|||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = type_;
|
||||
|
@ -639,13 +639,13 @@ unsafe fn yaml_parser_fetch_flow_collection_start(
|
|||
if yaml_parser_increase_flow_level(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = type_;
|
||||
|
@ -669,13 +669,13 @@ unsafe fn yaml_parser_fetch_flow_collection_end(
|
|||
if yaml_parser_decrease_flow_level(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = type_;
|
||||
|
@ -693,13 +693,13 @@ unsafe fn yaml_parser_fetch_flow_entry(mut parser: *mut yaml_parser_t) -> Succes
|
|||
if yaml_parser_remove_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_FLOW_ENTRY_TOKEN;
|
||||
|
@ -740,13 +740,13 @@ unsafe fn yaml_parser_fetch_block_entry(mut parser: *mut yaml_parser_t) -> Succe
|
|||
if yaml_parser_remove_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_BLOCK_ENTRY_TOKEN;
|
||||
|
@ -793,7 +793,7 @@ unsafe fn yaml_parser_fetch_key(mut parser: *mut yaml_parser_t) -> Success {
|
|||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_KEY_TOKEN;
|
||||
|
@ -813,7 +813,7 @@ unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> Success {
|
|||
if (*simple_key).possible != 0 {
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_KEY_TOKEN;
|
||||
|
@ -840,8 +840,8 @@ unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> Success {
|
|||
{
|
||||
return FAIL;
|
||||
}
|
||||
(*simple_key).possible = 0_i32;
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*simple_key).possible = 0;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
} else {
|
||||
if (*parser).flow_level == 0 {
|
||||
if (*parser).simple_key_allowed == 0 {
|
||||
|
@ -873,7 +873,7 @@ unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> Success {
|
|||
let end_mark: yaml_mark_t = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_VALUE_TOKEN;
|
||||
|
@ -894,7 +894,7 @@ unsafe fn yaml_parser_fetch_anchor(
|
|||
if yaml_parser_save_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
if yaml_parser_scan_anchor(parser, token, type_).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -911,7 +911,7 @@ unsafe fn yaml_parser_fetch_tag(mut parser: *mut yaml_parser_t) -> Success {
|
|||
if yaml_parser_save_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
if yaml_parser_scan_tag(parser, token).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ unsafe fn yaml_parser_fetch_block_scalar(
|
|||
if yaml_parser_remove_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
if yaml_parser_scan_block_scalar(parser, token, literal).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ unsafe fn yaml_parser_fetch_flow_scalar(
|
|||
if yaml_parser_save_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
if yaml_parser_scan_flow_scalar(parser, token, single).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ unsafe fn yaml_parser_fetch_plain_scalar(mut parser: *mut yaml_parser_t) -> Succ
|
|||
if yaml_parser_save_simple_key(parser).fail {
|
||||
return FAIL;
|
||||
}
|
||||
(*parser).simple_key_allowed = 0_i32;
|
||||
(*parser).simple_key_allowed = 0;
|
||||
if yaml_parser_scan_plain_scalar(parser, token).fail {
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ unsafe fn yaml_parser_scan_to_next_token(mut parser: *mut yaml_parser_t) -> Succ
|
|||
}
|
||||
SKIP_LINE(parser);
|
||||
if (*parser).flow_level == 0 {
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
}
|
||||
}
|
||||
OK
|
||||
|
@ -1038,7 +1038,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
if strcmp(
|
||||
name as *mut libc::c_char,
|
||||
b"YAML\0" as *const u8 as *const libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
if yaml_parser_scan_version_directive_value(
|
||||
parser,
|
||||
|
@ -1053,7 +1053,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
end_mark = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_VERSION_DIRECTIVE_TOKEN;
|
||||
|
@ -1066,7 +1066,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
} else if strcmp(
|
||||
name as *mut libc::c_char,
|
||||
b"TAG\0" as *const u8 as *const libc::c_char,
|
||||
) == 0_i32
|
||||
) == 0
|
||||
{
|
||||
if yaml_parser_scan_tag_directive_value(
|
||||
parser,
|
||||
|
@ -1081,7 +1081,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
end_mark = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_TAG_DIRECTIVE_TOKEN;
|
||||
|
@ -1276,7 +1276,7 @@ unsafe fn yaml_parser_scan_version_directive_number(
|
|||
start_mark: yaml_mark_t,
|
||||
number: *mut libc::c_int,
|
||||
) -> Success {
|
||||
let mut value: libc::c_int = 0_i32;
|
||||
let mut value: libc::c_int = 0;
|
||||
let mut length: size_t = 0_u64;
|
||||
if CACHE(parser, 1_u64).fail {
|
||||
return FAIL;
|
||||
|
@ -1292,7 +1292,7 @@ unsafe fn yaml_parser_scan_version_directive_number(
|
|||
);
|
||||
return FAIL;
|
||||
}
|
||||
value = value * 10_i32 + AS_DIGIT!((*parser).buffer);
|
||||
value = value * 10 + AS_DIGIT!((*parser).buffer);
|
||||
SKIP(parser);
|
||||
if CACHE(parser, 1_u64).fail {
|
||||
return FAIL;
|
||||
|
@ -1343,7 +1343,7 @@ unsafe fn yaml_parser_scan_tag_directive_value(
|
|||
} else {
|
||||
if yaml_parser_scan_tag_handle(
|
||||
parser,
|
||||
1_i32,
|
||||
1,
|
||||
start_mark,
|
||||
addr_of_mut!(handle_value),
|
||||
)
|
||||
|
@ -1376,8 +1376,8 @@ unsafe fn yaml_parser_scan_tag_directive_value(
|
|||
}
|
||||
if yaml_parser_scan_tag_uri(
|
||||
parser,
|
||||
1_i32,
|
||||
1_i32,
|
||||
1,
|
||||
1,
|
||||
ptr::null_mut::<yaml_char_t>(),
|
||||
start_mark,
|
||||
addr_of_mut!(prefix_value),
|
||||
|
@ -1419,7 +1419,7 @@ unsafe fn yaml_parser_scan_anchor(
|
|||
type_: yaml_token_type_t,
|
||||
) -> Success {
|
||||
let current_block: u64;
|
||||
let mut length: libc::c_int = 0_i32;
|
||||
let mut length: libc::c_int = 0;
|
||||
let start_mark: yaml_mark_t;
|
||||
let end_mark: yaml_mark_t;
|
||||
let mut string = NULL_STRING;
|
||||
|
@ -1475,7 +1475,7 @@ unsafe fn yaml_parser_scan_anchor(
|
|||
{
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_ANCHOR_TOKEN;
|
||||
|
@ -1486,7 +1486,7 @@ unsafe fn yaml_parser_scan_anchor(
|
|||
} else {
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_ALIAS_TOKEN;
|
||||
|
@ -1525,8 +1525,8 @@ unsafe fn yaml_parser_scan_tag(
|
|||
SKIP(parser);
|
||||
if yaml_parser_scan_tag_uri(
|
||||
parser,
|
||||
1_i32,
|
||||
0_i32,
|
||||
1,
|
||||
0,
|
||||
ptr::null_mut::<yaml_char_t>(),
|
||||
start_mark,
|
||||
addr_of_mut!(suffix),
|
||||
|
@ -1547,8 +1547,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
current_block = 4488286894823169796;
|
||||
}
|
||||
}
|
||||
} else if yaml_parser_scan_tag_handle(parser, 0_i32, start_mark, addr_of_mut!(handle)).fail
|
||||
{
|
||||
} else if yaml_parser_scan_tag_handle(parser, 0, start_mark, addr_of_mut!(handle)).fail {
|
||||
current_block = 17708497480799081542;
|
||||
} else if *handle as libc::c_int == '!' as i32
|
||||
&& *handle.wrapping_offset(1_isize) as libc::c_int != '\0' as i32
|
||||
|
@ -1559,8 +1558,8 @@ unsafe fn yaml_parser_scan_tag(
|
|||
{
|
||||
if yaml_parser_scan_tag_uri(
|
||||
parser,
|
||||
0_i32,
|
||||
0_i32,
|
||||
0,
|
||||
0,
|
||||
ptr::null_mut::<yaml_char_t>(),
|
||||
start_mark,
|
||||
addr_of_mut!(suffix),
|
||||
|
@ -1571,15 +1570,8 @@ unsafe fn yaml_parser_scan_tag(
|
|||
} else {
|
||||
current_block = 4488286894823169796;
|
||||
}
|
||||
} else if yaml_parser_scan_tag_uri(
|
||||
parser,
|
||||
0_i32,
|
||||
0_i32,
|
||||
handle,
|
||||
start_mark,
|
||||
addr_of_mut!(suffix),
|
||||
)
|
||||
.fail
|
||||
} else if yaml_parser_scan_tag_uri(parser, 0, 0, handle, start_mark, addr_of_mut!(suffix))
|
||||
.fail
|
||||
{
|
||||
current_block = 17708497480799081542;
|
||||
} else {
|
||||
|
@ -1624,7 +1616,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
end_mark = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_TAG_TOKEN;
|
||||
|
@ -1863,7 +1855,7 @@ unsafe fn yaml_parser_scan_uri_escapes(
|
|||
start_mark: yaml_mark_t,
|
||||
string: *mut yaml_string_t,
|
||||
) -> Success {
|
||||
let mut width: libc::c_int = 0_i32;
|
||||
let mut width: libc::c_int = 0;
|
||||
loop {
|
||||
if CACHE(parser, 3_u64).fail {
|
||||
return FAIL;
|
||||
|
@ -1884,19 +1876,19 @@ unsafe fn yaml_parser_scan_uri_escapes(
|
|||
);
|
||||
return FAIL;
|
||||
}
|
||||
let octet: libc::c_uchar = ((AS_HEX_AT!((*parser).buffer, 1) << 4_i32)
|
||||
let octet: libc::c_uchar = ((AS_HEX_AT!((*parser).buffer, 1) << 4)
|
||||
+ AS_HEX_AT!((*parser).buffer, 2)) as libc::c_uchar;
|
||||
if width == 0 {
|
||||
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
|
||||
width = if octet as libc::c_int & 0x80 == 0 {
|
||||
1
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
2
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
3
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
4
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
};
|
||||
if width == 0 {
|
||||
yaml_parser_set_scanner_error(
|
||||
|
@ -1911,7 +1903,7 @@ unsafe fn yaml_parser_scan_uri_escapes(
|
|||
);
|
||||
return FAIL;
|
||||
}
|
||||
} else if octet as libc::c_int & 0xc0_i32 != 0x80_i32 {
|
||||
} else if octet as libc::c_int & 0xc0 != 0x80 {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
if directive != 0 {
|
||||
|
@ -1950,10 +1942,10 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
let mut string = NULL_STRING;
|
||||
let mut leading_break = NULL_STRING;
|
||||
let mut trailing_breaks = NULL_STRING;
|
||||
let mut chomping: libc::c_int = 0_i32;
|
||||
let mut increment: libc::c_int = 0_i32;
|
||||
let mut indent: libc::c_int = 0_i32;
|
||||
let mut leading_blank: libc::c_int = 0_i32;
|
||||
let mut chomping: libc::c_int = 0;
|
||||
let mut increment: libc::c_int = 0;
|
||||
let mut indent: libc::c_int = 0;
|
||||
let mut leading_blank: libc::c_int = 0;
|
||||
let mut trailing_blank: libc::c_int;
|
||||
if STRING_INIT!(parser, string).ok {
|
||||
if STRING_INIT!(parser, leading_break).ok {
|
||||
|
@ -1963,9 +1955,9 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
if CACHE(parser, 1_u64).ok {
|
||||
if CHECK!((*parser).buffer, b'+') || CHECK!((*parser).buffer, b'-') {
|
||||
chomping = if CHECK!((*parser).buffer, b'+') {
|
||||
1_i32
|
||||
1
|
||||
} else {
|
||||
-1_i32
|
||||
-1
|
||||
};
|
||||
SKIP(parser);
|
||||
if CACHE(parser, 1_u64).fail {
|
||||
|
@ -2009,9 +2001,9 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
if CHECK!((*parser).buffer, b'+') || CHECK!((*parser).buffer, b'-')
|
||||
{
|
||||
chomping = if CHECK!((*parser).buffer, b'+') {
|
||||
1_i32
|
||||
1
|
||||
} else {
|
||||
-1_i32
|
||||
-1
|
||||
};
|
||||
SKIP(parser);
|
||||
}
|
||||
|
@ -2082,12 +2074,11 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
_ => {
|
||||
end_mark = (*parser).mark;
|
||||
if increment != 0 {
|
||||
indent =
|
||||
if (*parser).indent >= 0_i32 {
|
||||
(*parser).indent + increment
|
||||
} else {
|
||||
increment
|
||||
};
|
||||
indent = if (*parser).indent >= 0 {
|
||||
(*parser).indent + increment
|
||||
} else {
|
||||
increment
|
||||
};
|
||||
}
|
||||
if yaml_parser_scan_block_scalar_breaks(
|
||||
parser,
|
||||
|
@ -2214,7 +2205,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
match current_block {
|
||||
14984465786483313892 => {}
|
||||
_ => {
|
||||
if chomping != -1_i32 {
|
||||
if chomping != -1 {
|
||||
if JOIN!(
|
||||
parser,
|
||||
string,
|
||||
|
@ -2232,7 +2223,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
match current_block {
|
||||
14984465786483313892 => {}
|
||||
_ => {
|
||||
if chomping == 1_i32 {
|
||||
if chomping == 1 {
|
||||
if JOIN!(parser, string, trailing_breaks).fail {
|
||||
current_block = 14984465786483313892;
|
||||
} else {
|
||||
|
@ -2246,7 +2237,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
_ => {
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_SCALAR_TOKEN;
|
||||
|
@ -2305,7 +2296,7 @@ unsafe fn yaml_parser_scan_block_scalar_breaks(
|
|||
start_mark: yaml_mark_t,
|
||||
end_mark: *mut yaml_mark_t,
|
||||
) -> Success {
|
||||
let mut max_indent: libc::c_int = 0_i32;
|
||||
let mut max_indent: libc::c_int = 0;
|
||||
*end_mark = (*parser).mark;
|
||||
loop {
|
||||
if CACHE(parser, 1_u64).fail {
|
||||
|
@ -2347,11 +2338,11 @@ unsafe fn yaml_parser_scan_block_scalar_breaks(
|
|||
}
|
||||
if *indent == 0 {
|
||||
*indent = max_indent;
|
||||
if *indent < (*parser).indent + 1_i32 {
|
||||
*indent = (*parser).indent + 1_i32;
|
||||
if *indent < (*parser).indent + 1 {
|
||||
*indent = (*parser).indent + 1;
|
||||
}
|
||||
if *indent < 1_i32 {
|
||||
*indent = 1_i32;
|
||||
if *indent < 1 {
|
||||
*indent = 1;
|
||||
}
|
||||
}
|
||||
OK
|
||||
|
@ -2416,7 +2407,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
current_block = 8114179180390253173;
|
||||
break;
|
||||
}
|
||||
leading_blanks = 0_i32;
|
||||
leading_blanks = 0;
|
||||
while !IS_BLANKZ!((*parser).buffer) {
|
||||
if single != 0
|
||||
&& CHECK_AT!((*parser).buffer, b'\'', 0)
|
||||
|
@ -2448,7 +2439,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
}
|
||||
SKIP(parser);
|
||||
SKIP_LINE(parser);
|
||||
leading_blanks = 1_i32;
|
||||
leading_blanks = 1;
|
||||
break;
|
||||
} else if single == 0 && CHECK!((*parser).buffer, b'\\') {
|
||||
let mut code_length: size_t = 0_u64;
|
||||
|
@ -2609,16 +2600,17 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
current_block = 8114179180390253173;
|
||||
break 's_58;
|
||||
} else {
|
||||
value = (value << 4_i32).wrapping_add(
|
||||
AS_HEX_AT!((*parser).buffer, k as isize)
|
||||
as libc::c_uint,
|
||||
);
|
||||
value = (value << 4).wrapping_add(AS_HEX_AT!(
|
||||
(*parser).buffer,
|
||||
k as isize
|
||||
)
|
||||
as libc::c_uint);
|
||||
k = k.wrapping_add(1);
|
||||
}
|
||||
}
|
||||
if value >= 0xd800_i32 as libc::c_uint
|
||||
&& value <= 0xdfff_i32 as libc::c_uint
|
||||
|| value > 0x10ffff_i32 as libc::c_uint
|
||||
if value >= 0xd800 as libc::c_uint
|
||||
&& value <= 0xdfff as libc::c_uint
|
||||
|| value > 0x10ffff as libc::c_uint
|
||||
{
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
|
@ -2632,82 +2624,70 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
current_block = 8114179180390253173;
|
||||
break 's_58;
|
||||
} else {
|
||||
if value <= 0x7f_i32 as libc::c_uint {
|
||||
if value <= 0x7f as libc::c_uint {
|
||||
let fresh573 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh573 = value as yaml_char_t;
|
||||
} else if value <= 0x7ff_i32 as libc::c_uint {
|
||||
} else if value <= 0x7ff as libc::c_uint {
|
||||
let fresh574 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh574 = (0xc0_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 6_i32)
|
||||
*fresh574 = (0xc0 as libc::c_uint)
|
||||
.wrapping_add(value >> 6)
|
||||
as yaml_char_t;
|
||||
let fresh575 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh575 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(
|
||||
value & 0x3f_i32 as libc::c_uint,
|
||||
)
|
||||
*fresh575 = (0x80 as libc::c_uint)
|
||||
.wrapping_add(value & 0x3f as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
} else if value <= 0xffff_i32 as libc::c_uint {
|
||||
} else if value <= 0xffff as libc::c_uint {
|
||||
let fresh576 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh576 = (0xe0_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 12_i32)
|
||||
*fresh576 = (0xe0 as libc::c_uint)
|
||||
.wrapping_add(value >> 12)
|
||||
as yaml_char_t;
|
||||
let fresh577 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh577 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(
|
||||
value >> 6_i32
|
||||
& 0x3f_i32 as libc::c_uint,
|
||||
)
|
||||
*fresh577 = (0x80 as libc::c_uint).wrapping_add(
|
||||
value >> 6 & 0x3f as libc::c_uint,
|
||||
)
|
||||
as yaml_char_t;
|
||||
let fresh578 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh578 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(
|
||||
value & 0x3f_i32 as libc::c_uint,
|
||||
)
|
||||
*fresh578 = (0x80 as libc::c_uint)
|
||||
.wrapping_add(value & 0x3f as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
} else {
|
||||
let fresh579 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh579 = (0xf0_i32 as libc::c_uint)
|
||||
.wrapping_add(value >> 18_i32)
|
||||
*fresh579 = (0xf0 as libc::c_uint)
|
||||
.wrapping_add(value >> 18)
|
||||
as yaml_char_t;
|
||||
let fresh580 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh580 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(
|
||||
value >> 12_i32
|
||||
& 0x3f_i32 as libc::c_uint,
|
||||
)
|
||||
*fresh580 = (0x80 as libc::c_uint).wrapping_add(
|
||||
value >> 12 & 0x3f as libc::c_uint,
|
||||
)
|
||||
as yaml_char_t;
|
||||
let fresh581 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh581 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(
|
||||
value >> 6_i32
|
||||
& 0x3f_i32 as libc::c_uint,
|
||||
)
|
||||
*fresh581 = (0x80 as libc::c_uint).wrapping_add(
|
||||
value >> 6 & 0x3f as libc::c_uint,
|
||||
)
|
||||
as yaml_char_t;
|
||||
let fresh582 = string.pointer;
|
||||
string.pointer =
|
||||
string.pointer.wrapping_offset(1);
|
||||
*fresh582 = (0x80_i32 as libc::c_uint)
|
||||
.wrapping_add(
|
||||
value & 0x3f_i32 as libc::c_uint,
|
||||
)
|
||||
*fresh582 = (0x80 as libc::c_uint)
|
||||
.wrapping_add(value & 0x3f as libc::c_uint)
|
||||
as yaml_char_t;
|
||||
}
|
||||
k = 0_u64;
|
||||
|
@ -2760,7 +2740,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
current_block = 8114179180390253173;
|
||||
break 's_58;
|
||||
}
|
||||
leading_blanks = 1_i32;
|
||||
leading_blanks = 1;
|
||||
} else if READ_LINE!(parser, trailing_breaks).fail {
|
||||
current_block = 8114179180390253173;
|
||||
break 's_58;
|
||||
|
@ -2817,7 +2797,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
end_mark = (*parser).mark;
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_SCALAR_TOKEN;
|
||||
|
@ -2861,8 +2841,8 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
let mut leading_break = NULL_STRING;
|
||||
let mut trailing_breaks = NULL_STRING;
|
||||
let mut whitespaces = NULL_STRING;
|
||||
let mut leading_blanks: libc::c_int = 0_i32;
|
||||
let indent: libc::c_int = (*parser).indent + 1_i32;
|
||||
let mut leading_blanks: libc::c_int = 0;
|
||||
let indent: libc::c_int = (*parser).indent + 1;
|
||||
if STRING_INIT!(parser, string).ok {
|
||||
if STRING_INIT!(parser, leading_break).ok {
|
||||
if STRING_INIT!(parser, trailing_breaks).ok {
|
||||
|
@ -2953,7 +2933,7 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
CLEAR!(leading_break);
|
||||
CLEAR!(trailing_breaks);
|
||||
}
|
||||
leading_blanks = 0_i32;
|
||||
leading_blanks = 0;
|
||||
} else {
|
||||
if JOIN!(parser, string, whitespaces).fail {
|
||||
current_block = 16642808987012640029;
|
||||
|
@ -3017,7 +2997,7 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
current_block = 16642808987012640029;
|
||||
break 's_57;
|
||||
}
|
||||
leading_blanks = 1_i32;
|
||||
leading_blanks = 1;
|
||||
} else if READ_LINE!(parser, trailing_breaks).fail {
|
||||
current_block = 16642808987012640029;
|
||||
break 's_57;
|
||||
|
@ -3040,7 +3020,7 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
_ => {
|
||||
memset(
|
||||
token as *mut libc::c_void,
|
||||
0_i32,
|
||||
0,
|
||||
size_of::<yaml_token_t>() as libc::c_ulong,
|
||||
);
|
||||
(*token).type_ = YAML_SCALAR_TOKEN;
|
||||
|
@ -3053,7 +3033,7 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
as size_t;
|
||||
(*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
|
||||
if leading_blanks != 0 {
|
||||
(*parser).simple_key_allowed = 1_i32;
|
||||
(*parser).simple_key_allowed = 1;
|
||||
}
|
||||
STRING_DEL!(leading_break);
|
||||
STRING_DEL!(trailing_breaks);
|
||||
|
|
|
@ -52,77 +52,76 @@ pub unsafe fn yaml_emitter_flush(emitter: *mut yaml_emitter_t) -> Success {
|
|||
let low: libc::c_int = if (*emitter).encoding as libc::c_uint
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
0_i32
|
||||
0
|
||||
} else {
|
||||
1_i32
|
||||
1
|
||||
};
|
||||
let high: libc::c_int = if (*emitter).encoding as libc::c_uint
|
||||
== YAML_UTF16LE_ENCODING as libc::c_int as libc::c_uint
|
||||
{
|
||||
1_i32
|
||||
1
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
};
|
||||
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;
|
||||
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
|
||||
let width: libc::c_uint = if octet as libc::c_int & 0x80 == 0 {
|
||||
1
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
2
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
3
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
4
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
} as libc::c_uint;
|
||||
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
|
||||
value = if octet as libc::c_int & 0x80 == 0 {
|
||||
octet as libc::c_int & 0x7f
|
||||
} else if octet as libc::c_int & 0xe0 == 0xc0 {
|
||||
octet as libc::c_int & 0x1f
|
||||
} else if octet as libc::c_int & 0xf0 == 0xe0 {
|
||||
octet as libc::c_int & 0xf
|
||||
} else if octet as libc::c_int & 0xf8 == 0xf0 {
|
||||
octet as libc::c_int & 0x7
|
||||
} else {
|
||||
0_i32
|
||||
0
|
||||
} as libc::c_uint;
|
||||
k = 1_u64;
|
||||
while k < width as libc::c_ulong {
|
||||
octet = *(*emitter).buffer.pointer.wrapping_offset(k as isize);
|
||||
value =
|
||||
(value << 6_i32).wrapping_add((octet as libc::c_int & 0x3f_i32) as libc::c_uint);
|
||||
value = (value << 6).wrapping_add((octet as libc::c_int & 0x3f) 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_i32 as libc::c_uint {
|
||||
if value < 0x10000 as libc::c_uint {
|
||||
*(*emitter).raw_buffer.last.wrapping_offset(high as isize) =
|
||||
(value >> 8_i32) as libc::c_uchar;
|
||||
(value >> 8) as libc::c_uchar;
|
||||
*(*emitter).raw_buffer.last.wrapping_offset(low as isize) =
|
||||
(value & 0xff_i32 as libc::c_uint) as libc::c_uchar;
|
||||
(value & 0xff as libc::c_uint) as libc::c_uchar;
|
||||
let fresh6 = addr_of_mut!((*emitter).raw_buffer.last);
|
||||
*fresh6 = (*fresh6).wrapping_offset(2_isize);
|
||||
} else {
|
||||
value = value.wrapping_sub(0x10000_i32 as libc::c_uint);
|
||||
value = value.wrapping_sub(0x10000 as libc::c_uint);
|
||||
*(*emitter).raw_buffer.last.wrapping_offset(high as isize) =
|
||||
(0xd8_i32 as libc::c_uint).wrapping_add(value >> 18_i32) as libc::c_uchar;
|
||||
(0xd8 as libc::c_uint).wrapping_add(value >> 18) as libc::c_uchar;
|
||||
*(*emitter).raw_buffer.last.wrapping_offset(low as isize) =
|
||||
(value >> 10_i32 & 0xff_i32 as libc::c_uint) as libc::c_uchar;
|
||||
(value >> 10 & 0xff 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)
|
||||
.wrapping_offset((high + 2) as isize) = (0xdc as libc::c_uint)
|
||||
.wrapping_add(value >> 8 & 0xff 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;
|
||||
.wrapping_offset((low + 2) as isize) =
|
||||
(value & 0xff as libc::c_uint) as libc::c_uchar;
|
||||
let fresh7 = addr_of_mut!((*emitter).raw_buffer.last);
|
||||
*fresh7 = (*fresh7).wrapping_offset(4_isize);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue