mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-26 21:30:24 +00:00
Remove yaml_char_t conversion from CHECK args
This commit is contained in:
parent
c52336a746
commit
e245fc53a8
3 changed files with 189 additions and 187 deletions
110
src/emitter.rs
110
src/emitter.rs
|
@ -93,7 +93,7 @@ macro_rules! WRITE {
|
|||
macro_rules! WRITE_BREAK {
|
||||
($emitter:expr, $string:expr) => {
|
||||
FLUSH!($emitter)
|
||||
&& if CHECK!($string, '\n') {
|
||||
&& if CHECK!($string, b'\n') {
|
||||
let _ = PUT_BREAK!($emitter);
|
||||
$string.pointer = $string.pointer.wrapping_offset(1);
|
||||
1_i32
|
||||
|
@ -1511,8 +1511,8 @@ unsafe fn yaml_emitter_analyze_scalar(
|
|||
(*emitter).scalar_data.block_allowed = 0_i32;
|
||||
return 1_i32;
|
||||
}
|
||||
if CHECK_AT!(string, '-', 0) && CHECK_AT!(string, '-', 1) && CHECK_AT!(string, '-', 2)
|
||||
|| CHECK_AT!(string, '.', 0) && CHECK_AT!(string, '.', 1) && CHECK_AT!(string, '.', 2)
|
||||
if CHECK_AT!(string, b'-', 0) && CHECK_AT!(string, b'-', 1) && CHECK_AT!(string, b'-', 2)
|
||||
|| CHECK_AT!(string, b'.', 0) && CHECK_AT!(string, b'.', 1) && CHECK_AT!(string, b'.', 2)
|
||||
{
|
||||
block_indicators = 1_i32;
|
||||
flow_indicators = 1_i32;
|
||||
|
@ -1521,53 +1521,53 @@ unsafe fn yaml_emitter_analyze_scalar(
|
|||
followed_by_whitespace = IS_BLANKZ_AT!(string, WIDTH!(string)) as libc::c_int;
|
||||
while string.pointer != string.end {
|
||||
if string.start == string.pointer {
|
||||
if CHECK!(string, '#')
|
||||
|| CHECK!(string, ',')
|
||||
|| CHECK!(string, '[')
|
||||
|| CHECK!(string, ']')
|
||||
|| CHECK!(string, '{')
|
||||
|| CHECK!(string, '}')
|
||||
|| CHECK!(string, '&')
|
||||
|| CHECK!(string, '*')
|
||||
|| CHECK!(string, '!')
|
||||
|| CHECK!(string, '|')
|
||||
|| CHECK!(string, '>')
|
||||
|| CHECK!(string, '\'')
|
||||
|| CHECK!(string, '"')
|
||||
|| CHECK!(string, '%')
|
||||
|| CHECK!(string, '@')
|
||||
|| CHECK!(string, '`')
|
||||
if CHECK!(string, b'#')
|
||||
|| CHECK!(string, b',')
|
||||
|| CHECK!(string, b'[')
|
||||
|| CHECK!(string, b']')
|
||||
|| CHECK!(string, b'{')
|
||||
|| CHECK!(string, b'}')
|
||||
|| CHECK!(string, b'&')
|
||||
|| CHECK!(string, b'*')
|
||||
|| CHECK!(string, b'!')
|
||||
|| CHECK!(string, b'|')
|
||||
|| CHECK!(string, b'>')
|
||||
|| CHECK!(string, b'\'')
|
||||
|| CHECK!(string, b'"')
|
||||
|| CHECK!(string, b'%')
|
||||
|| CHECK!(string, b'@')
|
||||
|| CHECK!(string, b'`')
|
||||
{
|
||||
flow_indicators = 1_i32;
|
||||
block_indicators = 1_i32;
|
||||
}
|
||||
if CHECK!(string, '?') || CHECK!(string, ':') {
|
||||
if CHECK!(string, b'?') || CHECK!(string, b':') {
|
||||
flow_indicators = 1_i32;
|
||||
if followed_by_whitespace != 0 {
|
||||
block_indicators = 1_i32;
|
||||
}
|
||||
}
|
||||
if CHECK!(string, '-') && followed_by_whitespace != 0 {
|
||||
if CHECK!(string, b'-') && followed_by_whitespace != 0 {
|
||||
flow_indicators = 1_i32;
|
||||
block_indicators = 1_i32;
|
||||
}
|
||||
} else {
|
||||
if CHECK!(string, ',')
|
||||
|| CHECK!(string, '?')
|
||||
|| CHECK!(string, '[')
|
||||
|| CHECK!(string, ']')
|
||||
|| CHECK!(string, '{')
|
||||
|| CHECK!(string, '}')
|
||||
if CHECK!(string, b',')
|
||||
|| CHECK!(string, b'?')
|
||||
|| CHECK!(string, b'[')
|
||||
|| CHECK!(string, b']')
|
||||
|| CHECK!(string, b'{')
|
||||
|| CHECK!(string, b'}')
|
||||
{
|
||||
flow_indicators = 1_i32;
|
||||
}
|
||||
if CHECK!(string, ':') {
|
||||
if CHECK!(string, b':') {
|
||||
flow_indicators = 1_i32;
|
||||
if followed_by_whitespace != 0 {
|
||||
block_indicators = 1_i32;
|
||||
}
|
||||
}
|
||||
if CHECK!(string, '#') && preceded_by_whitespace != 0 {
|
||||
if CHECK!(string, b'#') && preceded_by_whitespace != 0 {
|
||||
flow_indicators = 1_i32;
|
||||
block_indicators = 1_i32;
|
||||
}
|
||||
|
@ -1852,25 +1852,25 @@ unsafe fn yaml_emitter_write_tag_content(
|
|||
}
|
||||
while string.pointer != string.end {
|
||||
if IS_ALPHA!(string)
|
||||
|| CHECK!(string, ';')
|
||||
|| CHECK!(string, '/')
|
||||
|| CHECK!(string, '?')
|
||||
|| CHECK!(string, ':')
|
||||
|| CHECK!(string, '@')
|
||||
|| CHECK!(string, '&')
|
||||
|| CHECK!(string, '=')
|
||||
|| CHECK!(string, '+')
|
||||
|| CHECK!(string, '$')
|
||||
|| CHECK!(string, ',')
|
||||
|| CHECK!(string, '_')
|
||||
|| CHECK!(string, '.')
|
||||
|| CHECK!(string, '~')
|
||||
|| CHECK!(string, '*')
|
||||
|| CHECK!(string, '\'')
|
||||
|| CHECK!(string, '(')
|
||||
|| CHECK!(string, ')')
|
||||
|| CHECK!(string, '[')
|
||||
|| CHECK!(string, ']')
|
||||
|| CHECK!(string, b';')
|
||||
|| CHECK!(string, b'/')
|
||||
|| CHECK!(string, b'?')
|
||||
|| CHECK!(string, b':')
|
||||
|| CHECK!(string, b'@')
|
||||
|| CHECK!(string, b'&')
|
||||
|| CHECK!(string, b'=')
|
||||
|| CHECK!(string, b'+')
|
||||
|| CHECK!(string, b'$')
|
||||
|| CHECK!(string, b',')
|
||||
|| CHECK!(string, b'_')
|
||||
|| CHECK!(string, b'.')
|
||||
|| CHECK!(string, b'~')
|
||||
|| CHECK!(string, b'*')
|
||||
|| CHECK!(string, b'\'')
|
||||
|| CHECK!(string, b'(')
|
||||
|| CHECK!(string, b')')
|
||||
|| CHECK!(string, b'[')
|
||||
|| CHECK!(string, b']')
|
||||
{
|
||||
if !(WRITE!(emitter, string)) {
|
||||
return 0_i32;
|
||||
|
@ -1952,7 +1952,7 @@ unsafe fn yaml_emitter_write_plain_scalar(
|
|||
}
|
||||
spaces = 1_i32;
|
||||
} else if IS_BREAK!(string) {
|
||||
if breaks == 0 && CHECK!(string, '\n') {
|
||||
if breaks == 0 && CHECK!(string, b'\n') {
|
||||
if !(PUT_BREAK!(emitter)) {
|
||||
return 0_i32;
|
||||
}
|
||||
|
@ -2018,7 +2018,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
|
|||
}
|
||||
spaces = 1_i32;
|
||||
} else if IS_BREAK!(string) {
|
||||
if breaks == 0 && CHECK!(string, '\n') {
|
||||
if breaks == 0 && CHECK!(string, b'\n') {
|
||||
if !(PUT_BREAK!(emitter)) {
|
||||
return 0_i32;
|
||||
}
|
||||
|
@ -2034,8 +2034,8 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
|
|||
return 0_i32;
|
||||
}
|
||||
}
|
||||
if CHECK!(string, '\'') {
|
||||
if !(PUT!(emitter, '\'')) {
|
||||
if CHECK!(string, b'\'') {
|
||||
if !(PUT!(emitter, b'\'')) {
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
|
@ -2090,8 +2090,8 @@ unsafe fn yaml_emitter_write_double_quoted_scalar(
|
|||
|| (*emitter).unicode == 0 && !IS_ASCII!(string)
|
||||
|| IS_BOM!(string)
|
||||
|| IS_BREAK!(string)
|
||||
|| CHECK!(string, '"')
|
||||
|| CHECK!(string, '\\')
|
||||
|| CHECK!(string, b'"')
|
||||
|| CHECK!(string, b'\\')
|
||||
{
|
||||
let mut octet: libc::c_uchar;
|
||||
let mut width: libc::c_uint;
|
||||
|
@ -2414,7 +2414,7 @@ unsafe fn yaml_emitter_write_folded_scalar(
|
|||
(*emitter).whitespace = 1_i32;
|
||||
while string.pointer != string.end {
|
||||
if IS_BREAK!(string) {
|
||||
if breaks == 0 && leading_spaces == 0 && CHECK!(string, '\n') {
|
||||
if breaks == 0 && leading_spaces == 0 && CHECK!(string, b'\n') {
|
||||
let mut k: libc::c_int = 0_i32;
|
||||
while IS_BREAK_AT!(string, k as isize) {
|
||||
k += WIDTH_AT!(string, k as isize);
|
||||
|
|
|
@ -123,13 +123,13 @@ macro_rules! JOIN {
|
|||
|
||||
macro_rules! CHECK_AT {
|
||||
($string:expr, $octet:expr, $offset:expr) => {
|
||||
*$string.pointer.offset($offset as isize) == $octet as yaml_char_t
|
||||
*$string.pointer.offset($offset as isize) == $octet
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! CHECK {
|
||||
($string:expr, $octet:expr) => {
|
||||
*$string.pointer == $octet as yaml_char_t
|
||||
*$string.pointer == $octet
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ macro_rules! IS_PRINTABLE {
|
|||
|
||||
macro_rules! IS_Z_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
CHECK_AT!($string, '\0', $offset)
|
||||
CHECK_AT!($string, b'\0', $offset)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ macro_rules! IS_BOM {
|
|||
|
||||
macro_rules! IS_SPACE_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
CHECK_AT!($string, ' ', $offset)
|
||||
CHECK_AT!($string, b' ', $offset)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ macro_rules! IS_SPACE {
|
|||
|
||||
macro_rules! IS_TAB_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
CHECK_AT!($string, '\t', $offset)
|
||||
CHECK_AT!($string, b'\t', $offset)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -265,8 +265,8 @@ macro_rules! IS_BLANK {
|
|||
|
||||
macro_rules! IS_BREAK_AT {
|
||||
($string:expr, $offset:expr) => {
|
||||
CHECK_AT!($string, '\r', $offset)
|
||||
|| CHECK_AT!($string, '\n', $offset)
|
||||
CHECK_AT!($string, b'\r', $offset)
|
||||
|| CHECK_AT!($string, b'\n', $offset)
|
||||
|| CHECK_AT!($string, b'\xC2', $offset) && CHECK_AT!($string, b'\x85', $offset + 1)
|
||||
|| CHECK_AT!($string, b'\xE2', $offset)
|
||||
&& CHECK_AT!($string, b'\x80', $offset + 1)
|
||||
|
@ -285,7 +285,7 @@ macro_rules! IS_BREAK {
|
|||
|
||||
macro_rules! IS_CRLF {
|
||||
($string:expr) => {
|
||||
CHECK_AT!($string, '\r', 0) && CHECK_AT!($string, '\n', 1)
|
||||
CHECK_AT!($string, b'\r', 0) && CHECK_AT!($string, b'\n', 1)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
250
src/scanner.rs
250
src/scanner.rs
|
@ -89,7 +89,7 @@ macro_rules! READ {
|
|||
macro_rules! READ_LINE {
|
||||
($parser:expr, $string:expr) => {
|
||||
if STRING_EXTEND!($parser, $string) != 0 {
|
||||
if CHECK_AT!((*$parser).buffer, '\r', 0) && CHECK_AT!((*$parser).buffer, '\n', 1) {
|
||||
if CHECK_AT!((*$parser).buffer, b'\r', 0) && CHECK_AT!((*$parser).buffer, b'\n', 1) {
|
||||
let fresh484 = addr_of_mut!($string.pointer);
|
||||
let fresh485 = *fresh484;
|
||||
*fresh484 = (*fresh484).wrapping_offset(1);
|
||||
|
@ -103,7 +103,8 @@ macro_rules! READ_LINE {
|
|||
*fresh488 = (*fresh488).wrapping_add(1);
|
||||
let fresh489 = addr_of_mut!((*$parser).unread);
|
||||
*fresh489 = (*fresh489 as libc::c_ulong).wrapping_sub(2_u64) as size_t as size_t;
|
||||
} else if CHECK_AT!((*$parser).buffer, '\r', 0) || CHECK_AT!((*$parser).buffer, '\n', 0)
|
||||
} else if CHECK_AT!((*$parser).buffer, b'\r', 0)
|
||||
|| CHECK_AT!((*$parser).buffer, b'\n', 0)
|
||||
{
|
||||
let fresh490 = addr_of_mut!($string.pointer);
|
||||
let fresh491 = *fresh490;
|
||||
|
@ -291,97 +292,97 @@ unsafe fn yaml_parser_fetch_next_token(parser: *mut yaml_parser_t) -> libc::c_in
|
|||
if IS_Z!((*parser).buffer) {
|
||||
return yaml_parser_fetch_stream_end(parser);
|
||||
}
|
||||
if (*parser).mark.column == 0_u64 && CHECK!((*parser).buffer, '%') {
|
||||
if (*parser).mark.column == 0_u64 && CHECK!((*parser).buffer, b'%') {
|
||||
return yaml_parser_fetch_directive(parser);
|
||||
}
|
||||
if (*parser).mark.column == 0_u64
|
||||
&& CHECK_AT!((*parser).buffer, '-', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '-', 1)
|
||||
&& CHECK_AT!((*parser).buffer, '-', 2)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 2)
|
||||
&& IS_BLANKZ_AT!((*parser).buffer, 3)
|
||||
{
|
||||
return yaml_parser_fetch_document_indicator(parser, YAML_DOCUMENT_START_TOKEN);
|
||||
}
|
||||
if (*parser).mark.column == 0_u64
|
||||
&& CHECK_AT!((*parser).buffer, '.', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '.', 1)
|
||||
&& CHECK_AT!((*parser).buffer, '.', 2)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 2)
|
||||
&& IS_BLANKZ_AT!((*parser).buffer, 3)
|
||||
{
|
||||
return yaml_parser_fetch_document_indicator(parser, YAML_DOCUMENT_END_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '[') {
|
||||
if CHECK!((*parser).buffer, b'[') {
|
||||
return yaml_parser_fetch_flow_collection_start(parser, YAML_FLOW_SEQUENCE_START_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '{') {
|
||||
if CHECK!((*parser).buffer, b'{') {
|
||||
return yaml_parser_fetch_flow_collection_start(parser, YAML_FLOW_MAPPING_START_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, ']') {
|
||||
if CHECK!((*parser).buffer, b']') {
|
||||
return yaml_parser_fetch_flow_collection_end(parser, YAML_FLOW_SEQUENCE_END_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '}') {
|
||||
if CHECK!((*parser).buffer, b'}') {
|
||||
return yaml_parser_fetch_flow_collection_end(parser, YAML_FLOW_MAPPING_END_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, ',') {
|
||||
if CHECK!((*parser).buffer, b',') {
|
||||
return yaml_parser_fetch_flow_entry(parser);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '-') && IS_BLANKZ_AT!((*parser).buffer, 1) {
|
||||
if CHECK!((*parser).buffer, b'-') && IS_BLANKZ_AT!((*parser).buffer, 1) {
|
||||
return yaml_parser_fetch_block_entry(parser);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '?')
|
||||
if CHECK!((*parser).buffer, b'?')
|
||||
&& ((*parser).flow_level != 0 || IS_BLANKZ_AT!((*parser).buffer, 1))
|
||||
{
|
||||
return yaml_parser_fetch_key(parser);
|
||||
}
|
||||
if CHECK!((*parser).buffer, ':')
|
||||
if CHECK!((*parser).buffer, b':')
|
||||
&& ((*parser).flow_level != 0 || IS_BLANKZ_AT!((*parser).buffer, 1))
|
||||
{
|
||||
return yaml_parser_fetch_value(parser);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '*') {
|
||||
if CHECK!((*parser).buffer, b'*') {
|
||||
return yaml_parser_fetch_anchor(parser, YAML_ALIAS_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '&') {
|
||||
if CHECK!((*parser).buffer, b'&') {
|
||||
return yaml_parser_fetch_anchor(parser, YAML_ANCHOR_TOKEN);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '!') {
|
||||
if CHECK!((*parser).buffer, b'!') {
|
||||
return yaml_parser_fetch_tag(parser);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '|') && (*parser).flow_level == 0 {
|
||||
if CHECK!((*parser).buffer, b'|') && (*parser).flow_level == 0 {
|
||||
return yaml_parser_fetch_block_scalar(parser, 1_i32);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '>') && (*parser).flow_level == 0 {
|
||||
if CHECK!((*parser).buffer, b'>') && (*parser).flow_level == 0 {
|
||||
return yaml_parser_fetch_block_scalar(parser, 0_i32);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '\'') {
|
||||
if CHECK!((*parser).buffer, b'\'') {
|
||||
return yaml_parser_fetch_flow_scalar(parser, 1_i32);
|
||||
}
|
||||
if CHECK!((*parser).buffer, '"') {
|
||||
if CHECK!((*parser).buffer, b'"') {
|
||||
return yaml_parser_fetch_flow_scalar(parser, 0_i32);
|
||||
}
|
||||
if !(IS_BLANKZ!((*parser).buffer)
|
||||
|| CHECK!((*parser).buffer, '-')
|
||||
|| CHECK!((*parser).buffer, '?')
|
||||
|| CHECK!((*parser).buffer, ':')
|
||||
|| CHECK!((*parser).buffer, ',')
|
||||
|| CHECK!((*parser).buffer, '[')
|
||||
|| CHECK!((*parser).buffer, ']')
|
||||
|| CHECK!((*parser).buffer, '{')
|
||||
|| CHECK!((*parser).buffer, '}')
|
||||
|| CHECK!((*parser).buffer, '#')
|
||||
|| CHECK!((*parser).buffer, '&')
|
||||
|| CHECK!((*parser).buffer, '*')
|
||||
|| CHECK!((*parser).buffer, '!')
|
||||
|| CHECK!((*parser).buffer, '|')
|
||||
|| CHECK!((*parser).buffer, '>')
|
||||
|| CHECK!((*parser).buffer, '\'')
|
||||
|| CHECK!((*parser).buffer, '"')
|
||||
|| CHECK!((*parser).buffer, '%')
|
||||
|| CHECK!((*parser).buffer, '@')
|
||||
|| CHECK!((*parser).buffer, '`'))
|
||||
|| CHECK!((*parser).buffer, '-') && !IS_BLANK_AT!((*parser).buffer, 1)
|
||||
|| CHECK!((*parser).buffer, b'-')
|
||||
|| CHECK!((*parser).buffer, b'?')
|
||||
|| CHECK!((*parser).buffer, b':')
|
||||
|| CHECK!((*parser).buffer, b',')
|
||||
|| CHECK!((*parser).buffer, b'[')
|
||||
|| CHECK!((*parser).buffer, b']')
|
||||
|| CHECK!((*parser).buffer, b'{')
|
||||
|| CHECK!((*parser).buffer, b'}')
|
||||
|| CHECK!((*parser).buffer, b'#')
|
||||
|| CHECK!((*parser).buffer, b'&')
|
||||
|| CHECK!((*parser).buffer, b'*')
|
||||
|| CHECK!((*parser).buffer, b'!')
|
||||
|| CHECK!((*parser).buffer, b'|')
|
||||
|| CHECK!((*parser).buffer, b'>')
|
||||
|| CHECK!((*parser).buffer, b'\'')
|
||||
|| CHECK!((*parser).buffer, b'"')
|
||||
|| CHECK!((*parser).buffer, b'%')
|
||||
|| CHECK!((*parser).buffer, b'@')
|
||||
|| CHECK!((*parser).buffer, b'`'))
|
||||
|| CHECK!((*parser).buffer, b'-') && !IS_BLANK_AT!((*parser).buffer, 1)
|
||||
|| (*parser).flow_level == 0
|
||||
&& (CHECK!((*parser).buffer, '?') || CHECK!((*parser).buffer, ':'))
|
||||
&& (CHECK!((*parser).buffer, b'?') || CHECK!((*parser).buffer, b':'))
|
||||
&& !IS_BLANKZ_AT!((*parser).buffer, 1)
|
||||
{
|
||||
return yaml_parser_fetch_plain_scalar(parser);
|
||||
|
@ -1029,16 +1030,16 @@ unsafe fn yaml_parser_scan_to_next_token(mut parser: *mut yaml_parser_t) -> libc
|
|||
if CACHE!(parser, 1_u64) == 0 {
|
||||
return 0_i32;
|
||||
}
|
||||
while CHECK!((*parser).buffer, ' ')
|
||||
while CHECK!((*parser).buffer, b' ')
|
||||
|| ((*parser).flow_level != 0 || (*parser).simple_key_allowed == 0)
|
||||
&& CHECK!((*parser).buffer, '\t')
|
||||
&& CHECK!((*parser).buffer, b'\t')
|
||||
{
|
||||
SKIP!(parser);
|
||||
if CACHE!(parser, 1_u64) == 0 {
|
||||
return 0_i32;
|
||||
}
|
||||
}
|
||||
if CHECK!((*parser).buffer, '#') {
|
||||
if CHECK!((*parser).buffer, b'#') {
|
||||
while !IS_BREAKZ!((*parser).buffer) {
|
||||
SKIP!(parser);
|
||||
if CACHE!(parser, 1_u64) == 0 {
|
||||
|
@ -1157,7 +1158,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
match current_block {
|
||||
11397968426844348457 => {}
|
||||
_ => {
|
||||
if CHECK!((*parser).buffer, '#') {
|
||||
if CHECK!((*parser).buffer, b'#') {
|
||||
loop {
|
||||
if IS_BREAKZ!((*parser).buffer) {
|
||||
current_block = 6669252993407410313;
|
||||
|
@ -1290,7 +1291,7 @@ unsafe fn yaml_parser_scan_version_directive_value(
|
|||
if yaml_parser_scan_version_directive_number(parser, start_mark, major) == 0 {
|
||||
return 0_i32;
|
||||
}
|
||||
if !CHECK!((*parser).buffer, '.') {
|
||||
if !CHECK!((*parser).buffer, b'.') {
|
||||
return yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
b"while scanning a %YAML directive\0" as *const u8 as *const libc::c_char,
|
||||
|
@ -1480,14 +1481,14 @@ unsafe fn yaml_parser_scan_anchor(
|
|||
end_mark = (*parser).mark;
|
||||
if length == 0
|
||||
|| !(IS_BLANKZ!((*parser).buffer)
|
||||
|| CHECK!((*parser).buffer, '?')
|
||||
|| CHECK!((*parser).buffer, ':')
|
||||
|| CHECK!((*parser).buffer, ',')
|
||||
|| CHECK!((*parser).buffer, ']')
|
||||
|| CHECK!((*parser).buffer, '}')
|
||||
|| CHECK!((*parser).buffer, '%')
|
||||
|| CHECK!((*parser).buffer, '@')
|
||||
|| CHECK!((*parser).buffer, '`'))
|
||||
|| CHECK!((*parser).buffer, b'?')
|
||||
|| CHECK!((*parser).buffer, b':')
|
||||
|| CHECK!((*parser).buffer, b',')
|
||||
|| CHECK!((*parser).buffer, b']')
|
||||
|| CHECK!((*parser).buffer, b'}')
|
||||
|| CHECK!((*parser).buffer, b'%')
|
||||
|| CHECK!((*parser).buffer, b'@')
|
||||
|| CHECK!((*parser).buffer, b'`'))
|
||||
{
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
|
@ -1547,7 +1548,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
let end_mark: yaml_mark_t;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
if !(CACHE!(parser, 2_u64) == 0) {
|
||||
if CHECK_AT!((*parser).buffer, '<', 1) {
|
||||
if CHECK_AT!((*parser).buffer, b'<', 1) {
|
||||
handle = yaml_malloc(1_u64) as *mut yaml_char_t;
|
||||
if handle.is_null() {
|
||||
current_block = 17708497480799081542;
|
||||
|
@ -1565,7 +1566,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
) == 0
|
||||
{
|
||||
current_block = 17708497480799081542;
|
||||
} else if !CHECK!((*parser).buffer, '>') {
|
||||
} else if !CHECK!((*parser).buffer, b'>') {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
b"while scanning a tag\0" as *const u8 as *const libc::c_char,
|
||||
|
@ -1632,7 +1633,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
_ => {
|
||||
if !(CACHE!(parser, 1_u64) == 0) {
|
||||
if !IS_BLANKZ!((*parser).buffer) {
|
||||
if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, ',') {
|
||||
if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, b',') {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
b"while scanning a tag\0" as *const u8 as *const libc::c_char,
|
||||
|
@ -1685,7 +1686,7 @@ unsafe fn yaml_parser_scan_tag_handle(
|
|||
let mut string = NULL_STRING!();
|
||||
if !(STRING_INIT!(parser, string) == 0) {
|
||||
if !(CACHE!(parser, 1_u64) == 0) {
|
||||
if !CHECK!((*parser).buffer, '!') {
|
||||
if !CHECK!((*parser).buffer, b'!') {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
if directive != 0 {
|
||||
|
@ -1715,7 +1716,7 @@ unsafe fn yaml_parser_scan_tag_handle(
|
|||
match current_block {
|
||||
1771849829115608806 => {}
|
||||
_ => {
|
||||
if CHECK!((*parser).buffer, '!') {
|
||||
if CHECK!((*parser).buffer, b'!') {
|
||||
if READ!(parser, string) == 0 {
|
||||
current_block = 1771849829115608806;
|
||||
} else {
|
||||
|
@ -1810,29 +1811,29 @@ unsafe fn yaml_parser_scan_tag_uri(
|
|||
continue;
|
||||
}
|
||||
while IS_ALPHA!((*parser).buffer)
|
||||
|| CHECK!((*parser).buffer, ';')
|
||||
|| CHECK!((*parser).buffer, '/')
|
||||
|| CHECK!((*parser).buffer, '?')
|
||||
|| CHECK!((*parser).buffer, ':')
|
||||
|| CHECK!((*parser).buffer, '@')
|
||||
|| CHECK!((*parser).buffer, '&')
|
||||
|| CHECK!((*parser).buffer, '=')
|
||||
|| CHECK!((*parser).buffer, '+')
|
||||
|| CHECK!((*parser).buffer, '$')
|
||||
|| CHECK!((*parser).buffer, '.')
|
||||
|| CHECK!((*parser).buffer, '%')
|
||||
|| CHECK!((*parser).buffer, '!')
|
||||
|| CHECK!((*parser).buffer, '~')
|
||||
|| CHECK!((*parser).buffer, '*')
|
||||
|| CHECK!((*parser).buffer, '\'')
|
||||
|| CHECK!((*parser).buffer, '(')
|
||||
|| CHECK!((*parser).buffer, ')')
|
||||
|| CHECK!((*parser).buffer, b';')
|
||||
|| CHECK!((*parser).buffer, b'/')
|
||||
|| CHECK!((*parser).buffer, b'?')
|
||||
|| CHECK!((*parser).buffer, b':')
|
||||
|| CHECK!((*parser).buffer, b'@')
|
||||
|| CHECK!((*parser).buffer, b'&')
|
||||
|| CHECK!((*parser).buffer, b'=')
|
||||
|| CHECK!((*parser).buffer, b'+')
|
||||
|| CHECK!((*parser).buffer, b'$')
|
||||
|| CHECK!((*parser).buffer, b'.')
|
||||
|| CHECK!((*parser).buffer, b'%')
|
||||
|| CHECK!((*parser).buffer, b'!')
|
||||
|| CHECK!((*parser).buffer, b'~')
|
||||
|| CHECK!((*parser).buffer, b'*')
|
||||
|| CHECK!((*parser).buffer, b'\'')
|
||||
|| CHECK!((*parser).buffer, b'(')
|
||||
|| CHECK!((*parser).buffer, b')')
|
||||
|| uri_char != 0
|
||||
&& (CHECK!((*parser).buffer, ',')
|
||||
|| CHECK!((*parser).buffer, '[')
|
||||
|| CHECK!((*parser).buffer, ']'))
|
||||
&& (CHECK!((*parser).buffer, b',')
|
||||
|| CHECK!((*parser).buffer, b'[')
|
||||
|| CHECK!((*parser).buffer, b']'))
|
||||
{
|
||||
if CHECK!((*parser).buffer, '%') {
|
||||
if CHECK!((*parser).buffer, b'%') {
|
||||
if STRING_EXTEND!(parser, string) == 0 {
|
||||
current_block = 15265153392498847348;
|
||||
continue 'c_21953;
|
||||
|
@ -1895,7 +1896,7 @@ unsafe fn yaml_parser_scan_uri_escapes(
|
|||
if CACHE!(parser, 3_u64) == 0 {
|
||||
return 0_i32;
|
||||
}
|
||||
if !(CHECK!((*parser).buffer, '%')
|
||||
if !(CHECK!((*parser).buffer, b'%')
|
||||
&& IS_HEX_AT!((*parser).buffer, 1)
|
||||
&& IS_HEX_AT!((*parser).buffer, 2))
|
||||
{
|
||||
|
@ -1985,8 +1986,8 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
start_mark = (*parser).mark;
|
||||
SKIP!(parser);
|
||||
if !(CACHE!(parser, 1_u64) == 0) {
|
||||
if CHECK!((*parser).buffer, '+') || CHECK!((*parser).buffer, '-') {
|
||||
chomping = if CHECK!((*parser).buffer, '+') {
|
||||
if CHECK!((*parser).buffer, b'+') || CHECK!((*parser).buffer, b'-') {
|
||||
chomping = if CHECK!((*parser).buffer, b'+') {
|
||||
1_i32
|
||||
} else {
|
||||
-1_i32
|
||||
|
@ -1995,7 +1996,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
if CACHE!(parser, 1_u64) == 0 {
|
||||
current_block = 14984465786483313892;
|
||||
} else if IS_DIGIT!((*parser).buffer) {
|
||||
if CHECK!((*parser).buffer, '0') {
|
||||
if CHECK!((*parser).buffer, b'0') {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
b"while scanning a block scalar\0" as *const u8
|
||||
|
@ -2014,7 +2015,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
current_block = 11913429853522160501;
|
||||
}
|
||||
} else if IS_DIGIT!((*parser).buffer) {
|
||||
if CHECK!((*parser).buffer, '0') {
|
||||
if CHECK!((*parser).buffer, b'0') {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
b"while scanning a block scalar\0" as *const u8
|
||||
|
@ -2030,8 +2031,9 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
if CACHE!(parser, 1_u64) == 0 {
|
||||
current_block = 14984465786483313892;
|
||||
} else {
|
||||
if CHECK!((*parser).buffer, '+') || CHECK!((*parser).buffer, '-') {
|
||||
chomping = if CHECK!((*parser).buffer, '+') {
|
||||
if CHECK!((*parser).buffer, b'+') || CHECK!((*parser).buffer, b'-')
|
||||
{
|
||||
chomping = if CHECK!((*parser).buffer, b'+') {
|
||||
1_i32
|
||||
} else {
|
||||
-1_i32
|
||||
|
@ -2062,7 +2064,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
match current_block {
|
||||
14984465786483313892 => {}
|
||||
_ => {
|
||||
if CHECK!((*parser).buffer, '#') {
|
||||
if CHECK!((*parser).buffer, b'#') {
|
||||
loop {
|
||||
if IS_BREAKZ!((*parser).buffer) {
|
||||
current_block = 12997042908615822766;
|
||||
|
@ -2350,12 +2352,12 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
break;
|
||||
}
|
||||
if (*parser).mark.column == 0_u64
|
||||
&& (CHECK_AT!((*parser).buffer, '-', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '-', 1)
|
||||
&& CHECK_AT!((*parser).buffer, '-', 2)
|
||||
|| CHECK_AT!((*parser).buffer, '.', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '.', 1)
|
||||
&& CHECK_AT!((*parser).buffer, '.', 2))
|
||||
&& (CHECK_AT!((*parser).buffer, b'-', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 2)
|
||||
|| CHECK_AT!((*parser).buffer, b'.', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 2))
|
||||
&& IS_BLANKZ_AT!((*parser).buffer, 3)
|
||||
{
|
||||
yaml_parser_set_scanner_error(
|
||||
|
@ -2387,8 +2389,8 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
leading_blanks = 0_i32;
|
||||
while !IS_BLANKZ!((*parser).buffer) {
|
||||
if single != 0
|
||||
&& CHECK_AT!((*parser).buffer, '\'', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '\'', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'\'', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'\'', 1)
|
||||
{
|
||||
if STRING_EXTEND!(parser, string) == 0 {
|
||||
current_block = 8114179180390253173;
|
||||
|
@ -2402,12 +2404,12 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
} else {
|
||||
if CHECK!(
|
||||
(*parser).buffer,
|
||||
if single != 0 { '\'' } else { '"' }
|
||||
if single != 0 { b'\'' } else { b'"' }
|
||||
) {
|
||||
break;
|
||||
}
|
||||
if single == 0
|
||||
&& CHECK!((*parser).buffer, '\\')
|
||||
&& CHECK!((*parser).buffer, b'\\')
|
||||
&& IS_BREAK_AT!((*parser).buffer, 1)
|
||||
{
|
||||
if CACHE!(parser, 3_u64) == 0 {
|
||||
|
@ -2418,7 +2420,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
SKIP_LINE!(parser);
|
||||
leading_blanks = 1_i32;
|
||||
break;
|
||||
} else if single == 0 && CHECK!((*parser).buffer, '\\') {
|
||||
} else if single == 0 && CHECK!((*parser).buffer, b'\\') {
|
||||
let mut code_length: size_t = 0_u64;
|
||||
if STRING_EXTEND!(parser, string) == 0 {
|
||||
current_block = 8114179180390253173;
|
||||
|
@ -2699,7 +2701,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
|
|||
current_block = 8114179180390253173;
|
||||
break;
|
||||
}
|
||||
if CHECK!((*parser).buffer, if single != 0 { '\'' } else { '"' }) {
|
||||
if CHECK!((*parser).buffer, if single != 0 { b'\'' } else { b'"' }) {
|
||||
current_block = 7468767852762055642;
|
||||
break;
|
||||
}
|
||||
|
@ -2843,30 +2845,30 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
break;
|
||||
}
|
||||
if (*parser).mark.column == 0_u64
|
||||
&& (CHECK_AT!((*parser).buffer, '-', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '-', 1)
|
||||
&& CHECK_AT!((*parser).buffer, '-', 2)
|
||||
|| CHECK_AT!((*parser).buffer, '.', 0)
|
||||
&& CHECK_AT!((*parser).buffer, '.', 1)
|
||||
&& CHECK_AT!((*parser).buffer, '.', 2))
|
||||
&& (CHECK_AT!((*parser).buffer, b'-', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'-', 2)
|
||||
|| CHECK_AT!((*parser).buffer, b'.', 0)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 1)
|
||||
&& CHECK_AT!((*parser).buffer, b'.', 2))
|
||||
&& IS_BLANKZ_AT!((*parser).buffer, 3)
|
||||
{
|
||||
current_block = 6281126495347172768;
|
||||
break;
|
||||
}
|
||||
if CHECK!((*parser).buffer, '#') {
|
||||
if CHECK!((*parser).buffer, b'#') {
|
||||
current_block = 6281126495347172768;
|
||||
break;
|
||||
}
|
||||
while !IS_BLANKZ!((*parser).buffer) {
|
||||
if (*parser).flow_level != 0
|
||||
&& CHECK!((*parser).buffer, ':')
|
||||
&& (CHECK_AT!((*parser).buffer, ',', 1)
|
||||
|| CHECK_AT!((*parser).buffer, '?', 1)
|
||||
|| CHECK_AT!((*parser).buffer, '[', 1)
|
||||
|| CHECK_AT!((*parser).buffer, ']', 1)
|
||||
|| CHECK_AT!((*parser).buffer, '{', 1)
|
||||
|| CHECK_AT!((*parser).buffer, '}', 1))
|
||||
&& CHECK!((*parser).buffer, b':')
|
||||
&& (CHECK_AT!((*parser).buffer, b',', 1)
|
||||
|| CHECK_AT!((*parser).buffer, b'?', 1)
|
||||
|| CHECK_AT!((*parser).buffer, b'[', 1)
|
||||
|| CHECK_AT!((*parser).buffer, b']', 1)
|
||||
|| CHECK_AT!((*parser).buffer, b'{', 1)
|
||||
|| CHECK_AT!((*parser).buffer, b'}', 1))
|
||||
{
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
|
@ -2878,14 +2880,14 @@ unsafe fn yaml_parser_scan_plain_scalar(
|
|||
current_block = 16642808987012640029;
|
||||
break 's_57;
|
||||
} else {
|
||||
if CHECK!((*parser).buffer, ':')
|
||||
if CHECK!((*parser).buffer, b':')
|
||||
&& IS_BLANKZ_AT!((*parser).buffer, 1)
|
||||
|| (*parser).flow_level != 0
|
||||
&& (CHECK!((*parser).buffer, ',')
|
||||
|| CHECK!((*parser).buffer, '[')
|
||||
|| CHECK!((*parser).buffer, ']')
|
||||
|| CHECK!((*parser).buffer, '{')
|
||||
|| CHECK!((*parser).buffer, '}'))
|
||||
&& (CHECK!((*parser).buffer, b',')
|
||||
|| CHECK!((*parser).buffer, b'[')
|
||||
|| CHECK!((*parser).buffer, b']')
|
||||
|| CHECK!((*parser).buffer, b'{')
|
||||
|| CHECK!((*parser).buffer, b'}'))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue