pike.git / src / modules / _Stdio / efuns.c

version» Context lines:

pike.git/src/modules/_Stdio/efuns.c:547: Inside #if defined(__NT__)
   */   #ifdef __NT__      void f_filesystem_stat( INT32 args )   {    char *path;    DWORD sectors_per_cluster = -1;    DWORD bytes_per_sector = -1;    DWORD free_clusters = -1;    DWORD total_clusters = -1; +  p_wchar1 *root;    char _p[4];    char *p = _p;    unsigned int free_sectors;    unsigned int total_sectors;       VALID_FILE_IO("filesystem_stat","read");    -  +  f_string_to_utf8(args); +  args = 1; +     get_all_args( "filesystem_stat", args, "%s", &path );    -  if(sp[-1].u.string->len < 2 || path[1] != ':') -  { -  p = 0; +  root = pike_dwim_utf8_to_utf16(path); +  if (root[0] && root[1] == ':') { +  root[2] = '\\'; +  root[3] = 0;    } else { -  p[0] = path[0]; -  p[1] = ':'; -  p[2] = '\\'; -  p[3] = 0; +  free(root); +  root = NULL;    }    -  if(!GetDiskFreeSpace( p, &sectors_per_cluster, +  if(!GetDiskFreeSpaceW( root, &sectors_per_cluster,    &bytes_per_sector,    &free_clusters,    &total_clusters ))    { -  +  if (root) free(root);    pop_n_elems(args);    push_int( 0 );    return;    }    -  +  if (root) free(root); +     free_sectors = sectors_per_cluster * free_clusters;    total_sectors = sectors_per_cluster * total_clusters;       pop_n_elems( args );    push_text("blocksize");    push_int(bytes_per_sector);    push_text("blocks");    push_int(total_sectors);    push_text("bfree");    push_int(free_sectors);