Author: joes
Date: Sun Apr 10 13:45:49 2005
New Revision: 160804

URL: http://svn.apache.org/viewcvs?view=rev&rev=160804
Log:
style nits. Also memmove is safer than memcpy
in this case, since dest may have overlap with 
src.

Modified:
    httpd/apreq/branches/multi-env-unstable/library/util.c

Modified: httpd/apreq/branches/multi-env-unstable/library/util.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/util.c?view=diff&r1=160803&r2=160804
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/util.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/util.c Sun Apr 10 13:45:49 
2005
@@ -231,11 +231,11 @@
 
     switch (flen % 3) {
     case 2:
-     if (!is_89AB(*--end))
-         return APREQ_CHARSET_LATIN1;
+        if (!is_89AB(*--end))
+            return APREQ_CHARSET_LATIN1;
     case 1:
         if (*--end != '%')
-         return APREQ_CHARSET_LATIN1;
+            return APREQ_CHARSET_LATIN1;
     }
     return APREQ_CHARSET_UTF8;
 }
@@ -309,7 +309,7 @@
                     *d = c;
                 }
                 else if (c < 0xA0) {
-                    /* these are ctrl chars in 8859 */
+                    /* these are ctrl chars in latin1 */
                     *charset = APREQ_CHARSET_CP1252;
                     *d = c;
                 }
@@ -324,11 +324,12 @@
                 /* utf8 cases */
 
                 else if (c < 0xE0) {
+                    /* 2-byte utf8 */
                     if (s + 3 >= end) {
                         *charset = fragment_charset(s+1, end);
                         if (*charset == APREQ_CHARSET_UTF8) {
                             s -= 2;
-                            memcpy(d, s, end - s);
+                            memmove(d, s, end - s);
                             d[end - s] = 0;
                             return APR_INCOMPLETE;
                         }
@@ -351,7 +352,7 @@
                         *charset = fragment_charset(s+1, end);
                         if (*charset == APREQ_CHARSET_UTF8) {
                             s -= 2;
-                            memcpy(d, s, end - s);
+                            memmove(d, s, end - s);
                             d[end - s] = 0;
                             return APR_INCOMPLETE;
                         }
@@ -376,7 +377,7 @@
                         *charset = fragment_charset(s+1, end);
                         if (*charset == APREQ_CHARSET_UTF8) {
                             s -= 2;
-                            memcpy(d, s, end - s);
+                            memmove(d, s, end - s);
                             d[end - s] = 0;
                             return APR_INCOMPLETE;
                         }
@@ -402,7 +403,7 @@
                         *charset = fragment_charset(s+1, end);
                          if (*charset == APREQ_CHARSET_UTF8) {
                              s -= 2;
-                             memcpy(d, s, end - s);
+                             memmove(d, s, end - s);
                              d[end - s] = 0;
                              return APR_INCOMPLETE;
                          }
@@ -429,7 +430,7 @@
                         *charset = fragment_charset(s+1, end);
                         if (*charset == APREQ_CHARSET_UTF8) {
                             s -= 2;
-                            memcpy(d, s, end - s);
+                            memmove(d, s, end - s);
                             d[end - s] = 0;
                             return APR_INCOMPLETE;
                         }
@@ -499,7 +500,7 @@
                     return APREQ_ERROR_BADSEQ;
                 }
 
-                memcpy(d, s, end - s);
+                memmove(d, s, end - s);
                 d[end - s] = 0;
                 return APR_INCOMPLETE;
            }
@@ -603,7 +604,7 @@
     const unsigned char *s = (const unsigned char *)src;
     unsigned c;
 
-    for ( ;s < (const unsigned char *)src + slen; ++s) {
+    for ( ; s < (const unsigned char *)src + slen; ++s) {
         c = *s;
         if ( apr_isalnum(c) )
             *d++ = c;
@@ -746,7 +747,6 @@
 
 
     case APREQ_JOIN_QUOTE:
-
         d += apreq_quote_once(d, a[0]->data, a[0]->dlen);
 
         for (j = 1; j < n; ++j) {
@@ -942,7 +942,7 @@
     switch (c) {
     case ' ': case ';': case ',': case '"': case '\t':
         /* The chars we are expecting are listed above;
-           the chars below for are just for completeness. */
+           the chars below are just for completeness. */
     case '?': case '=': case '@': case ':': case '\\': case '/':
     case '(': case ')':
     case '<': case '>':


Reply via email to