diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2004-04-07 07:30:40 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2004-04-07 07:30:40 +0000 | 
| commit | cf1f46e1ca001dcab81e9116712c3eefefc03fd7 (patch) | |
| tree | 1e80b81b7bf5203a2a7ca818e3d17fcb93bca50c | |
| parent | f052cbee1999a9dce6954efd466fd16c223c16a7 (diff) | |
renamed the strtoofft() macro to curlx_strtoofft() to adjust to the curlx_*
concept, and added lib/README.curlx to explain details about it
| -rw-r--r-- | lib/Makefile.am | 14 | ||||
| -rw-r--r-- | lib/README.curlx | 43 | ||||
| -rw-r--r-- | lib/ftp.c | 8 | ||||
| -rw-r--r-- | lib/strtoofft.h | 8 | ||||
| -rw-r--r-- | lib/transfer.c | 4 | ||||
| -rw-r--r-- | src/main.c | 4 | 
6 files changed, 62 insertions, 19 deletions
| diff --git a/lib/Makefile.am b/lib/Makefile.am index 6153cf870..e50cd6b7b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -22,13 +22,13 @@  ###########################################################################  AUTOMAKE_OPTIONS = foreign nostdinc -EXTRA_DIST = getdate.y Makefile.b32 Makefile.b32.resp Makefile.m32	\ -  Makefile.vc6 Makefile.riscos libcurl.def curllib.dsp curllib.dsw	\ -  config-vms.h config-win32.h config-riscos.h config-mac.h config.h.in	\ -  ca-bundle.crt README.encoding README.memoryleak README.ares		\ -  makefile.dj config.dj libcurl.framework.make libcurl.plist		\ -  libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga	\ -  config-netware.h Makefile.netware nwlib.c libcurl.imp +EXTRA_DIST = getdate.y Makefile.b32 Makefile.b32.resp Makefile.m32	   \ +  Makefile.vc6 Makefile.riscos libcurl.def curllib.dsp curllib.dsw	   \ +  config-vms.h config-win32.h config-riscos.h config-mac.h config.h.in	   \ +  ca-bundle.crt README.encoding README.memoryleak README.ares README.curlx \ +  makefile.dj config.dj libcurl.framework.make libcurl.plist libcurl.rc	   \ +  config-amigaos.h amigaos.c amigaos.h makefile.amiga config-netware.h	   \ +  Makefile.netware nwlib.c libcurl.imp  lib_LTLIBRARIES = libcurl.la diff --git a/lib/README.curlx b/lib/README.curlx new file mode 100644 index 000000000..663aea375 --- /dev/null +++ b/lib/README.curlx @@ -0,0 +1,43 @@ +$Id$ +                                  _   _ ____  _      +                              ___| | | |  _ \| |     +                             / __| | | | |_) | |     +                            | (__| |_| |  _ <| |___  +                             \___|\___/|_| \_\_____| + +                     Source Code Functions Apps Might Use +                     ==================================== + +The libcurl source code offers a few functions by source only. They are not +part of the official libcurl API, but the source files might be useful for +others so apps can optionally compile/build with these sources to gain +additional functions. + + +strtoofft.[ch] +============== + + curlx_strtoofft() + +   A macro that converts a string containing a number to a curl_off_t number. +   This might use the curlx_strtoll() function which is provided as source +   code in strtoofft.c. Note that the function is only provided if no +   strtoll() (or equivalent) function exist on your platform. If curl_off_t +   is only a 32 bit number on your platform, this macro uses strtol(). + +timeval.[ch] +============ + + Provides a 'struct timeval' for platforms that don't have one already, and + includes the proper include files for those that have one. Using this will + make the output require the 'winmm' lib on Windows (unless WITHOUT_MM_LIB + is defined at compile-time). + + curlx_tvnow() + +   returns a struct timeval for the current time. + + curlx_tvdiff() + +   returns the difference between two timeval structs, in number of +   milliseconds. @@ -961,7 +961,7 @@ CURLcode ftp_getsize(struct connectdata *conn, char *file,    if(ftpcode == 213) {      /* get the size from the ascii string: */ -    *size = strtoofft(buf+4, NULL, 0); +    *size = curlx_strtoofft(buf+4, NULL, 0);    }    else      return CURLE_FTP_COULDNT_GET_SIZE; @@ -1849,10 +1849,10 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)        char *ptr;        char *ptr2; -      from=strtoofft(conn->range, &ptr, 0); +      from=curlx_strtoofft(conn->range, &ptr, 0);        while(ptr && *ptr && (isspace((int)*ptr) || (*ptr=='-')))          ptr++; -      to=strtoofft(ptr, &ptr2, 0); +      to=curlx_strtoofft(ptr, &ptr2, 0);        if(ptr == ptr2) {          /* we didn't get any digit */          to=-1; @@ -2071,7 +2071,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)            /* only if we have nothing but digits: */            if(bytes++) {              /* get the number! */ -            size = strtoofft(bytes, NULL, 0); +            size = curlx_strtoofft(bytes, NULL, 0);            }          } diff --git a/lib/strtoofft.h b/lib/strtoofft.h index 27c3668e3..4c5d2652b 100644 --- a/lib/strtoofft.h +++ b/lib/strtoofft.h @@ -40,22 +40,22 @@   */  #if SIZEOF_CURL_OFF_T > 4  #if HAVE_STRTOLL -#define strtoofft strtoll +#define curlx_strtoofft strtoll  #else /* HAVE_STRTOLL */  /* For MSVC7 we can use _strtoi64() which seems to be a strtoll() clone */  #if defined(_MSC_VER) && (_MSC_VER >= 1300) -#define strtoofft _strtoi64 +#define curlx_strtoofft _strtoi64  #else /* MSVC7 or later */  curl_off_t curlx_strtoll(const char *nptr, char **endptr, int base); -#define strtoofft curlx_strtoll +#define curlx_strtoofft curlx_strtoll  #define NEED_CURL_STRTOLL  #endif /* MSVC7 or later */  #endif /* HAVE_STRTOLL */  #else /* SIZEOF_CURL_OFF_T > 4 */  /* simply use strtol() to get 32bit numbers */ -#define strtoofft strtol +#define curlx_strtoofft strtol  #endif  #endif diff --git a/lib/transfer.c b/lib/transfer.c index 82c367978..4d5577a05 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -651,7 +651,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,                 info about the true size of the document we didn't get now. */              if ((k->httpcode != 416) &&                  checkprefix("Content-Length:", k->p)) { -              contentlength = strtoofft(k->p+15, NULL, 10); +              contentlength = curlx_strtoofft(k->p+15, NULL, 10);                if (data->set.max_filesize && contentlength >                     data->set.max_filesize) {                  failf(data, "Maximum file size exceeded"); @@ -784,7 +784,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,                  /* stupid colon skip */                  ptr++; -              k->offset = strtoofft(ptr, NULL, 10); +              k->offset = curlx_strtoofft(ptr, NULL, 10);                if (conn->resume_from == k->offset)                  /* we asked for a resume and we got it */ diff --git a/src/main.c b/src/main.c index aaf519ead..36fc298d7 100644 --- a/src/main.c +++ b/src/main.c @@ -1035,7 +1035,7 @@ static int str2offset(curl_off_t *val, char *str)  #endif    /* this is a duplicate of the function that is also used in libcurl */ -  *val = strtoofft(str, NULL, 0); +  *val = curlx_strtoofft(str, NULL, 0);    if ((*val == LLONG_MAX || *val == LLONG_MIN) && errno == ERANGE)      return 1; @@ -1319,7 +1319,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */          {            /* We support G, M, K too */            char *unit; -          curl_off_t value = strtoofft(nextarg, &unit, 0); +          curl_off_t value = curlx_strtoofft(nextarg, &unit, 0);            switch(nextarg[strlen(nextarg)-1]) {            case 'G':            case 'g': | 
