You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2003/01/06 20:43:32 UTC

cvs commit: xml-xerces/c/src/xercesc/util/Platforms/Win32 Win32PlatformUtils.cpp

tng         2003/01/06 11:43:32

  Modified:    c/src/xercesc/util/Platforms/Win32 Win32PlatformUtils.cpp
  Log:
  New feature StandardUriConformant to force strict standard uri conformance.
  
  Revision  Changes    Path
  1.12      +33 -4     xml-xerces/c/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp
  
  Index: Win32PlatformUtils.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Win32PlatformUtils.cpp	6 Dec 2002 16:40:24 -0000	1.11
  +++ Win32PlatformUtils.cpp	6 Jan 2003 19:43:32 -0000	1.12
  @@ -260,6 +260,36 @@
       if (!fileName)
           return 0;
   
  +    //
  +    //  We have to play a little trick here. If its /x:.....
  +    //  style fully qualified path, we have to toss the leading /
  +    //  character.
  +    //
  +    const XMLCh* nameToOpen = fileName;
  +    if (*fileName == chForwardSlash)
  +    {
  +        if (XMLString::stringLen(fileName) > 3)
  +        {
  +            if (*(fileName + 2) == chColon)
  +            {
  +                const XMLCh chDrive = *(fileName + 1);
  +                if (((chDrive >= chLatin_A) && (chDrive <= chLatin_Z))
  +                ||  ((chDrive >= chLatin_a) && (chDrive <= chLatin_z)))
  +                {
  +                    nameToOpen = fileName + 1;
  +                }
  +            }
  +
  +            // Similarly for UNC paths
  +            if ( *(fileName + 1) == *(fileName + 2) &&
  +                 (*(fileName + 1) == chForwardSlash ||
  +                  *(fileName + 1) == chBackSlash) )
  +            {
  +                nameToOpen = fileName + 1;
  +            }
  +        }
  +    }
  +
       //  Ok, this might look stupid but its a semi-expedient way to deal
       //  with a thorny problem. Shift-JIS and some other Asian encodings
       //  are fundamentally broken and map both the backslash and the Yen
  @@ -279,9 +309,8 @@
       //   transcode correctly back to 8 bit char * form.
       //
       XMLCh *tmpUName = 0;
  -    const XMLCh *nameToOpen = fileName;
   
  -    const XMLCh* srcPtr = fileName;
  +    const XMLCh* srcPtr = nameToOpen;
       while (*srcPtr)
       {
           if (*srcPtr == chYenSign ||
  @@ -296,7 +325,7 @@
       //
       if (*srcPtr)
       {
  -        tmpUName = XMLString::replicate(fileName);
  +        tmpUName = XMLString::replicate(nameToOpen);
   
           XMLCh* tmpPtr = tmpUName;
           while (*tmpPtr)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org