| View previous topic :: View next topic |
| Author |
Message |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Wed Dec 23, 2009 4:12 am Post subject: [SOLVED] Strange problems with exported function... |
|
|
Hi, I've some problem with this function.
I'm using it by exporting from User prx to Vsh pbp,
it works for directory with no more than 2 subdirectories, otherwise it crash...
I can't undestrand why, probably something stupid, but maybe not....
I've thing that it could be a stack overflow but I've tryed to increase the calling thread stack and it still doesn't works...
| Code: |
SceUInt64 XioDirSize(char* Dir)
{
return XioDirSizeFunct(Dir, 0);
}
SceUInt64 XioDirSizeFunct(char* Dir, SceUInt64 Size)
{
int dl = sceIoDopen(Dir);
if(dl < 0)
return 0;
SceIoDirent sid;
char Fullname[256];
memset(&sid, 0, sizeof (SceIoDirent));
while(sceIoDread(dl, &sid) > 0)
{
if((strcmp(sid.d_name, ".") == 0) || (strcmp(sid.d_name, "..") == 0))
continue;
sprintf(Fullname, "%s/%s", Dir, sid.d_name);
if(FIO_S_ISDIR(sid.d_stat.st_mode))
{
XioDirSizeFunct(Fullname, Size);
}
else
{
Size += sid.d_stat.st_size;
memset(&sid, 0, sizeof (SceIoDirent));
}
}
sceIoDclose(dl);
return Size;
}
|
A question, exported functions use the calling thread stack? _________________ Get Xplora!
Last edited by ne0h on Fri Dec 25, 2009 3:14 am; edited 2 times in total |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Wed Dec 23, 2009 4:38 am Post subject: |
|
|
Two points
1. You calculation is wrong | Code: | if(FIO_S_ISDIR(sid.d_stat.st_mode))
{
XioDirSizeFunct(Fullname, Size);
}
| should be | Code: | if(FIO_S_ISDIR(sid.d_stat.st_mode))
{
Size = XioDirSizeFunct(Fullname, Size);
}
|
2. I don't know if this matters but you didn't memset sid after getting "." or ".." _________________ Click ME! |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Wed Dec 23, 2009 4:41 am Post subject: |
|
|
Yes, I know ( for the 1st point ), I've tryed before to do it with a pointer, and I haven't added "Size = ...".
For the 2nd, I'll try but I don't think that can be that...
Sorry for my english,
ne0h _________________ Get Xplora! |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Wed Dec 23, 2009 4:42 am Post subject: |
|
|
Still doesn't works... _________________ Get Xplora! |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Wed Dec 23, 2009 5:21 am Post subject: |
|
|
try using psplink to to find the type and location of the error _________________ Click ME! |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Thu Dec 24, 2009 12:14 am Post subject: |
|
|
Can't use psplink, have no memory...
There's a way to install exception handler on 5.xx fws? _________________ Get Xplora! |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Thu Dec 24, 2009 8:47 am Post subject: |
|
|
Sakya posted one
Search and thou shalt findeth _________________ Click ME! |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Fri Dec 25, 2009 3:27 am Post subject: |
|
|
Resolved...
"Simple" stack overflow in cross-thread operation... _________________ Get Xplora! |
|
| Back to top |
|
 |
|