2
0
Эх сурвалжийг харах

Merge branch 'master' of https://github.com/scullion/stb

Sean Barrett 10 жил өмнө
parent
commit
50edcdb972
1 өөрчлөгдсөн 11 нэмэгдсэн , 11 устгасан
  1. 11 11
      stb.h

+ 11 - 11
stb.h

@@ -851,7 +851,7 @@ void stbprint(const char *fmt, ...)
 
 
 
 
 #ifdef _WIN32
 #ifdef _WIN32
-   #define stb__fopen(x,y)    _wfopen(stb__from_utf8(x), stb__from_utf8_alt(y))
+   #define stb__fopen(x,y)    _wfopen((const wchar_t *)stb__from_utf8(x), (const wchar_t *)stb__from_utf8_alt(y))
    #define stb__windows(x,y)  x
    #define stb__windows(x,y)  x
 #else
 #else
    #define stb__fopen(x,y)    fopen(x,y)
    #define stb__fopen(x,y)    fopen(x,y)
@@ -4913,7 +4913,7 @@ void stb_nptr_recache(void)
 
 
 
 
 #ifdef _MSC_VER
 #ifdef _MSC_VER
-  #define stb_rename(x,y)   _wrename(stb__from_utf8(x), stb__from_utf8_alt(y))
+  #define stb_rename(x,y)   _wrename((const wchar_t *)stb__from_utf8(x), (const wchar_t *)stb__from_utf8_alt(y))
   #define stb_mktemp   _mktemp
   #define stb_mktemp   _mktemp
 #else
 #else
   #define stb_mktemp   mktemp
   #define stb_mktemp   mktemp
@@ -5052,7 +5052,7 @@ int stb_fexists(char *filename)
 {
 {
    struct stb__stat buf;
    struct stb__stat buf;
    return stb__windows(
    return stb__windows(
-             _wstat(stb__from_utf8(filename), &buf),
+             _wstat((const wchar_t *)stb__from_utf8(filename), &buf),
                stat(filename,&buf)
                stat(filename,&buf)
           ) == 0;
           ) == 0;
 }
 }
@@ -5061,7 +5061,7 @@ time_t stb_ftimestamp(char *filename)
 {
 {
    struct stb__stat buf;
    struct stb__stat buf;
    if (stb__windows(
    if (stb__windows(
-             _wstat(stb__from_utf8(filename), &buf),
+             _wstat((const wchar_t *)stb__from_utf8(filename), &buf),
                stat(filename,&buf)
                stat(filename,&buf)
           ) == 0)
           ) == 0)
    {
    {
@@ -5843,7 +5843,7 @@ static char **readdir_raw(char *dir, int return_subdirs, char *mask)
    #ifdef _MSC_VER
    #ifdef _MSC_VER
       strcpy(buffer+n, "*.*");
       strcpy(buffer+n, "*.*");
       ws = stb__from_utf8(buffer);
       ws = stb__from_utf8(buffer);
-      z = _wfindfirst(ws, &data);
+      z = _wfindfirst((const wchar_t *)ws, &data);
    #else
    #else
       z = opendir(dir);
       z = opendir(dir);
    #endif
    #endif
@@ -5861,7 +5861,7 @@ static char **readdir_raw(char *dir, int return_subdirs, char *mask)
          do {
          do {
             int is_subdir;
             int is_subdir;
             #ifdef _MSC_VER
             #ifdef _MSC_VER
-            char *name = stb__to_utf8(data.name);
+            char *name = stb__to_utf8((stb__wchar *)data.name);
             if (name == NULL) {
             if (name == NULL) {
                fprintf(stderr, "%s to convert '%S' to %s!\n", "Unable", data.name, "utf8");
                fprintf(stderr, "%s to convert '%S' to %s!\n", "Unable", data.name, "utf8");
                continue;
                continue;
@@ -6805,9 +6805,9 @@ static void stb__dirtree_scandir(char *path, time_t last_time, stb_dirtree *acti
 
 
    has_slash = (path[0] && path[strlen(path)-1] == '/'); 
    has_slash = (path[0] && path[strlen(path)-1] == '/'); 
    if (has_slash)
    if (has_slash)
-      swprintf(full_path, L"%s*", stb__from_utf8(path));
+      swprintf((wchar_t *)full_path, L"%s*", stb__from_utf8(path));
    else
    else
-      swprintf(full_path, L"%s/*", stb__from_utf8(path));
+      swprintf((wchar_t *)full_path, L"%s/*", stb__from_utf8(path));
 
 
    // it's possible this directory is already present: that means it was in the
    // it's possible this directory is already present: that means it was in the
    // cache, but its parent wasn't... in that case, we're done with it
    // cache, but its parent wasn't... in that case, we're done with it
@@ -6819,13 +6819,13 @@ static void stb__dirtree_scandir(char *path, time_t last_time, stb_dirtree *acti
    stb__dirtree_add_dir(path, last_time, active);
    stb__dirtree_add_dir(path, last_time, active);
    n = stb_arr_lastn(active->dirs);
    n = stb_arr_lastn(active->dirs);
 
 
-   if( (hFile = _wfindfirst( full_path, &c_file )) != -1L ) {
+   if( (hFile = _wfindfirst((const wchar_t *)full_path, &c_file )) != -1L ) {
       do {
       do {
          if (c_file.attrib & _A_SUBDIR) {
          if (c_file.attrib & _A_SUBDIR) {
             // ignore subdirectories starting with '.', e.g. "." and ".."
             // ignore subdirectories starting with '.', e.g. "." and ".."
             if (c_file.name[0] != '.') {
             if (c_file.name[0] != '.') {
                char *new_path = (char *) full_path;
                char *new_path = (char *) full_path;
-               char *temp = stb__to_utf8(c_file.name);
+               char *temp = stb__to_utf8((stb__wchar *)c_file.name);
                if (has_slash)
                if (has_slash)
                   sprintf(new_path, "%s%s", path, temp);
                   sprintf(new_path, "%s%s", path, temp);
                else
                else
@@ -6833,7 +6833,7 @@ static void stb__dirtree_scandir(char *path, time_t last_time, stb_dirtree *acti
                stb__dirtree_scandir(new_path, c_file.time_write, active);
                stb__dirtree_scandir(new_path, c_file.time_write, active);
             }
             }
          } else {
          } else {
-            char *temp = stb__to_utf8(c_file.name);
+            char *temp = stb__to_utf8((stb__wchar *)c_file.name);
             stb__dirtree_add_file(temp, n, c_file.size, c_file.time_write, active);
             stb__dirtree_add_file(temp, n, c_file.size, c_file.time_write, active);
          }
          }
       } while( _wfindnext( hFile, &c_file ) == 0 );
       } while( _wfindnext( hFile, &c_file ) == 0 );