1313#else
1414# include < unistd.h>
1515#endif
16- #include < cctype>
1716#include < cstdio>
1817#include < vector>
1918#include < algorithm>
2524#include " sass_functions.hpp"
2625#include " error_handling.hpp"
2726#include " util.hpp"
27+ #include " util_string.hpp"
2828#include " sass2scss.h"
2929
3030#ifdef _WIN32
@@ -106,13 +106,13 @@ namespace Sass {
106106 bool is_absolute_path (const std::string& path)
107107 {
108108 #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 ;
110110 #endif
111111 size_t i = 0 ;
112112 // 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]) )) {
114114 // 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;
116116 i = i && path[i] == ' :' ? i + 1 : 0 ;
117117 }
118118 return path[i] == ' /' ;
@@ -179,9 +179,9 @@ namespace Sass {
179179
180180 size_t proto = 0 ;
181181 // 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]) )) {
183183 // 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++]) )) {}
185185 // then skip over the mandatory colon
186186 if (proto && path[proto] == ' :' ) ++ proto;
187187 }
@@ -260,9 +260,9 @@ namespace Sass {
260260
261261 size_t proto = 0 ;
262262 // 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]) )) {
264264 // 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++]) )) {}
266266 // then skip over the mandatory colon
267267 if (proto && path[proto] == ' :' ) ++ proto;
268268 }
@@ -288,7 +288,8 @@ namespace Sass {
288288 #else
289289 // compare the charactes in a case insensitive manner
290290 // 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 ;
292293 #endif
293294 if (abs_path[i] == ' /' ) index = i + 1 ;
294295 }
@@ -488,8 +489,7 @@ namespace Sass {
488489 if (path.length () > 5 ) {
489490 extension = path.substr (path.length () - 5 , 5 );
490491 }
491- for (size_t i=0 ; i<extension.size ();++i)
492- extension[i] = tolower (extension[i]);
492+ Util::ascii_str_tolower (&extension);
493493 if (extension == " .sass" && contents != 0 ) {
494494 char * converted = sass2scss (contents, SASS2SCSS_PRETTIFY_1 | SASS2SCSS_KEEP_COMMENT);
495495 free (contents); // free the indented contents
0 commit comments