apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr-util/test testdate.c
Date Tue, 05 Jun 2001 23:38:21 GMT
jerenkrantz    01/06/05 16:38:20

  Modified:    include  apr_date.h apu_compat.h
               misc     apr_date.c
               test     testdate.c
  Log:
  Per Dean Gaudet's suggestion:
  apr_parseHTTPdate -> apr_date_parse_http
  
  This makes the date functions fall in line with other APR functions which
  is a good thing.
  
  Revision  Changes    Path
  1.3       +6 -6      apr-util/include/apr_date.h
  
  Index: apr_date.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apr_date.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_date.h	2001/05/31 04:54:00	1.2
  +++ apr_date.h	2001/06/05 23:38:16	1.3
  @@ -92,7 +92,7 @@
    * @return 1 if the string matches, 0 otherwise
    * @deffunc int apr_checkmask(const char *data, const char *mask)
    */
  -APU_DECLARE(int) apr_checkmask(const char *data, const char *mask);
  +APU_DECLARE(int) apr_date_checkmask(const char *data, const char *mask);
   
   /**
    * Parses an HTTP date in one of three standard forms:
  @@ -104,14 +104,14 @@
    * @param date The date in one of the three formats above
    * @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or
    *         0 if this would be out of range or if the date is invalid.
  - * @deffunc apr_time_t apr_parseHTTPdate(const char *date)
  + * @deffunc apr_time_t apr_date_parse_http(const char *date)
    */
  -APU_DECLARE(apr_time_t) apr_parseHTTPdate(const char *date);
  +APU_DECLARE(apr_time_t) apr_date_parse_http(const char *date);
   
   /**
    * Parses a string resembling an RFC 822 date.  This is meant to be
    * leinent in its parsing of dates.  Hence, this will parse a wider 
  - * range of dates than apr_parseHTTPdate.
  + * range of dates than apr_date_parse_http.
    *
    * The prominent mailer (or poster, if mailer is unknown) that has
    * been seen in the wild is included for the unknown formats.
  @@ -131,9 +131,9 @@
    * @param date The date in one of the formats above
    * @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or
    *         0 if this would be out of range or if the date is invalid.
  - * @deffunc apr_time_t apr_parseRFCdate(char *date)
  + * @deffunc apr_time_t apr_date_parse_rfc(char *date)
    */
  -APU_DECLARE(apr_time_t) apr_parseRFCdate(char *date);
  +APU_DECLARE(apr_time_t) apr_date_parse_rfc(char *date);
   
   #ifdef __cplusplus
   }
  
  
  
  1.6       +6 -0      apr-util/include/apu_compat.h
  
  Index: apu_compat.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apu_compat.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apu_compat.h	2001/02/24 14:17:25	1.5
  +++ apu_compat.h	2001/06/05 23:38:17	1.6
  @@ -74,6 +74,12 @@
   #define ap_show_hook apr_show_hook
   
   /* --------------------------------------------------------------------
  + * the following symbols were moved from httpd-2.0/.../util_date.[ch]
  + */
  +#define ap_parseHTTPdate apr_date_parse_http
  +#define ap_checkmask apr_date_checkmask
  +
  +/* --------------------------------------------------------------------
    * the following symbols were moved from httpd-2.0/.../util_xml.[ch]
    */
   #define ap_text apr_text
  
  
  
  1.3       +28 -24    apr-util/misc/apr_date.c
  
  Index: apr_date.c
  ===================================================================
  RCS file: /home/cvs/apr-util/misc/apr_date.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_date.c	2001/05/31 04:54:06	1.2
  +++ apr_date.c	2001/06/05 23:38:18	1.3
  @@ -90,7 +90,7 @@
    *   * - swallow remaining characters 
    *  <x> - exact match for any other character
    */
  -APU_DECLARE(int) apr_checkmask(const char *data, const char *mask)
  +APU_DECLARE(int) apr_date_checkmask(const char *data, const char *mask)
   {
       int i;
       char d;
  @@ -180,7 +180,7 @@
    * but many changes since then.
    *
    */
  -APU_DECLARE(apr_time_t) apr_parseHTTPdate(const char *date)
  +APU_DECLARE(apr_time_t) apr_date_parse_http(const char *date)
   {
       apr_exploded_time_t ds;
       apr_time_t result;
  @@ -211,7 +211,7 @@
   
       /* start of the actual date information for all 4 formats. */
   
  -    if (apr_checkmask(date, "## @$$ #### ##:##:## *")) {
  +    if (apr_date_checkmask(date, "## @$$ #### ##:##:## *")) {
           /* RFC 1123 format with two days */
           ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
           if (ds.tm_year < 0)
  @@ -224,7 +224,8 @@
           monstr = date + 3;
           timstr = date + 12;
       }
  -    else if (apr_checkmask(date, "##-@$$-## ##:##:## *")) { /* RFC 850 format */
  +    else if (apr_date_checkmask(date, "##-@$$-## ##:##:## *")) { 
  +        /* RFC 850 format */
           ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
           if (ds.tm_year < 70)
               ds.tm_year += 100;
  @@ -234,7 +235,8 @@
           monstr = date + 3;
           timstr = date + 10;
       }
  -    else if (apr_checkmask(date, "@$$ ~# ##:##:## ####*")) {/* asctime format */
  +    else if (apr_date_checkmask(date, "@$$ ~# ##:##:## ####*")) {
  +        /* asctime format */
           ds.tm_year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100;
           if (ds.tm_year < 0) 
               return APR_DATE_BAD;
  @@ -251,7 +253,7 @@
           monstr = date;
           timstr = date + 7;
       }
  -    else if (apr_checkmask(date, "# @$$ #### ##:##:## *")) {
  +    else if (apr_date_checkmask(date, "# @$$ #### ##:##:## *")) {
           /* RFC 1123 format with one day */
           ds.tm_year = ((date[6] - '0') * 10 + (date[7] - '0') - 19) * 100;
           if (ds.tm_year < 0)
  @@ -319,7 +321,7 @@
   /*
    * Parses a string resembling an RFC 822 date.  This is meant to be
    * leinent in its parsing of dates.  Hence, this will parse a wider 
  - * range of dates than apr_parseHTTPdate.
  + * range of dates than apr_date_parse_http.
    *
    * The prominent mailer (or poster, if mailer is unknown) that has
    * been seen in the wild is included for the unknown formats.
  @@ -336,7 +338,7 @@
    *     Sun, 6 Nov 94 8:49:37 GMT      ; Unknown [Elm 70.85] 
    *
    */
  -APU_DECLARE(apr_time_t) apr_parseRFCdate(char *date)
  +APU_DECLARE(apr_time_t) apr_date_parse_rfc(char *date)
   {
       apr_exploded_time_t ds;
       apr_time_t result;
  @@ -369,7 +371,7 @@
           ++date;    /* Now pointing to first char after space, which should be */    }
   
       /* start of the actual date information for all 11 formats. */
  -    if (apr_checkmask(date, "## @$$ #### ##:##:## *")) {   /* RFC 1123 format */
  +    if (apr_date_checkmask(date, "## @$$ #### ##:##:## *")) {   /* RFC 1123 format */
           ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
   
           if (ds.tm_year < 0)
  @@ -382,7 +384,7 @@
           monstr = date + 3;
           timstr = date + 12;
       }
  -    else if (apr_checkmask(date, "##-@$$-## ##:##:## *")) {/* RFC 850 format  */
  +    else if (apr_date_checkmask(date, "##-@$$-## ##:##:## *")) {/* RFC 850 format  */
           ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
   
           if (ds.tm_year < 70)
  @@ -393,7 +395,8 @@
           monstr = date + 3;
           timstr = date + 10;
       }
  -    else if (apr_checkmask(date, "@$$ ~# ##:##:## ####*")) {/* asctime format */
  +    else if (apr_date_checkmask(date, "@$$ ~# ##:##:## ####*")) {
  +        /* asctime format */
           ds.tm_year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100;
           if (ds.tm_year < 0) 
               return APR_DATE_BAD;
  @@ -410,7 +413,8 @@
           monstr = date;
           timstr = date + 7;
       }
  -    else if (apr_checkmask(date, "# @$$ #### ##:##:## *")) {/* RFC 1123 format*/
  +    else if (apr_date_checkmask(date, "# @$$ #### ##:##:## *")) {
  +        /* RFC 1123 format*/
           ds.tm_year = ((date[6] - '0') * 10 + (date[7] - '0') - 19) * 100;
   
           if (ds.tm_year < 0)
  @@ -422,8 +426,8 @@
           monstr = date + 2;
           timstr = date + 11;
       }
  -    else if (apr_checkmask(date, "## @$$ ## ##:##:## *")) {/* RFC 1123 format */
  -        /* This is the old RFC date format - many many years ago, people
  +    else if (apr_date_checkmask(date, "## @$$ ## ##:##:## *")) {
  +        /* This is the old RFC 1123 date format - many many years ago, people
            * used two-digit years.  Oh, how foolish.  */
           ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
   
  @@ -436,8 +440,8 @@
           timstr = date + 10;
   
       } 
  -    else if (apr_checkmask(date, "# @$$ ## ##:##:## *")) {/* RFC 1123 format */
  -        /* This is the old RFC date format - many many years ago, people
  +    else if (apr_date_checkmask(date, "# @$$ ## ##:##:## *")) {
  +        /* This is the old RFC 1123 date format - many many years ago, people
            * used two-digit years.  Oh, how foolish.  */
           ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0');
   
  @@ -450,8 +454,8 @@
           timstr = date + 9;
   
       } 
  -    else if (apr_checkmask(date, "## @$$ ## ##:## *")) {      /* Loser format */
  -        /* This is quite bogus.  */
  +    else if (apr_date_checkmask(date, "## @$$ ## ##:## *")) {
  +        /* Loser format.  This is quite bogus.  */
           ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
   
           if (ds.tm_year < 70)
  @@ -464,8 +468,8 @@
           timstr[6] = '0';
           timstr[7] = '0';
       } 
  -    else if (apr_checkmask(date, "# @$$ ## ##:## *")) {       /* Loser format */
  -        /* This is quite bogus.  */
  +    else if (apr_date_checkmask(date, "# @$$ ## ##:## *")) {
  +        /* Loser format.  This is quite bogus.  */
           ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0');
   
           if (ds.tm_year < 70)
  @@ -479,8 +483,8 @@
           timstr[6] = '0';
           timstr[7] = '0';
       }
  -    else if (apr_checkmask(date, "## @$$ ## #:##:## *")) {    /* Loser format */
  -        /* This is quite bogus.  */
  +    else if (apr_date_checkmask(date, "## @$$ ## #:##:## *")) {
  +        /* Loser format.  This is quite bogus.  */
           ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
   
           if (ds.tm_year < 70)
  @@ -493,8 +497,8 @@
   
           timstr[0] = '0';
       }
  -    else if (apr_checkmask(date, "# @$$ ## #:##:## *")) {     /* Loser format */
  -        /* This is quite bogus.  */
  +    else if (apr_date_checkmask(date, "# @$$ ## #:##:## *")) {
  +         /* Loser format.  This is quite bogus.  */
           ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0');
   
           if (ds.tm_year < 70)
  
  
  
  1.3       +3 -3      apr-util/test/testdate.c
  
  Index: testdate.c
  ===================================================================
  RCS file: /home/cvs/apr-util/test/testdate.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testdate.c	2001/05/31 05:14:39	1.2
  +++ testdate.c	2001/06/05 23:38:19	1.3
  @@ -1,4 +1,4 @@
  -/* This program tests the parseHTTPdate routine in ../main/util_date.c.
  +/* This program tests the date_parse_http routine in ../main/util_date.c.
    *
    * It is only semiautomated in that I would run it, modify the code to
    * use a different algorithm or seed, recompile and run again, etc.
  @@ -153,7 +153,7 @@
           secstodate = year2secs[year - 1970] + offset;
           gm_timestr_822(datestr, secstodate);
           secstodate *= APR_USEC_PER_SEC;
  -        newsecs = apr_parseHTTPdate(datestr);
  +        newsecs = apr_date_parse_http(datestr);
           if (secstodate == newsecs)
               printf("Yes %4d %19lld %s\n", year, secstodate, datestr);
           else if (newsecs == APR_DATE_BAD)
  @@ -172,7 +172,7 @@
           secstodate = guess + offset;
           gm_timestr_822(datestr, secstodate);
           secstodate *= APR_USEC_PER_SEC;
  -        newsecs = apr_parseHTTPdate(datestr);
  +        newsecs = apr_date_parse_http(datestr);
           if (secstodate == newsecs)
               printf("Yes %" APR_TIME_T_FMT " %s\n", secstodate, datestr);
           else if (newsecs == APR_DATE_BAD)
  
  
  

Mime
View raw message