* at the end of the string.
* @param[in] alphabet to use for decoding.
* @return
- * - <= 0 on failure. The offset where the decoding error occurred as a negative integer.
+ * - < 0 on failure. The offset where the decoding error occurred as a negative integer.
* - Length of decoded data.
*/
-ssize_t fr_base16_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in,
- bool no_trailing, uint8_t const alphabet[static UINT8_MAX + 1])
+fr_slen_t fr_base16_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in,
+ bool no_trailing, uint8_t const alphabet[static UINT8_MAX + 1])
{
fr_sbuff_t our_in = FR_SBUFF(in);
fr_dbuff_t our_out = FR_DBUFF(out);
if (!a || !b) {
if (a && !b && no_trailing) {
if (err) *err = FR_SBUFF_PARSE_ERROR_TRAILING;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
break;
}
* at the end of the string.
* @param[in] alphabet to use for decoding.
* @return
- * - <= 0 on failure. The offset where the decoding error occurred as a negative integer.
+ * - < 0 on failure. The offset where the decoding error occurred as a negative integer.
* - Length of decoded data.
*/
-ssize_t fr_base32_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in,
- bool expect_padding, bool no_trailing, uint8_t const alphabet[static UINT8_MAX])
+fr_slen_t fr_base32_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in,
+ bool expect_padding, bool no_trailing, uint8_t const alphabet[static UINT8_MAX])
{
fr_sbuff_t our_in = FR_SBUFF(in);
fr_dbuff_t our_out = FR_DBUFF(out);
if (err) *err = FR_SBUFF_PARSE_ERROR_OUT_OF_SPACE;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
fr_sbuff_advance(&our_in, 8);
bad_format:
if (err) *err = FR_SBUFF_PARSE_ERROR_FORMAT;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
if (expect_padding) {
if (err) *err = FR_SBUFF_PARSE_ERROR_TRAILING;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
if (err) *err = FR_SBUFF_PARSE_OK;
* at the end of the string.
* @param[in] alphabet to use for decoding.
* @return
- * - <= 0 on failure. The offset where the decoding error occurred as a negative integer.
+ * - < 0 on failure. The offset where the decoding error occurred as a negative integer.
* - Length of decoded data.
*/
-ssize_t fr_base64_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in,
- bool expect_padding, bool no_trailing, uint8_t const alphabet[static UINT8_MAX])
+fr_slen_t fr_base64_decode_nstd(fr_sbuff_parse_error_t *err, fr_dbuff_t *out, fr_sbuff_t *in,
+ bool expect_padding, bool no_trailing, uint8_t const alphabet[static UINT8_MAX])
{
fr_sbuff_t our_in = FR_SBUFF(in);
fr_dbuff_t our_out = FR_DBUFF(out);
if (err) *err = FR_SBUFF_PARSE_ERROR_OUT_OF_SPACE;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
fr_sbuff_advance(&our_in, 4);
bad_format:
if (err) *err = FR_SBUFF_PARSE_ERROR_FORMAT;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
if (expect_padding) {
if (err) *err = FR_SBUFF_PARSE_ERROR_TRAILING;
- return -fr_sbuff_used(&our_in);
+ return fr_sbuff_error(&our_in);
}
fr_sbuff_set(in, &our_in);
((size_t)(fr_sbuff_start(_sbuff_or_marker) > fr_sbuff_current(_sbuff_or_marker) ? \
0 : (fr_sbuff_current(_sbuff_or_marker) - fr_sbuff_start(_sbuff_or_marker))))
-
/** Sets an error marker in the parent
*
* If an error already exists at this level it will be used instead of the provided error.