hex.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000-2005, 2007, 2008, 2013-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: hex.c,v 1.20 2008/09/25 04:02:39 tbox Exp $ */
/*! \file */
#include <config.h>
#include <ctype.h>
#define RETERR(x) do { \
isc_result_t _r = (x); \
if (_r != ISC_R_SUCCESS) \
return (_r); \
} while (0)
/*
*/
static isc_result_t
static isc_result_t
static const char hex[] = "0123456789ABCDEF";
{
char buf[3];
unsigned int loops = 0;
if (wordlength < 2)
wordlength = 2;
loops++;
{
loops = 0;
}
}
return (ISC_R_SUCCESS);
}
/*%
* State of a hex decoding process in progress.
*/
typedef struct {
int length; /*%< Desired length of binary data or -1 */
int digits; /*%< Number of buffered hex digits */
int val[2];
static inline void
{
}
static inline isc_result_t
const char *s;
return (ISC_R_BADHEX);
unsigned char num;
return (ISC_R_BADHEX);
else
}
}
return (ISC_R_SUCCESS);
}
static inline isc_result_t
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_BADHEX);
return (ISC_R_SUCCESS);
}
unsigned int i;
if (length > 0)
else
break;
}
return (ISC_R_SUCCESS);
}
for (;;) {
int c = *cstr++;
if (c == '\0')
break;
if (c == ' ' || c == '\t' || c == '\n' || c== '\r')
continue;
}
return (ISC_R_SUCCESS);
}
static isc_result_t
unsigned int l;
return (ISC_R_NOSPACE);
isc_buffer_add(target, l);
return (ISC_R_SUCCESS);
}
static isc_result_t
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
}