mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-16 00:22:29 -05:00
killed a warning
properly indented some code git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3389 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
52eccba052
commit
11d9ecbc10
1 changed files with 70 additions and 70 deletions
|
|
@ -36,124 +36,124 @@
|
||||||
#define SIMULATOR_ARCHOS_ROOT "archos"
|
#define SIMULATOR_ARCHOS_ROOT "archos"
|
||||||
|
|
||||||
struct mydir {
|
struct mydir {
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct mydir MYDIR;
|
typedef struct mydir MYDIR;
|
||||||
|
|
||||||
MYDIR *x11_opendir(char *name)
|
MYDIR *x11_opendir(char *name)
|
||||||
{
|
{
|
||||||
char buffer[256]; /* sufficiently big */
|
char buffer[256]; /* sufficiently big */
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
|
||||||
if(name[0] == '/') {
|
if(name[0] == '/') {
|
||||||
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
||||||
dir=(DIR *)opendir(buffer);
|
dir=(DIR *)opendir(buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dir=(DIR *)opendir(name);
|
dir=(DIR *)opendir(name);
|
||||||
|
|
||||||
if(dir) {
|
if(dir) {
|
||||||
MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR));
|
MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR));
|
||||||
my->dir = dir;
|
my->dir = dir;
|
||||||
my->name = (char *)strdup(name);
|
my->name = (char *)strdup(name);
|
||||||
|
|
||||||
return my;
|
return my;
|
||||||
}
|
}
|
||||||
/* failed open, return NULL */
|
/* failed open, return NULL */
|
||||||
return (MYDIR *)0;
|
return (MYDIR *)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct x11_dirent *x11_readdir(MYDIR *dir)
|
struct x11_dirent *x11_readdir(MYDIR *dir)
|
||||||
{
|
{
|
||||||
char buffer[512]; /* sufficiently big */
|
char buffer[512]; /* sufficiently big */
|
||||||
static struct x11_dirent secret;
|
static struct x11_dirent secret;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
struct dirent *x11 = (readdir)(dir->dir);
|
struct dirent *x11 = (readdir)(dir->dir);
|
||||||
|
|
||||||
if(!x11)
|
if(!x11)
|
||||||
return (struct x11_dirent *)0;
|
return (struct x11_dirent *)0;
|
||||||
|
|
||||||
strcpy(secret.d_name, x11->d_name);
|
strcpy(secret.d_name, x11->d_name);
|
||||||
|
|
||||||
/* build file name */
|
/* build file name */
|
||||||
sprintf(buffer, SIMULATOR_ARCHOS_ROOT "%s/%s",
|
sprintf(buffer, SIMULATOR_ARCHOS_ROOT "%s/%s",
|
||||||
dir->name, x11->d_name);
|
dir->name, x11->d_name);
|
||||||
stat(buffer, &s); /* get info */
|
stat(buffer, &s); /* get info */
|
||||||
|
|
||||||
secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0;
|
secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0;
|
||||||
secret.size = s.st_size;
|
secret.size = s.st_size;
|
||||||
|
|
||||||
return &secret;
|
return &secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void x11_closedir(MYDIR *dir)
|
void x11_closedir(MYDIR *dir)
|
||||||
{
|
{
|
||||||
free(dir->name);
|
free(dir->name);
|
||||||
(closedir)(dir->dir);
|
(closedir)(dir->dir);
|
||||||
|
|
||||||
free(dir);
|
free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int x11_open(char *name, int opts)
|
int x11_open(char *name, int opts)
|
||||||
{
|
{
|
||||||
char buffer[256]; /* sufficiently big */
|
char buffer[256]; /* sufficiently big */
|
||||||
|
|
||||||
if(name[0] == '/') {
|
if(name[0] == '/') {
|
||||||
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
||||||
|
|
||||||
debugf("We open the real file '%s'\n", buffer);
|
debugf("We open the real file '%s'\n", buffer);
|
||||||
return (open)(buffer, opts);
|
return (open)(buffer, opts);
|
||||||
}
|
}
|
||||||
return (open)(name, opts);
|
return (open)(name, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x11_close(int fd)
|
int x11_close(int fd)
|
||||||
{
|
{
|
||||||
return (close)(fd);
|
return (close)(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x11_creat(char *name, int mode)
|
int x11_creat(char *name, int mode)
|
||||||
{
|
{
|
||||||
char buffer[256]; /* sufficiently big */
|
char buffer[256]; /* sufficiently big */
|
||||||
|
(void)mode;
|
||||||
|
if(name[0] == '/') {
|
||||||
|
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
||||||
|
|
||||||
if(name[0] == '/') {
|
debugf("We create the real file '%s'\n", buffer);
|
||||||
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
return (creat)(buffer, 0666);
|
||||||
|
}
|
||||||
debugf("We create the real file '%s'\n", buffer);
|
return (creat)(name, 0666);
|
||||||
return (creat)(buffer, 0666);
|
|
||||||
}
|
|
||||||
return (creat)(name, 0666);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int x11_remove(char *name)
|
int x11_remove(char *name)
|
||||||
{
|
{
|
||||||
char buffer[256]; /* sufficiently big */
|
char buffer[256]; /* sufficiently big */
|
||||||
|
|
||||||
if(name[0] == '/') {
|
if(name[0] == '/') {
|
||||||
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
||||||
|
|
||||||
debugf("We remove the real file '%s'\n", buffer);
|
debugf("We remove the real file '%s'\n", buffer);
|
||||||
return (remove)(buffer);
|
return (remove)(buffer);
|
||||||
}
|
}
|
||||||
return (remove)(name);
|
return (remove)(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x11_rename(char *oldpath, char* newpath)
|
int x11_rename(char *oldpath, char* newpath)
|
||||||
{
|
{
|
||||||
char buffer1[256];
|
char buffer1[256];
|
||||||
char buffer2[256];
|
char buffer2[256];
|
||||||
|
|
||||||
if(oldpath[0] == '/') {
|
if(oldpath[0] == '/') {
|
||||||
sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath);
|
sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath);
|
||||||
sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath);
|
sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath);
|
||||||
|
|
||||||
debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2);
|
debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2);
|
||||||
return (rename)(buffer1, buffer2);
|
return (rename)(buffer1, buffer2);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fat_size(unsigned int* size, unsigned int* free)
|
void fat_size(unsigned int* size, unsigned int* free)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue