Author: rhuijben
Date: Fri Jun 25 12:02:49 2010
New Revision: 957905

URL: http://svn.apache.org/viewvc?rev=957905&view=rev
Log:
In the dirent/uri code: Replace all checks for WIN32 or __CYGWIN__
with a check for SVN_USE_DOS_PATHS and set this define for WIN32,
__CYGWIN__ and __OS2__.

* subversion/libsvn_subr/dirent_uri.c
* subversion/tests/libsvn_subr/dirent_uri-test.c
  Global macro update.

Modified:
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c
    subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=957905&r1=957904&r2=957905&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Fri Jun 25 12:02:49 
2010
@@ -50,6 +50,11 @@
    the OS! */
 #define SVN_PATH_IS_PLATFORM_EMPTY(s,n) ((n) == 1 && (s)[0] == '.')
 
+/* This check must match the check on to of dirent_uri-tests.c */
+#if defined(WIN32) || defined(__CYGWIN__) || defined(__OS2__)
+#define SVN_USE_DOS_PATHS
+#endif
+
 /* Path type definition. Used only by internal functions. */
 typedef enum {
   type_uri,
@@ -169,7 +174,7 @@ canonicalize_to_upper(char c)
 static apr_size_t
 dirent_root_length(const char *dirent, apr_size_t len)
 {
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (len >= 2 && dirent[1] == ':' &&
       ((dirent[0] >= 'A' && dirent[0] <= 'Z') ||
        (dirent[0] >= 'a' && dirent[0] <= 'z')))
@@ -194,7 +199,7 @@ dirent_root_length(const char *dirent, a
 
       return i;
     }
-#endif
+#endif /* SVN_USE_DOS_PATHS */
   if (len >= 1 && dirent[0] == '/')
     return 1;
 
@@ -218,9 +223,9 @@ dirent_previous_segment(const char *dire
 
   --len;
   while (len > 0 && dirent[len] != '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
                  && (dirent[len] != ':' || len != 1)
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
         )
     --len;
 
@@ -277,12 +282,12 @@ dirent_is_rooted(const char *dirent)
 
   /* On Windows, dirent is also absolute when it starts with 'H:' or 'H:/'
      where 'H' is any letter. */
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (((dirent[0] >= 'A' && dirent[0] <= 'Z') ||
        (dirent[0] >= 'a' && dirent[0] <= 'z')) &&
       (dirent[1] == ':'))
      return TRUE;
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
 
   return FALSE;
 }
@@ -429,14 +434,14 @@ canonicalize(path_type_t type, const cha
         {
           *(dst++) = *(src++);
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
           /* On Windows permit two leading separator characters which means an
            * UNC path. */
           if ((type == type_dirent) && *src == '/')
             *(dst++) = *(src++);
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
         }
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       /* On Windows the first segment can be a drive letter, which we normalize
          to upper case. */
       else if (type == type_dirent &&
@@ -449,7 +454,7 @@ canonicalize(path_type_t type, const cha
              by the following code block, so we need not care whether it has
              a slash after it. */
         }
-#endif
+#endif /* SVN_USE_DOS_PATHS */
     }
 
   while (*src)
@@ -465,7 +470,7 @@ canonicalize(path_type_t type, const cha
         {
           /* Noop segment, so do nothing. */
         }
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       /* If this is the first path segment of a file:// URI and it contains a
          windows drive letter, convert the drive letter to upper case. */
       else if (url && canon_segments == 1 && seglen == 2 &&
@@ -478,7 +483,7 @@ canonicalize(path_type_t type, const cha
             *(dst++) = *next;
           canon_segments++;
         }
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
       else
         {
           /* An actual segment, append it to the destination path */
@@ -509,7 +514,7 @@ canonicalize(path_type_t type, const cha
 
   *dst = '\0';
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   /* Skip leading double slashes when there are less than 2
    * canon segments. UNC paths *MUST* have two segments. */
   if ((type == type_dirent) && canon[0] == '/' && canon[1] == '/')
@@ -529,7 +534,7 @@ canonicalize(path_type_t type, const cha
             *(dst++) = canonicalize_to_lower(*dst);
         }
     }
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
 
   /* Check the normalization of characters in a uri */
   if (schema_data)
@@ -642,7 +647,7 @@ get_longest_ancestor_length(path_type_t 
   apr_size_t path1_len, path2_len;
   apr_size_t i = 0;
   apr_size_t last_dirsep = 0;
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   svn_boolean_t unc = FALSE;
 #endif
 
@@ -675,7 +680,7 @@ get_longest_ancestor_length(path_type_t 
     return 0;
 
   /* Handle some windows specific cases */
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (types == type_dirent)
     {
       /* don't count the '//' from UNC paths */
@@ -703,7 +708,7 @@ get_longest_ancestor_length(path_type_t 
       if (path1[i - 1] == ':' || path2[i - 1] == ':')
           return i;
     }
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
 
   /* last_dirsep is now the offset of the last directory separator we
      crossed before reaching a non-matching byte.  i is the offset of
@@ -718,7 +723,7 @@ get_longest_ancestor_length(path_type_t 
     {
       /* Nothing in common but the root folder '/' or 'X:/' for Windows
          dirents. */
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       if (! unc)
         {
           /* X:/foo and X:/bar returns X:/ */
@@ -726,10 +731,10 @@ get_longest_ancestor_length(path_type_t 
               last_dirsep == 2 && path1[1] == ':' && path1[2] == '/'
                                && path2[1] == ':' && path2[2] == '/')
             return 3;
-#endif
+#endif /* SVN_USE_DOS_PATHS */
           if (last_dirsep == 0 && path1[0] == '/' && path2[0] == '/')
             return 1;
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
         }
 #endif
     }
@@ -807,9 +812,9 @@ is_child(path_type_t type, const char *p
   if (path1[i] == '\0' && path2[i])
     {
       if (path1[i - 1] == '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
           || ((type == type_dirent) && path1[i - 1] == ':')
-#endif /* WIN32 or Cygwin */
+#endif
            )
         {
           if (path2[i] == '/')
@@ -870,9 +875,9 @@ is_ancestor(path_type_t type, const char
   path1_len = strlen(path1);
   if (strncmp(path1, path2, path1_len) == 0)
     return path1[path1_len - 1] == '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       || ((type == type_dirent) && path1[path1_len - 1] == ':')
-#endif /* WIN32 or Cygwin */
+#endif
       || (path2[path1_len] == '/' || path2[path1_len] == '\0');
 
   return FALSE;
@@ -913,7 +918,7 @@ svn_relpath_local_style(const char *dire
 svn_boolean_t
 svn_dirent_is_root(const char *dirent, apr_size_t len)
 {
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   /* On Windows and Cygwin, 'H:' or 'H:/' (where 'H' is any letter)
      are also root directories */
   if ((len == 2 || ((len == 3) && (dirent[2] == '/'))) &&
@@ -987,7 +992,7 @@ char *svn_dirent_join(const char *base,
   if (SVN_PATH_IS_EMPTY(component))
     return apr_pmemdup(pool, base, blen + 1);
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (component[0] == '/')
     {
       /* '/' is drive relative on Windows, not absolute like on Posix */
@@ -1015,14 +1020,14 @@ char *svn_dirent_join(const char *base,
     }
   else if (dirent_is_rooted(component))
     return apr_pmemdup(pool, component, clen + 1);
-#endif
+#endif /* SVN_USE_DOS_PATHS */
 
   /* if last character of base is already a separator, don't add a '/' */
   add_separator = 1;
   if (base[blen - 1] == '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
        || base[blen - 1] == ':'
-#endif /* WIN32 or Cygwin */
+#endif
         )
           add_separator = 0;
 
@@ -1058,9 +1063,9 @@ char *svn_dirent_join_many(apr_pool_t *p
   add_separator = 1;
   if (total_len == 0
        || base[total_len - 1] == '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
        || base[total_len - 1] == ':'
-#endif /* WIN32 or Cygwin */
+#endif
         )
           add_separator = 0;
 
@@ -1087,7 +1092,7 @@ char *svn_dirent_join_many(apr_pool_t *p
           total_len = len;
           base_arg = nargs;
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
           if (!svn_dirent_is_absolute(s)) /* Handle non absolute roots */
             {
               /* Set new base and skip the current argument */
@@ -1096,7 +1101,7 @@ char *svn_dirent_join_many(apr_pool_t *p
               saved_lengths[0] = total_len = len = strlen(s);
             }
           else
-#endif
+#endif /* SVN_USE_DOS_PATHS */
             {
               base = ""; /* Don't add base */
               saved_lengths[0] = 0;
@@ -1104,9 +1109,9 @@ char *svn_dirent_join_many(apr_pool_t *p
 
           add_separator = 1;
           if (s[len - 1] == '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
              || s[len - 1] == ':'
-#endif /* WIN32 or Cygwin */
+#endif
               )
              add_separator = 0;
         }
@@ -1274,9 +1279,9 @@ svn_dirent_basename(const char *dirent, 
     {
       start = len;
       while (start > 0 && dirent[start - 1] != '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
              && dirent[start - 1] != ':'
-#endif /* WIN32 or Cygwin */
+#endif
             )
         --start;
     }
@@ -1541,7 +1546,7 @@ svn_dirent_skip_ancestor(const char *dir
   if (dirent2[len] == '/')
     return dirent2 + len + 1;
 
-#ifdef WIN32
+#ifdef SVN_USE_DOS_PATHS
   if (root_len == len && len > 0 && dirent2[len-1])
     return dirent2 + len;
 #endif
@@ -1601,7 +1606,7 @@ svn_dirent_is_absolute(const char *diren
   /* dirent is absolute if it starts with '/' on non-Windows platforms
      or with '//' on Windows platforms */
   if (dirent[0] == '/'
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       && dirent[1] == '/' /* Single '/' depends on current drive */
 #endif
       )
@@ -1609,11 +1614,11 @@ svn_dirent_is_absolute(const char *diren
 
   /* On Windows, dirent is also absolute when it starts with 'H:/'
      where 'H' is any letter. */
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (((dirent[0] >= 'A' && dirent[0] <= 'Z')) &&
       (dirent[1] == ':') && (dirent[2] == '/'))
      return TRUE;
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
 
   return FALSE;
 }
@@ -1675,7 +1680,7 @@ svn_dirent_canonicalize(const char *dire
 {
   const char *dst = canonicalize(type_dirent, dirent, pool);
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   /* Handle a specific case on Windows where path == "X:/". Here we have to
      append the final '/', as svn_path_canonicalize will chop this of. */
   if (((dirent[0] >= 'A' && dirent[0] <= 'Z') ||
@@ -1691,7 +1696,7 @@ svn_dirent_canonicalize(const char *dire
 
       return dst_slash;
     }
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
 
   return dst;
 }
@@ -1703,7 +1708,7 @@ svn_dirent_is_canonical(const char *dire
   if (*ptr == '/')
     {
       ptr++;
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       /* Check for UNC paths */
       if (*ptr == '/')
         {
@@ -1712,9 +1717,9 @@ svn_dirent_is_canonical(const char *dire
           /* ### Fall back to old implementation */
           return (strcmp(dirent, svn_dirent_canonicalize(dirent, pool)) == 0);
         }
-#endif
+#endif /* SVN_USE_DOS_PATHS */
     }
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   else if (((*ptr >= 'a' && *ptr <= 'z') || (*ptr >= 'A' && *ptr <= 'Z')) &&
            (ptr[1] == ':'))
     {
@@ -1727,7 +1732,7 @@ svn_dirent_is_canonical(const char *dire
       if (*ptr == '/')
         ptr++;
     }
-#endif
+#endif /* SVN_USE_DOS_PATHS */
 
   return svn_relpath_is_canonical(ptr, pool);
 }
@@ -1844,7 +1849,7 @@ svn_uri_is_canonical(const char *uri, ap
         }
     }
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (schema_data && *ptr == '/')
     {
       /* If this is a file url, ptr now points to the third '/' in
@@ -1855,7 +1860,7 @@ svn_uri_is_canonical(const char *uri, ap
           *(ptr+2) == ':')
         return FALSE;
     }
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
 
   /* Now validate the rest of the URI. */
   while(1)
@@ -2318,7 +2323,7 @@ svn_uri_get_dirent_from_file_url(const c
 
   /* Duplicate the URL, starting at the top of the path.
      At the same time, we URI-decode the path. */
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   /* On Windows, we'll typically have to skip the leading / if the
      path starts with a drive letter.  Like most Web browsers, We
      support two variants of this scheme:
@@ -2372,7 +2377,7 @@ svn_uri_get_dirent_from_file_url(const c
     else
       *dirent = dup_path;
   }
-#else
+#else /* !SVN_USE_DOS_PATHS */
   /* Currently, the only hostnames we are allowing on non-Win32 platforms
      are the empty string and 'localhost'. */
   if (hostname)
@@ -2381,6 +2386,6 @@ svn_uri_get_dirent_from_file_url(const c
                              url);
 
   *dirent = svn_path_uri_decode(path, pool);
-#endif
+#endif /* SVN_USE_DOS_PATHS */
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=957905&r1=957904&r2=957905&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c Fri Jun 25 
12:02:49 2010
@@ -41,6 +41,11 @@
 
 #define SVN_EMPTY_PATH ""
 
+/* This check must match the check on to of dirent_uri.c */
+#if defined(WIN32) || defined(__CYGWIN__) || defined(__OS2__)
+#define SVN_USE_DOS_PATHS
+#endif
+
 #define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
 
 static svn_error_t *
@@ -57,7 +62,7 @@ test_dirent_is_root(apr_pool_t *pool)
     { "/foo/bar",      FALSE },
     { "/foo",          FALSE },
     { "",              FALSE },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/foo",        FALSE },
     { "X:/",           TRUE },
     { "X:foo",         FALSE }, /* Based on non absolute root */
@@ -66,11 +71,11 @@ test_dirent_is_root(apr_pool_t *pool)
     { "//srv/shr/fld", FALSE },
     { "//srv/s r",     TRUE },
     { "//srv/s r/fld", FALSE },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "/",             TRUE },
     { "/X:foo",        FALSE },
     { "/X:",           FALSE },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(tests); i++)
@@ -145,7 +150,7 @@ test_dirent_is_absolute(apr_pool_t *pool
     { "foo/bar",       FALSE },
     { "foo",           FALSE },
     { "",              FALSE },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "/foo/bar",      FALSE },
     { "/foo",          FALSE },
     { "/",             FALSE },
@@ -157,13 +162,13 @@ test_dirent_is_absolute(apr_pool_t *pool
     { "//srv/shr/fld", TRUE },
     { "//srv/s r",     TRUE },
     { "//srv/s r/fld", TRUE },
-#else/* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "/foo/bar",      TRUE },
     { "/foo",          TRUE },
     { "/",             TRUE },
     { "X:/foo",        FALSE },
     { "X:/",           FALSE },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
     { "X:foo",         FALSE }, /* Not special on Posix, relative on Windows */
     { "X:foo/bar",     FALSE },
     { "X:",            FALSE },
@@ -269,7 +274,7 @@ test_dirent_join(apr_pool_t *pool)
     { SVN_EMPTY_PATH, "/abc", "/abc" },
     { SVN_EMPTY_PATH, SVN_EMPTY_PATH, SVN_EMPTY_PATH },
     { "/", "/", "/" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/", SVN_EMPTY_PATH, "X:/" },
     { "X:/", "abc", "X:/abc" },
     { "X:/", "/def", "X:/def" },
@@ -292,11 +297,11 @@ test_dirent_join(apr_pool_t *pool)
     { "aa", "A:", "A:" },
     { "aa", "A:file", "A:file"},
     { "A:", "/", "A:/" },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "X:abc", "X:/def", "X:abc/X:/def" },
     { "X:","abc", "X:/abc" },
     { "X:/abc", "X:/def", "X:/abc/X:/def" },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(joins); i++ )
@@ -360,7 +365,7 @@ test_dirent_join(apr_pool_t *pool)
   TEST_MANY((pool, SVN_EMPTY_PATH, "/", SVN_EMPTY_PATH, NULL), "/");
   TEST_MANY((pool, SVN_EMPTY_PATH, SVN_EMPTY_PATH, "/", NULL), "/");
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   TEST_MANY((pool, "X:/", "def", "ghi", NULL), "X:/def/ghi");
   TEST_MANY((pool, "abc", "X:/", "ghi", NULL), "X:/ghi");
   TEST_MANY((pool, "abc", "def", "X:/", NULL), "X:/");
@@ -389,12 +394,12 @@ test_dirent_join(apr_pool_t *pool)
   TEST_MANY((pool, "abcd", "/dir", "A:", "file", NULL), "A:file");
   TEST_MANY((pool, "abcd", "A:", "/dir", "file", NULL), "A:/dir/file");
 
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
   TEST_MANY((pool, "X:", "def", "ghi", NULL), "X:/def/ghi");
   TEST_MANY((pool, "X:", SVN_EMPTY_PATH, "ghi", NULL), "X:/ghi");
   TEST_MANY((pool, "X:", "def", SVN_EMPTY_PATH, NULL), "X:/def");
   TEST_MANY((pool, SVN_EMPTY_PATH, "X:", "ghi", NULL), "X:/ghi");
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
 
   /* ### probably need quite a few more tests... */
 
@@ -515,7 +520,7 @@ test_dirent_basename(apr_pool_t *pool)
     { "/", "" },
     { SVN_EMPTY_PATH, SVN_EMPTY_PATH },
     { "X:/abc", "abc" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:", "" },
     { "X:/", "" },
     { "X:abc", "abc" },
@@ -523,10 +528,10 @@ test_dirent_basename(apr_pool_t *pool)
     { "//srv/shr/fld", "fld" },
     { "//srv/shr/fld/subfld", "subfld" },
     { "//srv/s r/fld", "fld" },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "X:", "X:" },
     { "X:abc", "X:abc" },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(tests); i++)
@@ -633,7 +638,7 @@ test_dirent_dirname(apr_pool_t *pool)
     { "/", "/" },
     { SVN_EMPTY_PATH, SVN_EMPTY_PATH },
     { "X:abc/def", "X:abc" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/", "X:/" },
     { "X:/abc", "X:/" },
     { "X:abc", "X:" },
@@ -642,11 +647,11 @@ test_dirent_dirname(apr_pool_t *pool)
     { "//srv/shr/fld",  "//srv/shr" },
     { "//srv/shr/fld/subfld", "//srv/shr/fld" },
     { "//srv/s r/fld",  "//srv/s r" },
-#else  /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     /* on non-Windows platforms, ':' is allowed in pathnames */
     { "X:", "" },
     { "X:abc", "" },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(tests); i++)
@@ -776,7 +781,7 @@ test_dirent_canonicalize(apr_pool_t *poo
     { "X:",                   "X:" },
     { "X:foo",                "X:foo" },
     { "C:/folder/subfolder/file", "C:/folder/subfolder/file" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/",                  "X:/" },
     { "X:/./",                "X:/" },
     { "x:/",                  "X:/" },
@@ -793,7 +798,7 @@ test_dirent_canonicalize(apr_pool_t *poo
     { "//SERVER/SHare/",      "//server/SHare" },
     { "//srv/s r",            "//srv/s r" },
     { "//srv/s r/qq",         "//srv/s r/qq" },
-#endif /* WIN32 or Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
   };
   int i;
 
@@ -963,15 +968,15 @@ test_uri_canonicalize(apr_pool_t *pool)
     { "s://d/c#",              "s://d/c%23" }, /* Escape schema separator */
     { "s://d/c($) .+?",        "s://d/c($)%20.+%3F" }, /* Test special chars */
     { "file:///C%3a/temp",     "file:///C:/temp" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "file:///c:/temp/repos", "file:///C:/temp/repos" },
     { "file:///c:/temp/REPOS", "file:///C:/temp/REPOS" },
     { "file:///C:/temp/REPOS", "file:///C:/temp/REPOS" },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "file:///c:/temp/repos", "file:///c:/temp/repos" },
     { "file:///c:/temp/REPOS", "file:///c:/temp/REPOS" },
     { "file:///C:/temp/REPOS", "file:///C:/temp/REPOS" },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
   int i;
 
@@ -1036,7 +1041,7 @@ test_dirent_is_canonical(apr_pool_t *poo
     { "X:foo",                 TRUE },
     { "X:foo/",                FALSE },
     { "file with spaces",      TRUE },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/",                   TRUE },
     { "X:/foo",                TRUE },
     { "X:",                    TRUE },
@@ -1055,13 +1060,13 @@ test_dirent_is_canonical(apr_pool_t *poo
     { "//server/SHare",        TRUE },
     { "//SERVER/SHare",        FALSE },
     { "//srv/SH RE",           TRUE },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "X:/",                   FALSE },
     /* Some people use colons in their filenames. */
     { ":", TRUE },
     { ".:", TRUE },
     { "foo/.:", TRUE },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
   int i;
 
@@ -1262,15 +1267,15 @@ test_uri_is_canonical(apr_pool_t *pool)
     { "file:///folder/c#",      FALSE }, /* # needs escaping */
     { "file:///fld/with space", FALSE }, /* # needs escaping */
     { "file:///fld/c%23",       TRUE }, /* Properly escaped C# */
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "file:///c:/temp/repos", FALSE },
     { "file:///c:/temp/REPOS", FALSE },
     { "file:///C:/temp/REPOS", TRUE },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "file:///c:/temp/repos", TRUE },
     { "file:///c:/temp/REPOS", TRUE },
     { "file:///C:/temp/REPOS", TRUE },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
   int i;
 
@@ -1324,16 +1329,16 @@ test_dirent_split(apr_pool_t *pool)
     { "/",               "/",             "" },
     { "X:/foo/bar",      "X:/foo",        "bar" },
     { "X:foo/bar",       "X:foo",         "bar" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/",             "X:/",           "" },
     { "X:/foo",          "X:/",           "foo" },
     { "X:foo",           "X:",            "foo" },
     { "//srv/shr",       "//srv/shr",     "" },
     { "//srv/shr/fld",   "//srv/shr",     "fld" },
     { "//srv/s r",       "//srv/s r",     "" },
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "X:foo",           SVN_EMPTY_PATH,  "X:foo" },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(paths); i++)
@@ -1461,7 +1466,7 @@ test_dirent_is_ancestor(apr_pool_t *pool
     { SVN_EMPTY_PATH,    SVN_EMPTY_PATH,  TRUE},
     { "/",               "/",             TRUE},
     { "X:foo",           "X:bar",         FALSE},
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "//srv/shr",       "//srv",         FALSE},
     { "//srv/shr",       "//srv/shr/fld", TRUE },
     { "//srv/s r",       "//srv/s r/fld", TRUE },
@@ -1473,10 +1478,10 @@ test_dirent_is_ancestor(apr_pool_t *pool
     { "X:/",             "X:/foo",        TRUE},
     { "X:",              "X:foo",         TRUE},
     { SVN_EMPTY_PATH,    "C:/",           FALSE},
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "X:",              "X:foo",         FALSE},
     { SVN_EMPTY_PATH,    "C:/",           TRUE},
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(tests); i++)
@@ -1612,7 +1617,7 @@ test_dirent_skip_ancestor(apr_pool_t *po
     { "foo/bar",         "foo",             "foo"},
     { "/foo/bar",        "foo",             "foo"},
     { "/",               "bar/bla",         "bar/bla"},
-#ifdef WIN32
+#ifdef SVN_USE_DOS_PATHS
     { "A:/foo",          "A:/foo/bar",      "bar"},
     { "A:/foo",          "A:/foot",         "A:/foot"},
     { "A:/",             "A:/foo",          "foo"},
@@ -1750,7 +1755,7 @@ test_dirent_get_longest_ancestor(apr_poo
     { "/",              "/",               "/"},
     { "X:foo",          "Y:foo",           SVN_EMPTY_PATH},
     { "X:/folder1",     "Y:/folder2",      SVN_EMPTY_PATH},
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "X:/",            "X:/",             "X:/"},
     { "X:/foo/bar/A/D/H/psi", "X:/foo/bar/A/B", "X:/foo/bar/A" },
     { "X:/foo/bar/boo", "X:/foo/bar/baz/boz", "X:/foo/bar"},
@@ -1764,12 +1769,12 @@ test_dirent_get_longest_ancestor(apr_poo
     { "X:",             "X:foo",           "X:"},
     { "X:",             "X:/",             SVN_EMPTY_PATH},
     { "X:foo",          "X:bar",           "X:"},
-#else /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "X:/foo",         "X:",              "X:"},
     { "X:/folder1",     "X:/folder2",      "X:"},
     { "X:",             "X:foo",           SVN_EMPTY_PATH},
     { "X:foo",          "X:bar",           SVN_EMPTY_PATH},
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(tests); i++)
@@ -1945,7 +1950,7 @@ test_dirent_is_child(apr_pool_t *pool)
     ".foo",
     "/",
     "foo2",
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     "//srv",
     "//srv2",
     "//srv/shr",
@@ -1960,7 +1965,7 @@ test_dirent_is_child(apr_pool_t *pool)
     "H:",
     "H:foo",
     "H:foo/baz",
-#endif /* Win32 and Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
     };
 
   /* Maximum number of path[] items for all platforms */
@@ -1991,7 +1996,7 @@ test_dirent_is_child(apr_pool_t *pool)
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     /* //srv paths */
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, "shr", "shr/fld", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -2024,7 +2029,7 @@ test_dirent_is_child(apr_pool_t *pool)
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "baz" },
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-#endif /* Win32 and Cygwin */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   for (i = 0; i < COUNT_OF(paths); i++)
@@ -2233,10 +2238,10 @@ test_dirent_get_absolute(apr_pool_t *poo
   int i;
   const char *curdir;
   char buf[8192];
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   const char *curdironc;
   char curdrive[3] = "C:";
-#endif /* WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
 
   struct {
     const char *path;
@@ -2245,7 +2250,7 @@ test_dirent_get_absolute(apr_pool_t *poo
     /* '%' will be replaced by the current working dir. */
     { "abc", "%/abc" },
     { SVN_EMPTY_PATH, "%" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     /* '@' will be replaced by the current working dir on C:\. */
     /* '$' will be replaced by the current drive */
     { "C:/", "C:/" },
@@ -2262,12 +2267,12 @@ test_dirent_get_absolute(apr_pool_t *poo
     { "//srv/shr",      "//srv/shr" },
     { "//srv/shr/fld",  "//srv/shr" },
     { "//srv/shr/fld/subfld", "//srv/shr/fld" }, */
-#else  /* WIN32 or Cygwin */
+#else /* !SVN_USE_DOS_PATHS */
     { "/abc", "/abc" },
     { "/x/abc", "/x/abc" },
     { "X:", "%/X:" },
     { "X:abc", "%/X:abc" },
-#endif /* non-WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
   };
 
   if (! getcwd(buf, sizeof(buf)))
@@ -2275,13 +2280,13 @@ test_dirent_get_absolute(apr_pool_t *poo
 
   curdir = svn_dirent_internal_style(buf, pool);
 
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
   if (! getdcwd(3, buf, sizeof(buf))) /* 3 stands for drive C: */
     return svn_error_create(SVN_ERR_BASE, NULL, "getdcwd() failed");
 
   curdironc = svn_dirent_internal_style(buf, pool);
   curdrive[0] = curdir[0];
-#endif /* WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
 
   for (i = 0 ; i < COUNT_OF(tests) ; i++ )
     {
@@ -2292,7 +2297,7 @@ test_dirent_get_absolute(apr_pool_t *poo
       expect_abs = expect;
       if (*expect == '%')
         expect_abs = apr_pstrcat(pool, curdir, expect + 1, NULL);
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
       if (*expect == '@')
         expect_abs = apr_pstrcat(pool, curdironc, expect + 1, NULL);
 
@@ -2301,7 +2306,7 @@ test_dirent_get_absolute(apr_pool_t *poo
 
       /* Remove double '/' when CWD was the root dir (E.g. C:/) */
       expect_abs = svn_dirent_canonicalize(expect_abs, pool);
-#endif /* WIN32 */
+#endif /* SVN_USE_DOS_PATHS */
 
       SVN_ERR(svn_dirent_get_absolute(&result, path, pool));
       if (strcmp(result, expect_abs))
@@ -2389,7 +2394,7 @@ test_dirent_condense_targets(apr_pool_t 
     { { "/dir", "/dir/file", NULL },         NULL,     { "", "file" } },
     { { "/dir1", "/dir2", NULL },            NULL,     { "dir1", "dir2" } },
     { { "dir1", "dir2", NULL },              NULL,     { "dir1", "dir2" } },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { {"C:/", "C:/zeta", NULL},              "C:/",    {"", "zeta"} },
     { {"C:/dir", "C:/dir/zeta", NULL},       "C:/dir", {"", "zeta"} },
     { {"C:/dir/omega", "C:/dir/zeta", NULL}, "C:/dir", {"omega", "zeta" } },
@@ -2518,7 +2523,7 @@ test_dirent_local_style(apr_pool_t *pool
   } tests[] = {
     { "",                     "." },
     { ".",                    "." },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "A:/",                 "A:\\" },
     { "A:/file",             "A:\\file" },
     { "a:/",                 "A:\\" },
@@ -2561,7 +2566,7 @@ test_relpath_local_style(apr_pool_t *poo
     { "",                     "." },
     { ".",                    "." },
     { "c:hi",                 "c:hi" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "dir/file",             "dir\\file" },
     { "a:/file",              "a:\\file" },
 #else
@@ -2598,7 +2603,7 @@ test_dirent_internal_style(apr_pool_t *p
     { "file",                "file" },
     { "dir/file",            "dir/file" },
     { "dir/file/./.",        "dir/file" },
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef SVN_USE_DOS_PATHS
     { "A:\\",                "A:/" },
     { "A:\\file",            "A:/file" },
     { "A:file",              "A:file" },
@@ -2681,7 +2686,7 @@ test_dirent_from_file_url(apr_pool_t *po
     { "file:///dir/path",          "/dir/path" },
     { "file://localhost/dir",      "/dir" },
     { "file://localhost/dir/path", "/dir/path" },
-#if defined(WIN32)
+#ifdef SVN_USE_DOS_PATHS
     { "file://server/share",       "//server/share" },
     { "file://server/share/dir",   "//server/share/dir" },
     { "file:///A:",                "A:/" },


Reply via email to