13
13
#else
14
14
# include < unistd.h>
15
15
#endif
16
- #include < cctype>
17
16
#include < cstdio>
18
17
#include < vector>
19
18
#include < algorithm>
25
24
#include " sass_functions.hpp"
26
25
#include " error_handling.hpp"
27
26
#include " util.hpp"
27
+ #include " util_string.hpp"
28
28
#include " sass2scss.h"
29
29
30
30
#ifdef _WIN32
@@ -106,13 +106,13 @@ namespace Sass {
106
106
bool is_absolute_path (const std::string& path)
107
107
{
108
108
#ifdef _WIN32
109
- if (path.length () >= 2 && isalpha (path[0 ]) && path[1 ] == ' :' ) return true ;
109
+ if (path.length () >= 2 && Util::ascii_isalpha (path[0 ]) && path[1 ] == ' :' ) return true ;
110
110
#endif
111
111
size_t i = 0 ;
112
112
// check if we have a protocol
113
- if (path[i] && Prelexer::is_alpha ( path[i])) {
113
+ if (path[i] && Util::ascii_isalpha ( static_cast < unsigned char >( path[i]) )) {
114
114
// skip over all alphanumeric characters
115
- while (path[i] && Prelexer::is_alnum ( path[i])) ++i;
115
+ while (path[i] && Util::ascii_isalnum ( static_cast < unsigned char >( path[i]) )) ++i;
116
116
i = i && path[i] == ' :' ? i + 1 : 0 ;
117
117
}
118
118
return path[i] == ' /' ;
@@ -179,9 +179,9 @@ namespace Sass {
179
179
180
180
size_t proto = 0 ;
181
181
// check if we have a protocol
182
- if (path[proto] && Prelexer::is_alpha ( path[proto])) {
182
+ if (path[proto] && Util::ascii_isalpha ( static_cast < unsigned char >( path[proto]) )) {
183
183
// skip over all alphanumeric characters
184
- while (path[proto] && Prelexer::is_alnum ( path[proto++])) {}
184
+ while (path[proto] && Util::ascii_isalnum ( static_cast < unsigned char >( path[proto++]) )) {}
185
185
// then skip over the mandatory colon
186
186
if (proto && path[proto] == ' :' ) ++ proto;
187
187
}
@@ -260,9 +260,9 @@ namespace Sass {
260
260
261
261
size_t proto = 0 ;
262
262
// check if we have a protocol
263
- if (path[proto] && Prelexer::is_alpha ( path[proto])) {
263
+ if (path[proto] && Util::ascii_isalpha ( static_cast < unsigned char >( path[proto]) )) {
264
264
// skip over all alphanumeric characters
265
- while (path[proto] && Prelexer::is_alnum ( path[proto++])) {}
265
+ while (path[proto] && Util::ascii_isalnum ( static_cast < unsigned char >( path[proto++]) )) {}
266
266
// then skip over the mandatory colon
267
267
if (proto && path[proto] == ' :' ) ++ proto;
268
268
}
@@ -288,7 +288,8 @@ namespace Sass {
288
288
#else
289
289
// compare the charactes in a case insensitive manner
290
290
// windows fs is only case insensitive in ascii ranges
291
- if (tolower (abs_path[i]) != tolower (abs_base[i])) break ;
291
+ if (Util::ascii_tolower (static_cast <unsigned char >(abs_path[i])) !=
292
+ Util::ascii_tolower (static_cast <unsigned char >(abs_base[i]))) break ;
292
293
#endif
293
294
if (abs_path[i] == ' /' ) index = i + 1 ;
294
295
}
@@ -488,8 +489,7 @@ namespace Sass {
488
489
if (path.length () > 5 ) {
489
490
extension = path.substr (path.length () - 5 , 5 );
490
491
}
491
- for (size_t i=0 ; i<extension.size ();++i)
492
- extension[i] = tolower (extension[i]);
492
+ Util::ascii_str_tolower (&extension);
493
493
if (extension == " .sass" && contents != 0 ) {
494
494
char * converted = sass2scss (contents, SASS2SCSS_PRETTIFY_1 | SASS2SCSS_KEEP_COMMENT);
495
495
free (contents); // free the indented contents
0 commit comments