|
Packit Service |
584ef9 |
/* fast-enough functions for uriencoding strings. */
|
|
Packit Service |
584ef9 |
void uriencode_init(void);
|
|
Packit Service |
584ef9 |
bool uriencode(const char *src, char *dst, const size_t srclen, const size_t dstlen);
|
|
Packit Service |
584ef9 |
|
|
Packit Service |
584ef9 |
/*
|
|
Packit Service |
584ef9 |
* Wrappers around strtoull/strtoll that are safer and easier to
|
|
Packit Service |
584ef9 |
* use. For tests and assumptions, see internal_tests.c.
|
|
Packit Service |
584ef9 |
*
|
|
Packit Service |
584ef9 |
* str a NULL-terminated base decimal 10 unsigned integer
|
|
Packit Service |
584ef9 |
* out out parameter, if conversion succeeded
|
|
Packit Service |
584ef9 |
*
|
|
Packit Service |
584ef9 |
* returns true if conversion succeeded.
|
|
Packit Service |
584ef9 |
*/
|
|
Packit Service |
584ef9 |
bool safe_strtoull(const char *str, uint64_t *out);
|
|
Packit Service |
584ef9 |
bool safe_strtoull_hex(const char *str, uint64_t *out);
|
|
Packit Service |
584ef9 |
bool safe_strtoll(const char *str, int64_t *out);
|
|
Packit Service |
584ef9 |
bool safe_strtoul(const char *str, uint32_t *out);
|
|
Packit Service |
584ef9 |
bool safe_strtol(const char *str, int32_t *out);
|
|
Packit Service |
584ef9 |
bool safe_strtod(const char *str, double *out);
|
|
Packit Service |
584ef9 |
bool safe_strcpy(char *dst, const char *src, const size_t dstmax);
|
|
Packit Service |
584ef9 |
bool safe_memcmp(const void *a, const void *b, size_t len);
|
|
Packit Service |
584ef9 |
|
|
Packit Service |
584ef9 |
#ifndef HAVE_HTONLL
|
|
Packit Service |
584ef9 |
extern uint64_t htonll(uint64_t);
|
|
Packit Service |
584ef9 |
extern uint64_t ntohll(uint64_t);
|
|
Packit Service |
584ef9 |
#endif
|
|
Packit Service |
584ef9 |
|
|
Packit Service |
584ef9 |
#ifdef __GCC
|
|
Packit Service |
584ef9 |
# define __gcc_attribute__ __attribute__
|
|
Packit Service |
584ef9 |
#else
|
|
Packit Service |
584ef9 |
# define __gcc_attribute__(x)
|
|
Packit Service |
584ef9 |
#endif
|
|
Packit Service |
584ef9 |
|
|
Packit Service |
584ef9 |
/**
|
|
Packit Service |
584ef9 |
* Vararg variant of perror that makes for more useful error messages
|
|
Packit Service |
584ef9 |
* when reporting with parameters.
|
|
Packit Service |
584ef9 |
*
|
|
Packit Service |
584ef9 |
* @param fmt a printf format
|
|
Packit Service |
584ef9 |
*/
|
|
Packit Service |
584ef9 |
void vperror(const char *fmt, ...)
|
|
Packit Service |
584ef9 |
__gcc_attribute__ ((format (printf, 1, 2)));
|