@@ -1062,7 +1062,7 @@ checkShebang(SearchInfo *search)
10621062 }
10631063
10641064 DWORD bytesRead = 0 ;
1065- char buffer [4096 ];
1065+ unsigned char buffer [4096 ];
10661066 if (!ReadFile (hFile , buffer , sizeof (buffer ), & bytesRead , NULL )) {
10671067 debug (L"# Failed to read %s for shebang parsing (0x%08X)\n" ,
10681068 scriptFile , GetLastError ());
@@ -1075,7 +1075,7 @@ checkShebang(SearchInfo *search)
10751075 free (scriptFile );
10761076
10771077
1078- char * b = buffer ;
1078+ unsigned char * b = buffer ;
10791079 bool onlyUtf8 = false;
10801080 if (bytesRead > 3 && * b == 0xEF ) {
10811081 if (* ++ b == 0xBB && * ++ b == 0xBF ) {
@@ -1096,13 +1096,13 @@ checkShebang(SearchInfo *search)
10961096 ++ b ;
10971097 -- bytesRead ;
10981098 while (-- bytesRead > 0 && isspace (* ++ b )) { }
1099- char * start = b ;
1099+ const unsigned char * start = b ;
11001100 while (-- bytesRead > 0 && * ++ b != '\r' && * b != '\n' ) { }
11011101 wchar_t * shebang ;
11021102 int shebangLength ;
11031103 // We add 1 when bytesRead==0, as in that case we hit EOF and b points
11041104 // to the last character in the file, not the newline
1105- int exitCode = _decodeShebang (search , start , (int )(b - start + (bytesRead == 0 )), onlyUtf8 , & shebang , & shebangLength );
1105+ int exitCode = _decodeShebang (search , ( const char * ) start , (int )(b - start + (bytesRead == 0 )), onlyUtf8 , & shebang , & shebangLength );
11061106 if (exitCode ) {
11071107 return exitCode ;
11081108 }
0 commit comments