Support This Project

Changeset 1970

Show
Ignore:
Timestamp:
03/21/08 06:48:15 (10 months ago)
Author:
virdiq
Message:

Fix types for MultiByteToWideChar?. Thanks to JGS again for this one.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libwzd-core/wzd_fs.c

    r1928 r1970  
    9292#else 
    9393  { 
    94     size_t sz; 
     94    int sz; 
    9595    wchar_t * dstname; 
    9696 
     
    9898      return -1; 
    9999 
    100     sz = MultiByteToWideChar(CP_UTF8, 0, pathname, strlen(pathname)+1, NULL, 0); 
     100    sz = MultiByteToWideChar(CP_UTF8, 0, pathname, (int)strlen(pathname)+1, NULL, 0); 
    101101    if (sz <= 0) return -1; 
    102102 
    103     dstname = malloc(sz * sizeof(wchar_t) + 1); 
    104  
    105     ret = MultiByteToWideChar(CP_UTF8, 0, pathname, strlen(pathname)+1, dstname, sz); 
     103    dstname = malloc((size_t)sz * sizeof(wchar_t) + 1); 
     104 
     105    ret = MultiByteToWideChar(CP_UTF8, 0, pathname, (int)strlen(pathname)+1, dstname, sz); 
    106106 
    107107    if (ret <= 0) { free(dstname); return -1; } 
     
    123123int fs_dir_open(const char * pathname, fs_dir_t ** newdir) 
    124124{ 
    125   int len; 
     125  size_t len; 
    126126 
    127127  *newdir = wzd_malloc(sizeof(fs_dir_t)); 
     
    177177#ifdef WIN32 
    178178  int ret; 
    179   size_t sz; 
     179  int sz; 
    180180 
    181181  if (dir->handle == NULL) { 
    182     size_t sz; 
    183182    wchar_t * dstname, * eos; 
    184183 
    185     sz = MultiByteToWideChar(CP_UTF8, 0, dir->dirname, strlen(dir->dirname)+1, NULL, 0); 
     184    sz = MultiByteToWideChar(CP_UTF8, 0, dir->dirname, (int)strlen(dir->dirname)+1, NULL, 0); 
    186185    if (sz <= 0) return -1; 
    187186 
    188     dstname = malloc(sz * sizeof(wchar_t) + 3); 
    189  
    190     ret = MultiByteToWideChar(CP_UTF8, 0, dir->dirname, strlen(dir->dirname)+1, dstname, sz); 
     187    dstname = malloc((size_t)sz * sizeof(wchar_t) + 3); 
     188 
     189    ret = MultiByteToWideChar(CP_UTF8, 0, dir->dirname, (int)strlen(dir->dirname)+1, dstname, sz); 
    191190 
    192191    if (ret <= 0) { free(dstname); return -1; } 
     
    210209  } 
    211210 
    212   sz = WideCharToMultiByte(CP_UTF8, 0, dir->entry.cFileName, wcslen(dir->entry.cFileName)+1, NULL, 0, NULL, NULL); 
     211  sz = WideCharToMultiByte(CP_UTF8, 0, dir->entry.cFileName, (int)wcslen(dir->entry.cFileName)+1, NULL, 0, NULL, NULL); 
    213212  if (sz <= 0) return -1; 
    214213 
    215   filename = wzd_malloc(sz + 2); 
    216  
    217   ret = WideCharToMultiByte(CP_UTF8, 0, dir->entry.cFileName, wcslen(dir->entry.cFileName)+1, filename, sz, NULL, NULL); 
     214  filename = wzd_malloc((size_t)sz + 2); 
     215 
     216  ret = WideCharToMultiByte(CP_UTF8, 0, dir->entry.cFileName, (int)wcslen(dir->entry.cFileName)+1, filename, sz, NULL, NULL); 
    218217 
    219218  dir->finfo.wname = dir->entry.cFileName; 
     
    273272    struct _stati64 st; 
    274273    wchar_t * wbuffer; 
    275     size_t sz; 
     274    int sz; 
    276275    int ret; 
    277276 
    278     sz = MultiByteToWideChar(CP_UTF8, 0, pathname, strlen(pathname)+1, NULL, 0); 
     277    sz = MultiByteToWideChar(CP_UTF8, 0, pathname, (int)strlen(pathname)+1, NULL, 0); 
    279278    if (sz <= 0) return -1; 
    280279 
    281     wbuffer = malloc(sz * sizeof(wchar_t) + 5); 
    282  
    283     ret = MultiByteToWideChar(CP_UTF8, 0, pathname, strlen(pathname)+1, wbuffer, sz); 
     280    wbuffer = malloc((size_t)sz * sizeof(wchar_t) + 5); 
     281 
     282    ret = MultiByteToWideChar(CP_UTF8, 0, pathname, (int)strlen(pathname)+1, wbuffer, sz); 
    284283    if (ret <= 0) { free(wbuffer); return -1; } 
    285284 
     
    330329    struct _stati64 st; 
    331330    wchar_t * wbuffer; 
    332     size_t sz; 
     331    int sz; 
    333332    int ret; 
    334333 
    335     sz = MultiByteToWideChar(CP_UTF8, 0, pathname, strlen(pathname)+1, NULL, 0); 
     334    sz = MultiByteToWideChar(CP_UTF8, 0, pathname, (int)strlen(pathname)+1, NULL, 0); 
    336335    if (sz <= 0) return -1; 
    337336 
    338     wbuffer = malloc(sz * sizeof(wchar_t) + 5); 
    339  
    340     ret = MultiByteToWideChar(CP_UTF8, 0, pathname, strlen(pathname)+1, wbuffer, sz); 
     337    wbuffer = malloc((size_t)sz * sizeof(wchar_t) + 5); 
     338 
     339    ret = MultiByteToWideChar(CP_UTF8, 0, pathname, (int)strlen(pathname)+1, wbuffer, sz); 
    341340    if (ret <= 0) { free(wbuffer); return -1; } 
    342341 
     
    362361/** \brief Get informations on file 
    363362 */ 
    364 int fs_file_fstat(int fd, fs_filestat_t * s) 
     363int fs_file_fstat(fd_t file, fs_filestat_t * s) 
    365364{ 
    366365#ifndef WIN32 
     
    368367    struct stat st; 
    369368 
    370     if (!fstat(fd,&st)) { 
     369    if (!fstat(file,&st)) { 
    371370      if (s) { 
    372371        s->size = (u64_t)st.st_size; 
     
    384383    struct _stati64 st; 
    385384 
    386     if (!_fstati64(fd,&st)) { 
     385    if (!_fstati64(file,&st)) { 
    387386      if (s) { 
    388387        s->size = st.st_size; 
  • trunk/libwzd-core/wzd_fs.h

    r1253 r1970  
    8282/** \brief Get informations on file 
    8383 */ 
    84 int fs_file_fstat(int fd, fs_filestat_t * s); 
     84int fs_file_fstat(fd_t file, fs_filestat_t * s); 
    8585 
    8686