eoeolite: try to fix it #2 (hmm... program compiled on my PC works fine)

git-svn-id: svn://kolibrios.org@3152 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-01-09 00:17:47 +00:00
parent 2e554741c9
commit defe46a8bd

View File

@ -592,7 +592,7 @@ void Open_Dir(dword temp_, redraw){
if (somelen) path_[somelen]=NULL; if (somelen) path_[somelen]=NULL;
if (buf) free(buf); if (buf) free(buf);
buf = malloc(512); buf = malloc(32);
errornum=ReadDir(0, buf, #path_); errornum=ReadDir(0, buf, #path_);
if (errornum<>0) //îøèáêà ïðè ÷òåíèè ïàïêè if (errornum<>0) //îøèáêà ïðè ÷òåíèè ïàïêè
{ {
@ -602,10 +602,9 @@ void Open_Dir(dword temp_, redraw){
return; return;
} }
count = ESDWORD[buf+8]; count = ESDWORD[buf+8];
buf = realloc(count * 304 + 512, buf); //ïî÷åìó 32? buf = realloc(count * 304 + 32, buf); //ïî÷åìó 32?
ReadDir(count, buf, #path_); ReadDir(count, buf, #path_);
count=EBX; count=EBX;
if (count>sizeof(file_mas)) count=sizeof(file_mas);
} }
if (count<>-1) if (count<>-1)
{ {
@ -633,7 +632,7 @@ inline Sorting()
{ {
dword k=0, l=1; dword k=0, l=1;
if (!strcmp(#path,"/")) //|| (count > 5000) //íå ñîðòèðîâàòü ïàïêè è íå ìåíÿòü ðåãèñòð â "/" if (!strcmp(#path,"/")) || (count > 5000) //íå ñîðòèðîâàòü ïàïêè è íå ìåíÿòü ðåãèñòð â "/"
{ {
FOR(k=1;k<count;k++;) file_mas[k]=k; FOR(k=1;k<count;k++;) file_mas[k]=k;
return; return;
@ -659,10 +658,8 @@ inline Sorting()
IF (sort_num==1) Sort_by_Name(k,count-1); IF (sort_num==1) Sort_by_Name(k,count-1);
IF (sort_num==2) Sort_by_Type(k,count-1); IF (sort_num==2) Sort_by_Type(k,count-1);
IF (sort_num==3) Sort_by_Size(k,count-1); IF (sort_num==3) Sort_by_Size(k,count-1);
if (strcmp(file_mas[0]*304+buf+72,"..")<>0) //åñëè ïàïêà ".." íå ïåðâàÿ, ñòàâèì å¸ òóäà //åñëè ïàïêà ".." íå ïåðâàÿ, ñòàâèì å¸ òóäà
{ IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]><file_mas[0];
FOR(k--; k>0; k--;) { IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]><file_mas[0]; }
}
} }