isc_token_t token;
bool eol;
- REQUIRE(length >= -2);
+ REQUIRE(length >= isc_one_or_more);
base64_decode_init(&ctx, length, target);
isc_lex_ungettoken(lexer, &token);
}
RETERR(base64_decode_finish(&ctx));
- if (length == -2 && before == after) {
+ if (length == isc_one_or_more && before == after) {
return ISC_R_UNEXPECTEDEND;
}
return ISC_R_SUCCESS;
isc_base64_decodestring(const char *cstr, isc_buffer_t *target) {
base64_decode_ctx_t ctx;
- base64_decode_init(&ctx, -1, target);
+ base64_decode_init(&ctx, isc_zero_or_more, target);
for (;;) {
int c = *cstr++;
if (c == '\0') {
isc_token_t token;
bool eol;
- REQUIRE(length >= -2);
+ REQUIRE(length >= isc_one_or_more);
isc_hex_decodeinit(&ctx, length, target);
isc_lex_ungettoken(lexer, &token);
}
RETERR(isc_hex_decodefinish(&ctx));
- if (length == -2 && before == after) {
+ if (length == isc_one_or_more && before == after) {
return ISC_R_UNEXPECTEDEND;
}
return ISC_R_SUCCESS;
isc_hex_decodestring(const char *cstr, isc_buffer_t *target) {
isc_hex_decodectx_t ctx;
- isc_hex_decodeinit(&ctx, -1, target);
+ isc_hex_decodeinit(&ctx, isc_zero_or_more, target);
for (;;) {
int c = *cstr++;
if (c == '\0') {
* `target`. If 'length' is non-negative, it is the expected number of
* encoded octets to convert.
*
- * If 'length' is -1 then 0 or more encoded octets are expected.
- * If 'length' is -2 then 1 or more encoded octets are expected.
+ * If 'length' is isc_zero_or_more then 0 or more encoded octets are
+ * expected.
+ *
+ * If 'length' is isc_one_or_more then 1 or more encoded octets are
+ * expected.
*
* Returns:
*\li #ISC_R_BADBASE64 -- invalid base64 encoding.
* `target`. If 'length' is non-negative, it is the expected number of
* encoded octets to convert.
*
- * If 'length' is -1 then 0 or more encoded octets are expected.
- * If 'length' is -2 then 1 or more encoded octets are expected.
+ * If 'length' is isc_zero_or_more then 0 or more encoded octets are
+ * expected.
+ *
+ * If 'length' is isc_one_or_more then 1 or more encoded octets are
+ * expected.
*
* Returns:
*\li #ISC_R_BADHEX -- invalid hex encoding
/*%< HTTP endpoints set */
#endif /* HAVE_LIBNGHTTP2 */
+/*% Used by isc_base64 and isc_hex for expected lower bound */
+enum {
+ isc_zero_or_more = -1,
+ isc_one_or_more = -2,
+};
+
/*% Statistics formats (text file or XML) */
typedef enum {
isc_statsformat_file,