ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
xml_decode.c File Reference

Bounded entity and UTF-8 decoding for the no-heap XML pull reader. More...

#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "ra8_attributes.h"
#include "xml.h"
#include "xml_internal.h"
Include dependency graph for xml_decode.c:

Go to the source code of this file.

Data Structures

struct  priv_decode_cursor_t
 Incremental decoded-byte cursor used for allocation-free comparison. More...

Functions

static bool internal_xml_char (uint32_t cp)
 Test whether a scalar is an XML 1.0 character.
static ra8_err_t internal_utf8_lead (uint8_t lead, uint32_t *out_cp, size_t *out_used, uint32_t *out_minimum)
 Classify one UTF-8 lead byte into its scalar width and payload.
static ra8_err_t internal_utf8_next (const uint8_t *source, size_t end, size_t position, uint32_t *out_cp, size_t *out_used)
 Decode one canonical UTF-8 scalar.
bool priv_xml_span_valid (size_t source_len, xml_span_t span)
 Check that a source-relative span is in range.
static size_t internal_utf8 (uint32_t cp, uint8_t out[4])
 Encode one valid Unicode scalar as UTF-8.
static uint32_t internal_digit (uint8_t c, uint32_t base)
 Convert one numeric-reference digit.
bool priv_xml_bytes_equal (const uint8_t *source, size_t offset, const char *literal, size_t length)
 Compare bounded source bytes against a literal of known length.
static ra8_err_t internal_entity (const uint8_t *source, size_t end, size_t position, uint32_t *out_cp, size_t *out_used)
 Decode one entity beginning at a bounded position.
static ra8_err_t internal_decode_one (const uint8_t *source, size_t end, size_t cursor, char *destination, size_t capacity, bool truncate, size_t *output, bool *clipped, size_t *out_used)
 Decode one character or entity and append it to the destination.
static ra8_err_t internal_decode (const uint8_t *source, xml_span_t span, char *destination, size_t capacity, bool truncate, size_t *out_length)
 Decode, prefix-decode, or measure one already-bounded span.
static ra8_err_t internal_decoded_byte (const uint8_t *source, priv_decode_cursor_t *cursor, uint8_t *out)
 Return one entity-decoded byte from a comparison cursor.
ra8_err_t xml_decode (const uint8_t *source, size_t source_len, xml_span_t span, char *destination, size_t capacity, size_t *out_length)
 Entity-decode a source span into a bounded NUL-terminated buffer.
ra8_err_t xml_decode_prefix (const uint8_t *source, size_t source_len, xml_span_t span, char *destination, size_t capacity, size_t *out_length)
 Decode the longest complete prefix that fits the destination.
ra8_err_t xml_decoded_size (const uint8_t *source, size_t source_len, xml_span_t span, size_t *out_length)
 Measure the entity-decoded byte count of a bounded span.
bool xml_span_equal (const uint8_t *source, size_t source_len, xml_span_t span, const char *literal)
 Compare a bounded span with an exact ASCII literal.
bool xml_span_local_equal (const uint8_t *source, size_t source_len, xml_span_t span, const char *literal)
 Compare the namespace-local tail of a bounded span with an ASCII literal.
bool xml_decoded_equal (const uint8_t *source, size_t source_len, xml_span_t left, xml_span_t right)
 Compare two entity-decoded spans from the same immutable source.
ra8_err_t priv_xml_raw (const uint8_t *source, size_t start, size_t end)
 Validate canonical UTF-8 XML 1.0 characters over a byte range.

Detailed Description

Bounded entity and UTF-8 decoding for the no-heap XML pull reader.

Owns the lexical half of the reader: canonical UTF-8 scalar validation and encoding, the five predefined entities plus decimal and hexadecimal character references, bounded span decoding into caller-owned storage, and the decoded comparisons the event walker layers on top. Nothing here reads reader state; the pull reader itself – markup scanning, element frames, and event emission – lives in xml.c.

[Ring 3 / LIB] {World: NS}

Since
0.1.0

Definition in file xml_decode.c.

Function Documentation

◆ internal_decode()

ra8_err_t internal_decode ( const uint8_t * source,
xml_span_t span,
char * destination,
size_t capacity,
bool truncate,
size_t * out_length )
static

Decode, prefix-decode, or measure one already-bounded span.

Validates the complete span even when prefix output clips.

Parameters
[in]sourceImmutable source containing span.
[in]spanValid source-relative encoded span.
[out]destinationOptional decoded destination.
[in]capacityWritable destination capacity including NUL.
[in]truncatePermit a maximal complete prefix when capacity is short.
[out]out_lengthDecoded or emitted byte count.
Returns
Repository error code.
Return values
k_ra8_okComplete validation/decode succeeded.
k_ra8_err_no_memNon-truncating destination capacity was insufficient.
k_ra8_err_validation_failedUTF-8 or entity was invalid.
Precondition
Caller proved span lies in the source extent.
Non-NULL destination spans capacity writable bytes.
Postcondition
Success reports an exact count and NUL-terminates non-NULL destination.
Failure leaves source unchanged; destination may contain a prefix.
Note
Output and source must not overlap.
Since
0.1.0

Definition at line 430 of file xml_decode.c.

References internal_decode_one(), k_ra8_err_no_mem, k_ra8_ok, xml_span_t::length, xml_span_t::offset, and RA8_INTERNAL.

Referenced by xml_decode(), xml_decode_prefix(), and xml_decoded_size().

◆ internal_decode_one()

ra8_err_t internal_decode_one ( const uint8_t * source,
size_t end,
size_t cursor,
char * destination,
size_t capacity,
bool truncate,
size_t * output,
bool * clipped,
size_t * out_used )
static

Decode one character or entity and append it to the destination.

Decodes one XML character reference/entity, or one raw UTF-8 character, at cursor, then copies its UTF-8 bytes into destination, clipping (or rejecting, per truncate) once capacity is reached.

Parameters
[in]sourceImmutable validated XML source.
[in]endExclusive end offset of the decodable span.
[in]cursorCurrent source offset to decode from.
[in,out]destinationCaller-owned destination buffer, or NULL to measure only.
[in]capacityWritable capacity of destination in bytes.
[in]truncateWhether to clip rather than reject on overflow.
[in,out]outputRunning output byte count.
[in,out]clippedWhether the destination has already been clipped.
[out]out_usedSource bytes consumed by this character or entity.
Returns
Decode status.
Return values
k_ra8_okOne character or entity was decoded and appended.
k_ra8_err_no_memCapacity was exhausted and truncate is false.
k_ra8_err_validation_failedThe entity or UTF-8 sequence is malformed.
Precondition
cursor is within the decodable span, strictly less than end.
output and clipped carry the running state of the enclosing span walk and do not alias source.
Postcondition
Success advances output (unless clipped) and reports out_used.
A clip NUL-terminates destination and latches clipped, so every later character is measured but never stored.
Note
Not thread-safe: mutates caller-owned scratch state.
Since
0.1.0

Definition at line 364 of file xml_decode.c.

References internal_entity(), internal_utf8(), internal_utf8_next(), k_ra8_err_no_mem, k_ra8_ok, memcpy(), and RA8_INTERNAL.

Referenced by internal_decode().

◆ internal_decoded_byte()

ra8_err_t internal_decoded_byte ( const uint8_t * source,
priv_decode_cursor_t * cursor,
uint8_t * out )
static

Return one entity-decoded byte from a comparison cursor.

Buffers remaining bytes when one entity decodes to multibyte UTF-8.

Parameters
[in]sourceImmutable source bytes.
[in,out]cursorValid decoded-span cursor.
[out]outNext decoded byte.
Returns
Repository error code.
Return values
k_ra8_okOne byte returned and cursor advanced.
k_ra8_err_validation_failedCursor ended or entity was invalid.
Precondition
Cursor bounds lie within the readable source.
out is writable and does not overlap cursor/source.
Postcondition
Success advances exactly one decoded byte.
Failure leaves source unchanged; cursor progress may be partial.
Note
Used only after complete decoded-size validation.
Since
0.1.0

Definition at line 483 of file xml_decode.c.

References priv_decode_cursor_t::end, internal_entity(), internal_utf8(), k_ra8_err_validation_failed, k_ra8_ok, priv_decode_cursor_t::pending, priv_decode_cursor_t::pending_at, priv_decode_cursor_t::pending_len, and priv_decode_cursor_t::position.

Referenced by xml_decoded_equal().

◆ internal_digit()

uint32_t internal_digit ( uint8_t c,
uint32_t base )
static

Convert one numeric-reference digit.

Supports decimal and hexadecimal reference bodies.

Parameters
[in]cCandidate ASCII digit.
[in]baseNumeric base, ten or sixteen.
Returns
Digit value or UINT32_MAX when invalid.
Return values
UINT32_MAXc is invalid for base.
Precondition
base is 10 or 16.
c is an unsigned source byte.
Postcondition
No memory is modified.
The result depends only on the arguments.
Note
Pure and thread-safe.
Since
0.1.0

Definition at line 223 of file xml_decode.c.

References k_priv_xml_decimal_base, and RA8_INTERNAL.

Referenced by internal_entity().

◆ internal_entity()

ra8_err_t internal_entity ( const uint8_t * source,
size_t end,
size_t position,
uint32_t * out_cp,
size_t * out_used )
static

Decode one entity beginning at a bounded position.

Accepts five predefined or decimal/hex numeric references only.

Parameters
[in]sourceImmutable source bytes.
[in]endOne-past-last readable entity byte.
[in]positionOffset of the leading ampersand.
[out]out_cpDecoded XML character.
[out]out_usedEncoded bytes consumed.
Returns
Repository error code.
Return values
k_ra8_okEntity decoded.
k_ra8_err_validation_failedEntity or character was invalid.
Precondition
source spans at least end readable bytes.
Outputs are writable and non-overlapping with source.
Postcondition
Success sets both outputs and leaves source unchanged.
Failure leaves outputs unspecified.
Note
Named entity expansion beyond the five predefined names is unsupported.
Since
0.1.0

Definition at line 288 of file xml_decode.c.

References internal_digit(), internal_xml_char(), k_priv_xml_decimal_base, k_priv_xml_scalar_max, k_ra8_err_validation_failed, k_ra8_ok, priv_xml_bytes_equal(), RA8_INTERNAL, and strlen().

Referenced by internal_decode_one(), and internal_decoded_byte().

◆ internal_utf8()

size_t internal_utf8 ( uint32_t cp,
uint8_t out[4] )
static

Encode one valid Unicode scalar as UTF-8.

Writes the canonical one-to-four-byte representation.

Parameters
[in]cpValid Unicode scalar.
[out]outFour-byte destination.
Returns
Number of bytes written.
Return values
1ASCII scalar encoded.
2Two-byte scalar encoded.
3Three-byte scalar encoded.
4Four-byte scalar encoded.
Precondition
cp is a Unicode scalar accepted by internal_xml_char.
out spans four writable bytes.
Postcondition
Exactly the returned prefix is initialized.
No memory outside out is modified.
Note
Caller validates scalars before invoking this encoder.
Since
0.1.0

Definition at line 184 of file xml_decode.c.

References k_priv_utf8_continuation_tag, k_priv_utf8_four_lead_tag, k_priv_utf8_scalar_mask, k_priv_utf8_shift_second, k_priv_utf8_shift_third, k_priv_utf8_three_lead_tag, k_priv_utf8_three_scalar_min, k_priv_utf8_two_lead_tag, k_priv_xml_supplementary_min, and RA8_INTERNAL.

Referenced by internal_decode_one(), and internal_decoded_byte().

◆ internal_utf8_lead()

ra8_err_t internal_utf8_lead ( uint8_t lead,
uint32_t * out_cp,
size_t * out_used,
uint32_t * out_minimum )
static

Classify one UTF-8 lead byte into its scalar width and payload.

Distinguishes ASCII, 2/3/4-byte lead bytes, and rejects a bare continuation byte used as a lead.

Parameters
[in]leadOne candidate lead byte.
[out]out_cpPayload bits decoded so far (lead byte only).
[out]out_usedTotal encoded byte width (1..4).
[out]out_minimumMinimum scalar value the payload must reach.
Returns
Classification status.
Return values
k_ra8_okThe lead byte is a valid ASCII or multi-byte lead.
k_ra8_err_validation_failedThe byte is a bare continuation byte.
Precondition
None; lead is treated as untrusted input.
out_cp, out_used, and out_minimum are writable and do not alias one another.
Postcondition
On success out_used is in [1, 4] and out_cp holds the decoded lead-byte payload bits.
Failure writes none of the three outputs, so a caller that keeps scanning sees its own values rather than a partial classification.
Note
Thread-safe: pure function over its arguments.
Since
0.1.0

Definition at line 81 of file xml_decode.c.

References k_priv_utf8_continuation_tag, k_priv_utf8_four_lead_max, k_priv_utf8_four_lead_min, k_priv_utf8_four_payload_mask, k_priv_utf8_three_lead_max, k_priv_utf8_three_lead_min, k_priv_utf8_three_payload_mask, k_priv_utf8_three_scalar_min, k_priv_utf8_two_lead_max, k_priv_utf8_two_lead_min, k_priv_utf8_two_payload_mask, k_priv_xml_supplementary_min, k_ra8_err_validation_failed, and k_ra8_ok.

Referenced by internal_utf8_next().

◆ internal_utf8_next()

ra8_err_t internal_utf8_next ( const uint8_t * source,
size_t end,
size_t position,
uint32_t * out_cp,
size_t * out_used )
static

Decode one canonical UTF-8 scalar.

Enforces shortest form, valid continuation bytes, and XML characters.

Parameters
[in]sourceImmutable byte source.
[in]endOne-past-last readable byte.
[in]positionCandidate scalar start.
[out]out_cpDecoded scalar.
[out]out_usedConsumed byte count.
Returns
Repository error code.
Return values
k_ra8_okOne valid scalar decoded.
k_ra8_err_validation_failedEncoding or character was invalid.
Precondition
source spans at least end readable bytes.
Outputs are writable and do not overlap source.
Postcondition
Success sets both outputs without changing source.
Failure leaves output values unspecified.
Note
Allocation-free and thread-safe.
Since
0.1.0

Definition at line 127 of file xml_decode.c.

References internal_utf8_lead(), internal_xml_char(), k_priv_utf8_continuation_mask, k_priv_utf8_continuation_tag, k_priv_utf8_scalar_mask, k_ra8_err_validation_failed, k_ra8_ok, and RA8_INTERNAL.

Referenced by internal_decode_one(), and priv_xml_raw().

◆ internal_xml_char()

bool internal_xml_char ( uint32_t cp)
static

Test whether a scalar is an XML 1.0 character.

Rejects forbidden controls, surrogates, and out-of-range scalars.

Parameters
[in]cpUnicode scalar candidate.
Returns
True exactly for an XML 1.0 character.
Return values
truecp is permitted.
falsecp is forbidden.
Precondition
cp is represented without narrowing.
No normalization or character replacement is requested.
Postcondition
No memory is modified.
The result depends only on cp.
Note
Pure and thread-safe.
Since
0.1.0

Definition at line 50 of file xml_decode.c.

References k_priv_xml_bmp_first_max, k_priv_xml_bmp_second_max, k_priv_xml_bmp_second_min, k_priv_xml_carriage_return, k_priv_xml_line_feed, k_priv_xml_printable_min, k_priv_xml_scalar_max, k_priv_xml_supplementary_min, k_priv_xml_tab, and RA8_INTERNAL.

Referenced by internal_entity(), and internal_utf8_next().

◆ priv_xml_bytes_equal()

bool priv_xml_bytes_equal ( const uint8_t * source,
size_t offset,
const char * literal,
size_t length )

Compare bounded source bytes against a literal of known length.

Compare bounded source bytes with an ASCII character sequence.

Walks both operands one byte at a time so the comparison never hands an essentially-character operand to memcmp(), whose ordering is implementation-defined for plain char (MISRA-C:2012 Rules 21.14, 21.16). Only equality is ever asked of this function, so the loop is the whole contract.

Parameters
[in]sourceImmutable source bytes.
[in]offsetFirst source byte to compare.
[in]literalLiteral whose first length bytes are compared.
[in]lengthByte count to compare.
Returns
True exactly when the two byte runs are equal.
Return values
trueEvery compared byte matched.
falseAt least one byte differed.
Precondition
source spans at least offset + length readable bytes.
literal spans at least length readable bytes.
Postcondition
No memory is modified.
The result depends only on the arguments.
Note
Pure and thread-safe.
Since
0.1.0

Definition at line 260 of file xml_decode.c.

Referenced by internal_encoding(), internal_entity(), internal_external_id(), internal_keyword(), internal_pi(), internal_special(), internal_terminator(), priv_xml_doctype(), and xml_span_equal().

◆ priv_xml_raw()

ra8_err_t priv_xml_raw ( const uint8_t * source,
size_t start,
size_t end )

Validate canonical UTF-8 XML 1.0 characters over a byte range.

Rejects overlong encoding, invalid continuations, controls, and surrogates.

Parameters
[in]sourceImmutable XML source.
[in]startFirst byte to validate.
[in]endOne-past-last byte to validate.
Returns
Repository error code.
Return values
k_ra8_okEvery byte belongs to a permitted canonical scalar.
k_ra8_err_validation_failedEncoding or XML character was invalid.
Precondition
source spans at least end readable bytes.
start <= end describes a half-open range.
Postcondition
Source bytes remain unchanged.
Success validates the complete range, not a prefix.
Note
Allocation-free and thread-safe.
Since
0.1.0

Definition at line 610 of file xml_decode.c.

References internal_utf8_next(), and k_ra8_ok.

Referenced by internal_cdata(), internal_comment(), internal_literal(), and internal_pi().

◆ priv_xml_span_valid()

bool priv_xml_span_valid ( size_t source_len,
xml_span_t span )

Check that a source-relative span is in range.

Uses subtraction after checking the offset to avoid overflow.

Parameters
[in]source_lenExact source byte extent.
[in]spanCandidate source-relative span.
Returns
True only when the complete span lies in the extent.
Return values
trueOffset and length are bounded.
falseThe span is forged, stale, or out of range.
Precondition
source_len is the true readable extent.
span uses the same source-relative coordinate system.
Postcondition
No memory is modified.
The result is overflow-safe.
Note
Pure and thread-safe.
Since
0.1.0

Definition at line 161 of file xml_decode.c.

References xml_span_t::length, and xml_span_t::offset.

Referenced by xml_attr_next(), xml_decode(), xml_decode_prefix(), xml_decoded_size(), xml_span_equal(), and xml_span_local_equal().

◆ xml_decode()

ra8_err_t xml_decode ( const uint8_t * source,
size_t source_len,
xml_span_t span,
char * destination,
size_t capacity,
size_t * out_length )
nodiscard

Entity-decode a source span into a bounded NUL-terminated buffer.

Parameters
[in]sourceImmutable source containing span.
[in]source_lenExact readable extent of source.
[in]spanSource-relative encoded text span.
[out]destinationDecoded UTF-8 destination.
[in]capacityWritable destination capacity including the NUL.
[out]out_lengthDecoded bytes excluding the NUL.
Return values
k_ra8_okDecoded completely.
k_ra8_err_null_ptrA required pointer is NULL.
k_ra8_err_no_memDestination too small.
k_ra8_err_validation_failedspan, UTF-8, or an entity is invalid.
Precondition
source spans source_len readable bytes.
destination spans capacity writable bytes and does not overlap source.
Postcondition
On success destination is NUL-terminated and *out_length < capacity.
source is unchanged on every result.
Note
On failure destination may contain an unterminated prefix and out_length is unspecified; the operation is not output-atomic.
Thread-safe for distinct buffers.
Since
0.1.0

Definition at line 511 of file xml_decode.c.

References internal_decode(), k_ra8_err_null_ptr, k_ra8_err_validation_failed, and priv_xml_span_valid().

Referenced by internal_intern_span(), and priv_epub_xml_attr_contains().

◆ xml_decode_prefix()

ra8_err_t xml_decode_prefix ( const uint8_t * source,
size_t source_len,
xml_span_t span,
char * destination,
size_t capacity,
size_t * out_length )
nodiscard

Decode the longest complete prefix that fits the destination.

The prefix never splits an entity or UTF-8 sequence, and the entire encoded span is still validated after output clips.

Parameters
[in]sourceImmutable source containing span.
[in]source_lenExact readable extent of source.
[in]spanSource-relative encoded text span.
[out]destinationDecoded UTF-8 prefix destination.
[in]capacityWritable destination capacity including the NUL.
[out]out_lengthDecoded bytes excluding the NUL.
Return values
k_ra8_okComplete validation and maximal prefix decode succeeded.
k_ra8_err_null_ptrA required pointer is NULL.
k_ra8_err_no_memcapacity is zero.
k_ra8_err_validation_failedspan, UTF-8, or an entity is invalid.
Precondition
source spans source_len readable bytes.
destination spans capacity writable bytes and does not overlap source.
Postcondition
On success destination is NUL-terminated, *out_length < capacity, and no partial decoded codepoint/entity is present.
source is unchanged on every result.
Note
On validation failure destination may contain a prefix and out_length is unspecified; the operation is not output-atomic.
Thread-safe for distinct buffers.
Since
0.1.0

Definition at line 527 of file xml_decode.c.

References internal_decode(), k_ra8_err_null_ptr, k_ra8_err_validation_failed, and priv_xml_span_valid().

Referenced by priv_epub_xml_copy().

◆ xml_decoded_equal()

bool xml_decoded_equal ( const uint8_t * source,
size_t source_len,
xml_span_t left,
xml_span_t right )
nodiscard

Compare two entity-decoded spans from the same immutable source.

Parameters
[in]sourceImmutable source containing both spans.
[in]source_lenExact readable extent of source.
[in]leftFirst source-relative span.
[in]rightSecond source-relative span.
Returns
True only when both spans are valid and decode to identical UTF-8 bytes.
Return values
falsesource is NULL, a span/entity is invalid, or values differ.
Precondition
source spans source_len bytes when non-NULL.
Postcondition
No argument memory is modified.
Note
Pure, allocation-free, and thread-safe.
Since
0.1.0

Definition at line 584 of file xml_decode.c.

References internal_decoded_byte(), k_ra8_ok, xml_span_t::length, xml_span_t::offset, and xml_decoded_size().

Referenced by internal_manifest_lookup(), and internal_mark_metadata().

◆ xml_decoded_size()

ra8_err_t xml_decoded_size ( const uint8_t * source,
size_t source_len,
xml_span_t span,
size_t * out_length )
nodiscard

Measure the entity-decoded byte count of a bounded span.

Parameters
[in]sourceImmutable source containing span.
[in]source_lenExact readable extent of source.
[in]spanSource-relative encoded text span.
[out]out_lengthExact decoded UTF-8 byte count excluding any NUL.
Return values
k_ra8_okComplete span measured.
k_ra8_err_null_ptrsource or out_length is NULL.
k_ra8_err_validation_failedspan, UTF-8, or an entity is invalid.
Precondition
source spans source_len readable bytes.
Postcondition
On success out_length is exact; on failure it is unspecified.
source is unchanged.
Note
Pure, allocation-free, and thread-safe.
Since
0.1.0

Definition at line 544 of file xml_decode.c.

References internal_decode(), k_ra8_err_null_ptr, k_ra8_err_validation_failed, and priv_xml_span_valid().

Referenced by internal_attr_parse(), internal_intern_span(), internal_text(), internal_text(), and xml_decoded_equal().

◆ xml_span_equal()

bool xml_span_equal ( const uint8_t * source,
size_t source_len,
xml_span_t span,
const char * literal )
nodiscard

Compare a bounded span with an exact ASCII literal.

Parameters
[in]sourceImmutable source containing span.
[in]source_lenExact readable extent of source.
[in]spanCandidate source-relative byte span.
[in]literalNUL-terminated ASCII literal.
Returns
True only for equal byte length and contents.
Return values
falseA pointer is NULL, span is out of range, or bytes differ.
Precondition
source spans source_len bytes when non-NULL.
Postcondition
No argument memory is modified.
Note
Pure and thread-safe.
Since
0.1.0

Definition at line 555 of file xml_decode.c.

References xml_span_t::length, xml_span_t::offset, priv_xml_bytes_equal(), priv_xml_span_valid(), and strlen().

Referenced by internal_collect_spine(), internal_declaration_attr(), internal_font_type(), internal_opf_metadata_child(), internal_opf_shape(), internal_select_event(), priv_epub_xml_attr(), and xml_span_local_equal().

◆ xml_span_local_equal()

bool xml_span_local_equal ( const uint8_t * source,
size_t source_len,
xml_span_t span,
const char * literal )
nodiscard

Compare the namespace-local tail of a bounded span with an ASCII literal.

Parameters
[in]sourceImmutable source containing span.
[in]source_lenExact readable extent of source.
[in]spanCandidate QName span.
[in]literalNUL-terminated local-name literal.
Returns
True only when the bytes after the optional colon equal literal.
Return values
falseA pointer is NULL, span is out of range, or bytes differ.
Precondition
source spans source_len bytes when non-NULL.
Postcondition
No argument memory is modified.
Note
Pure and thread-safe.
Since
0.1.0

Definition at line 565 of file xml_decode.c.

References xml_span_t::length, xml_span_t::offset, priv_xml_span_valid(), and xml_span_equal().

Referenced by internal_ancestor_depth(), internal_collect_spine(), internal_manifest_lookup(), internal_mark_metadata(), internal_nav_event(), internal_nav_event_start(), internal_nav_has_list(), internal_ncx_event(), internal_opf_first_event(), internal_opf_metadata_child(), internal_opf_shape(), internal_select_nav(), internal_toc_capacity(), and priv_epub_xml_find().