@@ -54,7 +54,7 @@ class Path {
54
54
diskId = c_str[0 ];
55
55
m_buf = m_disks[diskId & 0x1f ];
56
56
if (m_buf.length ())
57
- m_buf.c_buffer ()[0 ] = c_str[0 ];
57
+ m_buf.data ()[0 ] = c_str[0 ];
58
58
c_str += 2 ;
59
59
}
60
60
@@ -74,7 +74,7 @@ class Path {
74
74
if (is_root || base.empty ())
75
75
base = c_str;
76
76
else {
77
- if (!isWin32PathSlash (base[base.length () - 1 ]))
77
+ if (!isWin32PathSlash (base. c_str () [base.length () - 1 ]))
78
78
base.append (1 , PATH_SLASH_WIN32);
79
79
80
80
base.append (c_str);
@@ -100,7 +100,7 @@ class Path {
100
100
if (isPosixPathSlash (c_str[0 ]) || m_buf.empty ())
101
101
m_buf = other;
102
102
else {
103
- if (!isPosixPathSlash (m_buf[m_buf.length () - 1 ]))
103
+ if (!isPosixPathSlash (m_buf. c_str () [m_buf.length () - 1 ]))
104
104
m_buf.append (1 , PATH_SLASH_POSIX);
105
105
106
106
m_buf.append (other);
@@ -113,13 +113,13 @@ class Path {
113
113
return ;
114
114
115
115
if (m_buf.length () == 0 && other.length () == 2
116
- && isWin32PathSlash (other[0 ]) && isWin32PathSlash (other[1 ])) {
116
+ && isWin32PathSlash (other. c_str () [0 ]) && isWin32PathSlash (other. c_str () [1 ])) {
117
117
m_buf.append (1 , PATH_SLASH_WIN32);
118
118
return ;
119
- } else if (m_buf.length () == 1 && isWin32PathSlash (m_buf[0 ])) {
120
- if (isWin32PathSlash (other[0 ]))
119
+ } else if (m_buf.length () == 1 && isWin32PathSlash (m_buf. c_str () [0 ])) {
120
+ if (isWin32PathSlash (other. c_str () [0 ]))
121
121
m_buf.clear ();
122
- } else if (m_buf.length () > 0 && !isWin32PathSlash (m_buf[m_buf.length () - 1 ]))
122
+ } else if (m_buf.length () > 0 && !isWin32PathSlash (m_buf. c_str () [m_buf.length () - 1 ]))
123
123
m_buf.append (1 , PATH_SLASH_WIN32);
124
124
125
125
m_buf.append (other);
@@ -130,7 +130,7 @@ class Path {
130
130
if (other.empty ())
131
131
return ;
132
132
133
- if (m_buf.length () > 0 && !isPosixPathSlash (m_buf[m_buf.length () - 1 ]))
133
+ if (m_buf.length () > 0 && !isPosixPathSlash (m_buf. c_str () [m_buf.length () - 1 ]))
134
134
m_buf.append (1 , PATH_SLASH_POSIX);
135
135
136
136
m_buf.append (other);
@@ -566,7 +566,7 @@ inline result_t _parse(exlib::string path, obj_ptr<NObject>& retVal)
566
566
return 0 ;
567
567
}
568
568
569
- bool isAbsolute = path[0 ] == CHAR_FORWARD_SLASH;
569
+ bool isAbsolute = path. c_str () [0 ] == CHAR_FORWARD_SLASH;
570
570
int start;
571
571
if (isAbsolute) {
572
572
ret->add (" root" , " /" );
@@ -582,7 +582,7 @@ inline result_t _parse(exlib::string path, obj_ptr<NObject>& retVal)
582
582
int preDotState = 0 ;
583
583
584
584
for (; i >= start; --i) {
585
- int code = path[i];
585
+ int code = path. c_str () [i];
586
586
if (code == CHAR_FORWARD_SLASH) {
587
587
if (!matchedSlash) {
588
588
startPart = i + 1 ;
@@ -637,7 +637,7 @@ inline result_t _parse_win32(exlib::string path, obj_ptr<NObject>& retVal)
637
637
638
638
int len = (int )path.length ();
639
639
int rootEnd = 0 ;
640
- int code = path[0 ];
640
+ int code = path. c_str () [0 ];
641
641
642
642
if (len == 1 ) {
643
643
if (isPathSeparator (code)) {
@@ -653,18 +653,18 @@ inline result_t _parse_win32(exlib::string path, obj_ptr<NObject>& retVal)
653
653
}
654
654
if (isPathSeparator (code)) {
655
655
rootEnd = 1 ;
656
- if (isPathSeparator (path[1 ])) {
656
+ if (isPathSeparator (path. c_str () [1 ])) {
657
657
int j = 2 ;
658
658
int last = j;
659
- while (j < len && !isPathSeparator (path[j]))
659
+ while (j < len && !isPathSeparator (path. c_str () [j]))
660
660
j++;
661
661
if (j < len && j != last) {
662
662
last = j;
663
- while (j < len && isPathSeparator (path[j]))
663
+ while (j < len && isPathSeparator (path. c_str () [j]))
664
664
j++;
665
665
if (j < len && j != last) {
666
666
last = j;
667
- while (j < len && !isPathSeparator (path[j]))
667
+ while (j < len && !isPathSeparator (path. c_str () [j]))
668
668
j++;
669
669
if (j == len)
670
670
rootEnd = j;
@@ -673,7 +673,7 @@ inline result_t _parse_win32(exlib::string path, obj_ptr<NObject>& retVal)
673
673
}
674
674
}
675
675
}
676
- } else if (isWindowsDeviceRoot (code) && path[1 ] == CHAR_COLON) {
676
+ } else if (isWindowsDeviceRoot (code) && path. c_str () [1 ] == CHAR_COLON) {
677
677
if (len <= 2 ) {
678
678
ret->add (" root" , path);
679
679
ret->add (" dir" , path);
@@ -682,7 +682,7 @@ inline result_t _parse_win32(exlib::string path, obj_ptr<NObject>& retVal)
682
682
return 0 ;
683
683
}
684
684
rootEnd = 2 ;
685
- if (isPathSeparator (path[2 ])) {
685
+ if (isPathSeparator (path. c_str () [2 ])) {
686
686
if (len == 3 ) {
687
687
ret->add (" root" , path);
688
688
ret->add (" dir" , path);
@@ -705,7 +705,7 @@ inline result_t _parse_win32(exlib::string path, obj_ptr<NObject>& retVal)
705
705
int preDotState = 0 ;
706
706
707
707
for (; i >= rootEnd; --i) {
708
- code = path[i];
708
+ code = path. c_str () [i];
709
709
if (isPathSeparator (code)) {
710
710
if (!matchedSlash) {
711
711
startPart = i + 1 ;
@@ -902,7 +902,7 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
902
902
// Trim any leading backslashes
903
903
int32_t fromStart = 1 ;
904
904
for (; fromStart < (int32_t )from.length (); ++fromStart) {
905
- if (!isPosixPathSlash (from[fromStart]))
905
+ if (!isPosixPathSlash (from. c_str () [fromStart]))
906
906
break ;
907
907
}
908
908
int32_t fromEnd = (int32_t )from.length ();
@@ -911,7 +911,7 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
911
911
// Trim any leading backslashes
912
912
int32_t toStart = 1 ;
913
913
for (; toStart < (int32_t )to.length (); ++toStart) {
914
- if (!isPosixPathSlash (to[toStart]))
914
+ if (!isPosixPathSlash (to. c_str () [toStart]))
915
915
break ;
916
916
}
917
917
int32_t toEnd = (int32_t )to.length ();
@@ -924,7 +924,7 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
924
924
for (; i <= length; ++i) {
925
925
if (i == length) {
926
926
if (toLen > length) {
927
- if (isPosixPathSlash (to[toStart + i])) {
927
+ if (isPosixPathSlash (to. c_str () [toStart + i])) {
928
928
// We get here if `from` is the exact base path for `to`.
929
929
// For example: from='/foo/bar'; to='/foo/bar/baz'
930
930
return _normalize (to.substr (toStart + i + 1 ), retVal, false );
@@ -935,7 +935,7 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
935
935
}
936
936
937
937
} else if (fromLen > length) {
938
- if (isPosixPathSlash (from[fromStart + i])) {
938
+ if (isPosixPathSlash (from. c_str () [fromStart + i])) {
939
939
// We get here if `to` is the exact base path for `from`.
940
940
// For example: from='/foo/bar/baz'; to='/foo/bar'
941
941
lastCommonSep = i;
@@ -947,8 +947,8 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
947
947
}
948
948
break ;
949
949
}
950
- char fromChar = from[fromStart + i];
951
- char toChar = to[toStart + i];
950
+ char fromChar = from. c_str () [fromStart + i];
951
+ char toChar = to. c_str () [toStart + i];
952
952
if (fromChar != toChar)
953
953
break ;
954
954
else if (isPosixPathSlash (fromChar))
@@ -959,7 +959,7 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
959
959
// Generate the relative path based on the path difference between `to`
960
960
// and `from`
961
961
for (i = fromStart + lastCommonSep + 1 ; i <= fromEnd; ++i) {
962
- if (i == fromEnd || isPosixPathSlash (from[i])) {
962
+ if (i == fromEnd || isPosixPathSlash (from. c_str () [i])) {
963
963
if (out.length () == 0 )
964
964
out += " .." ;
965
965
else
@@ -973,7 +973,7 @@ inline result_t _relative(exlib::string from, exlib::string to, exlib::string& r
973
973
return _normalize (out + to.substr (toStart + lastCommonSep), retVal, false );
974
974
} else {
975
975
toStart += lastCommonSep;
976
- if (isPosixPathSlash (to[toStart]))
976
+ if (isPosixPathSlash (to. c_str () [toStart]))
977
977
++toStart;
978
978
979
979
return _normalize (to.substr (toStart), retVal, false );
@@ -1004,37 +1004,37 @@ inline result_t _relative_win32(exlib::string from, exlib::string to, exlib::str
1004
1004
return 0 ;
1005
1005
1006
1006
from = " " + fromOrig;
1007
- from. tolower ( );
1007
+ exlib::qstrlwr (from );
1008
1008
to = " " + toOrig;
1009
- to. tolower ( );
1009
+ exlib::qstrlwr (to );
1010
1010
1011
1011
if (from == to)
1012
1012
return 0 ;
1013
1013
1014
1014
// Trim any leading backslashes
1015
1015
int32_t fromStart = 0 ;
1016
1016
for (; fromStart < (int32_t )from.length (); ++fromStart) {
1017
- if (!isWin32PathSlash (from[fromStart]))
1017
+ if (!isWin32PathSlash (from. c_str () [fromStart]))
1018
1018
break ;
1019
1019
}
1020
1020
// Trim trailing backslashes (applicable to UNC paths only)
1021
1021
int32_t fromEnd = (int32_t )from.length ();
1022
1022
for (; fromEnd - 1 > fromStart; --fromEnd) {
1023
- if (!isWin32PathSlash (from[fromEnd - 1 ]))
1023
+ if (!isWin32PathSlash (from. c_str () [fromEnd - 1 ]))
1024
1024
break ;
1025
1025
}
1026
1026
int32_t fromLen = (fromEnd - fromStart);
1027
1027
1028
1028
// Trim any leading backslashes
1029
1029
int32_t toStart = 0 ;
1030
1030
for (; toStart < (int32_t )to.length (); ++toStart) {
1031
- if (!isWin32PathSlash (to[toStart]))
1031
+ if (!isWin32PathSlash (to. c_str () [toStart]))
1032
1032
break ;
1033
1033
}
1034
1034
// Trim trailing backslashes (applicable to UNC paths only)
1035
1035
int32_t toEnd = (int32_t )to.length ();
1036
1036
for (; toEnd - 1 > toStart; --toEnd) {
1037
- if (!isWin32PathSlash (to[toEnd - 1 ]))
1037
+ if (!isWin32PathSlash (to. c_str () [toEnd - 1 ]))
1038
1038
break ;
1039
1039
}
1040
1040
int32_t toLen = (toEnd - toStart);
@@ -1046,7 +1046,7 @@ inline result_t _relative_win32(exlib::string from, exlib::string to, exlib::str
1046
1046
for (; i <= length; ++i) {
1047
1047
if (i == length) {
1048
1048
if (toLen > length) {
1049
- if (isWin32PathSlash (to[toStart + i])) {
1049
+ if (isWin32PathSlash (to. c_str () [toStart + i])) {
1050
1050
// We get here if `from` is the exact base path for `to`.
1051
1051
// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
1052
1052
return _normalize_win32 (toOrig.substr (toStart + i + 1 ), retVal, true );
@@ -1057,7 +1057,7 @@ inline result_t _relative_win32(exlib::string from, exlib::string to, exlib::str
1057
1057
}
1058
1058
}
1059
1059
if (fromLen > length) {
1060
- if (isWin32PathSlash (from[fromStart + i])) {
1060
+ if (isWin32PathSlash (from. c_str () [fromStart + i])) {
1061
1061
// We get here if `to` is the exact base path for `from`.
1062
1062
// For example: from='C:\\foo\\bar'; to='C:\\foo'
1063
1063
lastCommonSep = i;
@@ -1069,8 +1069,8 @@ inline result_t _relative_win32(exlib::string from, exlib::string to, exlib::str
1069
1069
}
1070
1070
break ;
1071
1071
}
1072
- char fromChar = from[fromStart + i];
1073
- char toChar = to[toStart + i];
1072
+ char fromChar = from. c_str () [fromStart + i];
1073
+ char toChar = to. c_str () [toStart + i];
1074
1074
if (fromChar != toChar)
1075
1075
break ;
1076
1076
else if (isWin32PathSlash (fromChar))
@@ -1089,7 +1089,7 @@ inline result_t _relative_win32(exlib::string from, exlib::string to, exlib::str
1089
1089
// Generate the relative path based on the path difference between `to` and
1090
1090
// `from`
1091
1091
for (i = fromStart + lastCommonSep + 1 ; i <= fromEnd; ++i) {
1092
- if (i == fromEnd || isWin32PathSlash (from[i])) {
1092
+ if (i == fromEnd || isWin32PathSlash (from. c_str () [i])) {
1093
1093
if (out.length () == 0 )
1094
1094
out += " .." ;
1095
1095
else
@@ -1103,7 +1103,7 @@ inline result_t _relative_win32(exlib::string from, exlib::string to, exlib::str
1103
1103
return _normalize_win32 (out + toOrig.substr (toStart + lastCommonSep), retVal, true );
1104
1104
} else {
1105
1105
toStart += lastCommonSep;
1106
- if (isWin32PathSlash (toOrig[toStart]))
1106
+ if (isWin32PathSlash (toOrig. c_str () [toStart]))
1107
1107
++toStart;
1108
1108
return _normalize_win32 (toOrig.substr (toStart), retVal, true );
1109
1109
}
@@ -1123,7 +1123,7 @@ inline result_t _delimiter(exlib::string& retVal)
1123
1123
1124
1124
inline result_t _fullpath (exlib::string path, exlib::string& retVal)
1125
1125
{
1126
- if (isPathSlash (path[0 ]))
1126
+ if (isPathSlash (path. c_str () [0 ]))
1127
1127
return _normalize (path, retVal);
1128
1128
1129
1129
exlib::string str;
0 commit comments