- Timestamp:
- 06/03/04 19:34:49 (21 years ago)
- File:
-
- 1 edited
-
ps/trunk/source/ps/XMLUtils.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/ps/XMLUtils.cpp
r380 r388 1 1 #include "XML.h" 2 2 #include "CStr.h" 3 #include "CLogger.h" 3 4 4 5 #include "res/vfs.h" … … 25 26 26 27 m_hFile=vfs_open(path); 27 if (m_hFile <= 0) return -1; 28 if (m_hFile <= 0) 29 { 30 LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_open)\n", path); 31 return -1; 32 } 28 33 29 if (vfs_map(m_hFile, 0, m_pBuffer, m_BufferSize) != 0) 34 int err; 35 if ((err=vfs_map(m_hFile, 0, m_pBuffer, m_BufferSize)) != 0) 30 36 { 37 LOG(ERROR, "CVFSInputSource: file %s couldn't be opened (vfs_map: %d)\n", path, err); 31 38 vfs_close(m_hFile); 32 39 m_hFile=0; … … 68 75 char *orgpath=path; 69 76 70 CStr base=m_DocName;71 const char *end=m_DocName+ base.Length();72 if (strncmp(path, ".. /", 3) == 0)77 CStr abspath=m_DocName; 78 const char *end=m_DocName+abspath.Length(); 79 if (strncmp(path, "..", 2) == 0 && (path[2] == '/' || path[2] == '\\')) 73 80 { 74 81 do 75 82 --end; 76 while (end > m_DocName && *end != '/');83 while (end > m_DocName && (*end != '/' && *end != '\\')); 77 84 78 while (strncmp(path, ".. /", 3) == 0)85 while (strncmp(path, "..", 2) == 0 && (path[2] == '/' || path[2] == '\\')) 79 86 { 80 87 path += 3; … … 82 89 do 83 90 --end; 84 while (end > m_DocName && *end != '/');91 while (end > m_DocName && (*end != '/' && *end != '\\')); 85 92 } 86 93 87 94 --path; 95 96 abspath=abspath.Left(end-m_DocName)+path; 97 98 int pos=0; 99 if (abspath.Find('\\') != -1) 100 { 101 LOG(WARNING, "While resolving XML entities for %s: path %s [%s] contains non-portable path separator \\", m_DocName, orgpath, abspath.c_str()); 102 abspath.Replace("\\", "/"); 103 } 88 104 } 89 105 90 if ( 91 (orgpath != path && 92 ret->OpenFile((base.Left(end-m_DocName)+path).c_str())!=0) 106 if ((orgpath != path && ret->OpenFile(abspath)!=0) 93 107 || (orgpath == path && ret->OpenFile(path)!=0)) 94 108 {
Note:
See TracChangeset
for help on using the changeset viewer.
