diff options
author | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2004-05-24 09:33:27 +0000 |
---|---|---|
committer | jorton <jorton@13f79535-47bb-0310-9956-ffa450edef68> | 2004-05-24 09:33:27 +0000 |
commit | 0a41ca019f61aacc582b4efb343047610daa80e7 (patch) | |
tree | 3fb1cc72bb6ee54bba3d7600e3f7251593e72134 /include | |
parent | 7dc88b80753ff6bd5a8c44c317c8a0f6861abf69 (diff) | |
download | libapr-0a41ca019f61aacc582b4efb343047610daa80e7.tar.gz |
* configure.in, include/arch/win32/apr_private.h,
include/arch/netware/apr_private.h: Define APR_OFF_T_STRFN.
* include/apr_strings.h, strings/apr_strings.c: Add apr_strtoff()
function.
* test/teststr.c (string_strtoff): Add test.
Submitted by: Andr�� Malo, Joe Orton
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@65120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/apr_strings.h | 17 | ||||
-rw-r--r-- | include/arch/netware/apr_private.h | 6 | ||||
-rw-r--r-- | include/arch/win32/apr_private.h | 10 |
3 files changed, 33 insertions, 0 deletions
diff --git a/include/apr_strings.h b/include/apr_strings.h index 7934ff6cd..c189cb6a4 100644 --- a/include/apr_strings.h +++ b/include/apr_strings.h @@ -296,6 +296,23 @@ APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n); APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n); /** + * Convert a numeric string into an apr_off_t numeric value. + * @param offset The value of the parsed string. + * @param buf The string to parse. It may contain optional whitespace, + * followed by an optional '+' (positive, default) or '-' (negative) + * character, followed by an optional '0x' prefix if base is 0 or 16, + * followed by numeric digits appropriate for base. + * @param end A pointer to the end of the valid character in buf. If + * not NULL, it is set to the first invalid character in buf. + * @param base A numeric base in the range between 2 and 36 inclusive, + * or 0. If base is zero, buf will be treated as base ten unless its + * digits are prefixed with '0x', in which case it will be treated as + * base 16. + */ +APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf, + char **end, int base); + +/** * parse a numeric string into a 64-bit numeric value * @param buf The string to parse. It may contain optional whitespace, * followed by an optional '+' (positive, default) or '-' (negative) diff --git a/include/arch/netware/apr_private.h b/include/arch/netware/apr_private.h index b24758b03..c334509ae 100644 --- a/include/arch/netware/apr_private.h +++ b/include/arch/netware/apr_private.h @@ -156,6 +156,12 @@ void* getStatCache(); #undef malloc #define malloc(x) library_malloc(gLibHandle,x) +#if APR_HAS_LARGE_FILES +#define APR_OFF_T_STRFN strtoll +#else +#define APR_OFF_T_STRFN strtol +#endif + /* * Include common private declarations. */ diff --git a/include/arch/win32/apr_private.h b/include/arch/win32/apr_private.h index 700d853ce..98d88b99c 100644 --- a/include/arch/win32/apr_private.h +++ b/include/arch/win32/apr_private.h @@ -143,6 +143,16 @@ APR_DECLARE_DATA int errno; #define HAVE_GETNAMEINFO 1 #endif +#if APR_HAS_LARGE_FILES +#if APR_HAVE_INT64_STRFN +#define APR_OFF_T_STRFN APR_INT64_STRFN +#else +#define APR_OFF_T_STRFN apr_strtoi64 +#endif +#else +#define APR_OFF_T_STRFN strtoi +#endif + /* * Include common private declarations. */ |