dgaudet     98/05/06 12:47:09

  Modified:    src/main util.c
  Log:
  fix a -Wshadow warning
  fix an off-by-1 error
  and fix the indentation
  
  Revision  Changes    Path
  1.114     +27 -27    apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- util.c    1998/05/06 02:29:59     1.113
  +++ util.c    1998/05/06 19:47:08     1.114
  @@ -127,37 +127,37 @@
   
       tms = (gmt ? gmtime(&t) : localtime(&t));
       if(gmt) {
  -      /* Convert %Z to "GMT" and %z to "+0000";
  -       * on hosts that do not have a time zone string in struct tm,
  -       * strftime must assume its argument is local time.
  -       */
  -      const char *f;
  -      char *p;
  -      for(p = tf, f = fmt; p < tf + sizeof tf - 5 && (*p = *f); f++, p++) {
  -     if(*f == '%')
  -       switch(f[1])
  -         {
  +     /* Convert %Z to "GMT" and %z to "+0000";
  +      * on hosts that do not have a time zone string in struct tm,
  +      * strftime must assume its argument is local time.
  +      */
  +     const char *f;
  +     char *strp;
  +     for(strp = tf, f = fmt; strp < tf + sizeof(tf) - 6 && (*strp = *f)
  +         ; f++, strp++) {
  +         if (*f != '%') continue;
  +         switch (f[1]) {
            case '%':
  -           *++p = *++f;
  -           break;
  +             *++strp = *++f;
  +             break;
            case 'Z':
  -           *p++ = 'G';
  -           *p++ = 'M';
  -           *p = 'T';
  -           f++;
  -           break;
  +             *strp++ = 'G';
  +             *strp++ = 'M';
  +             *strp = 'T';
  +             f++;
  +             break;
            case 'z': /* common extension */
  -           *p++ = '+';
  -           *p++ = '0';
  -           *p++ = '0';
  -           *p++ = '0';
  -           *p = '0';
  -           f++;
  -           break;
  +             *strp++ = '+';
  +             *strp++ = '0';
  +             *strp++ = '0';
  +             *strp++ = '0';
  +             *strp = '0';
  +             f++;
  +             break;
            }
  -      }
  -      *p = '\0';
  -      fmt = tf;
  +     }
  +     *strp = '\0';
  +     fmt = tf;
       }
   
       /* check return code? */
  
  
  

Reply via email to