Use references for output variables
While I grew to dislike references for this case, there are other functions in the source that use references so switch to that for consistency.
This commit is contained in:
parent
5b102d108d
commit
666a01d335
@ -1895,7 +1895,7 @@ PUGI__NS_BEGIN
|
|||||||
return is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
|
return is_little_endian() ? encoding_utf32_le : encoding_utf32_be;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN bool parse_declaration_encoding(const uint8_t* data, size_t size, const uint8_t** out_encoding, size_t* out_length)
|
PUGI__FN bool parse_declaration_encoding(const uint8_t* data, size_t size, const uint8_t*& out_encoding, size_t& out_length)
|
||||||
{
|
{
|
||||||
#define PUGI__SCANCHAR(ch) { if (offset >= size || data[offset] != ch) return false; offset++; }
|
#define PUGI__SCANCHAR(ch) { if (offset >= size || data[offset] != ch) return false; offset++; }
|
||||||
#define PUGI__SCANCHARTYPE(ct) { while (offset < size && PUGI__IS_CHARTYPE(data[offset], ct)) offset++; }
|
#define PUGI__SCANCHARTYPE(ct) { while (offset < size && PUGI__IS_CHARTYPE(data[offset], ct)) offset++; }
|
||||||
@ -1931,11 +1931,11 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
size_t start = offset;
|
size_t start = offset;
|
||||||
|
|
||||||
*out_encoding = data + offset;
|
out_encoding = data + offset;
|
||||||
|
|
||||||
PUGI__SCANCHARTYPE(ct_symbol);
|
PUGI__SCANCHARTYPE(ct_symbol);
|
||||||
|
|
||||||
*out_length = offset - start;
|
out_length = offset - start;
|
||||||
|
|
||||||
PUGI__SCANCHAR(delimiter);
|
PUGI__SCANCHAR(delimiter);
|
||||||
|
|
||||||
@ -1977,7 +1977,7 @@ PUGI__NS_BEGIN
|
|||||||
const uint8_t* enc = 0;
|
const uint8_t* enc = 0;
|
||||||
size_t enc_length = 0;
|
size_t enc_length = 0;
|
||||||
|
|
||||||
if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d && parse_declaration_encoding(data, size, &enc, &enc_length))
|
if (d0 == 0x3c && d1 == 0x3f && d2 == 0x78 && d3 == 0x6d && parse_declaration_encoding(data, size, enc, enc_length))
|
||||||
{
|
{
|
||||||
// iso-8859-1 (case-insensitive)
|
// iso-8859-1 (case-insensitive)
|
||||||
if (enc_length == 10
|
if (enc_length == 10
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user