Eio: fix shadow var warnings and make it compile on Windows. Needs more love though

SVN revision: 69809
This commit is contained in:
Vincent Torri 2012-03-31 06:30:08 +00:00
parent dce9e934a2
commit 71f42dcebc
5 changed files with 57 additions and 25 deletions

View File

@ -83,12 +83,12 @@ _eio_file_recursiv_ls(Ecore_Thread *thread,
EINA_ITERATOR_FOREACH(it, info)
{
Eina_Bool filter = EINA_TRUE;
struct stat buffer;
_eio_stat_t buffer;
switch (info->type)
{
case EINA_FILE_DIR:
if (lstat(info->path, &buffer) != 0)
if (_eio_lstat(info->path, &buffer) != 0)
goto on_error;
if (S_ISLNK(buffer.st_mode))
@ -683,16 +683,16 @@ _eio_dir_stat_find_forward(Eio_File_Dir_Ls *async,
if (filter)
{
Eio_File_Direct_Info *send;
Eio_File_Direct_Info *send_di;
send = eio_direct_info_malloc();
if (!send) return EINA_FALSE;
send_di = eio_direct_info_malloc();
if (!send_di) return EINA_FALSE;
memcpy(&send->info, info, sizeof (Eina_File_Direct_Info));
send->associated = async->ls.common.worker.associated;
memcpy(&send_di->info, info, sizeof (Eina_File_Direct_Info));
send_di->associated = async->ls.common.worker.associated;
async->ls.common.worker.associated = NULL;
async->pack = eina_list_append(async->pack, send);
async->pack = eina_list_append(async->pack, send_di);
}
else if (async->ls.common.worker.associated)
{

View File

@ -65,16 +65,16 @@ _eio_file_heavy(void *data, Ecore_Thread *thread)
if (filter)
{
Eio_File_Char *send;
Eio_File_Char *send_fc;
send = eio_char_malloc();
if (!send) goto on_error;
send_fc = eio_char_malloc();
if (!send_fc) goto on_error;
send->filename = file;
send->associated = async->ls.common.worker.associated;
send_fc->filename = file;
send_fc->associated = async->ls.common.worker.associated;
async->ls.common.worker.associated = NULL;
pack = eina_list_append(pack, send);
pack = eina_list_append(pack, send_fc);
}
else
{
@ -161,16 +161,16 @@ _eio_file_eina_ls_heavy(Ecore_Thread *thread, Eio_File_Direct_Ls *async, Eina_It
if (filter)
{
Eio_File_Direct_Info *send;
Eio_File_Direct_Info *send_di;
send = eio_direct_info_malloc();
if (!send) continue;
send_di = eio_direct_info_malloc();
if (!send_di) continue;
memcpy(&send->info, info, sizeof (Eina_File_Direct_Info));
send->associated = async->ls.common.worker.associated;
memcpy(&send_di->info, info, sizeof (Eina_File_Direct_Info));
send_di->associated = async->ls.common.worker.associated;
async->ls.common.worker.associated = NULL;
pack = eina_list_append(pack, send);
pack = eina_list_append(pack, send_di);
}
else if (async->ls.common.worker.associated)
{

View File

@ -74,7 +74,7 @@ _eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread *thread)
Eina_Iterator *it;
Eina_Stat *est;
Eina_File_Direct_Info *info;
struct stat st;
_eio_stat_t st;
/* FIXME : copy ecore_file_monitor_poll here */
if (!backend->initialised)
@ -85,7 +85,7 @@ _eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread *thread)
if (!backend->parent)
return ;
if (stat(backend->parent->path, &st))
if (_eio_stat(backend->parent->path, &st))
{
if (backend->initialised && !backend->destroyed)
{
@ -107,8 +107,13 @@ _eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread *thread)
est->gid = st.st_gid;
est->rdev = st.st_rdev;
est->size = st.st_size;
#ifdef _WIN32
est->blksize = 0;
est->blocks = 0;
#else
est->blksize = st.st_blksize;
est->blocks = st.st_blocks;
#endif
est->atime = st.st_atime;
est->mtime = st.st_mtime;
est->ctime = st.st_ctime;

View File

@ -64,10 +64,24 @@
# undef WIN32_LEAN_AND_MEAN
#endif
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include <Ecore.h>
#include "Eio.h"
#ifdef _WIN32
typedef struct __stat64 _eio_stat_t;
#define _eio_stat(p, b) _stat64(p, b)
#define _eio_lstat(p, b) _stat64(p, b)
#else
typedef struct stat _eio_stat_t;
#define _eio_stat(p, b) stat(p, b)
#define _eio_lstat(p, b) lstat(p, b)
#endif
/* Keeping 32 Eio_File_Progress alive should be enought */
#define EIO_PROGRESS_LIMIT 32

View File

@ -102,7 +102,7 @@ _eio_file_unlink_error(void *data, Ecore_Thread *thread __UNUSED__)
}
static void
_eio_file_struct_2_eina(Eina_Stat *es, struct stat *st)
_eio_file_struct_2_eina(Eina_Stat *es, _eio_stat_t *st)
{
es->dev = st->st_dev;
es->ino = st->st_ino;
@ -112,8 +112,13 @@ _eio_file_struct_2_eina(Eina_Stat *es, struct stat *st)
es->gid = st->st_gid;
es->rdev = st->st_rdev;
es->size = st->st_size;
#ifdef _WIN32
es->blksize = 0;
es->blocks = 0;
#else
es->blksize = st->st_blksize;
es->blocks = st->st_blocks;
#endif
es->atime = st->st_atime;
es->mtime = st->st_mtime;
es->ctime = st->st_ctime;
@ -138,9 +143,9 @@ static void
_eio_file_stat(void *data, Ecore_Thread *thread)
{
Eio_File_Stat *s = data;
struct stat buf;
_eio_stat_t buf;
if (stat(s->path, &buf) != 0)
if (_eio_stat(s->path, &buf) != 0)
eio_file_thread_error(&s->common, thread);
_eio_file_struct_2_eina(&s->buffer, &buf);
@ -199,6 +204,13 @@ _eio_file_chmod(void *data, Ecore_Thread *thread)
static void
_eio_file_chown(void *data, Ecore_Thread *thread)
{
#ifdef _WIN32
/* FIXME:
* look at http://wwwthep.physik.uni-mainz.de/~frink/chown/readme.html
*/
(void)data;
(void)thread;
#else
Eio_File_Chown *own = data;
char *tmp;
uid_t owner = -1;
@ -251,6 +263,7 @@ _eio_file_chown(void *data, Ecore_Thread *thread)
on_error:
ecore_thread_cancel(thread);
return ;
#endif
}
static void