Eolite 1.43: fixed largest memory leak, optimizations

git-svn-id: svn://kolibrios.org@3057 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-11-18 21:33:20 +00:00
parent 9e218440da
commit c69c5c905b
4 changed files with 43 additions and 38 deletions

View File

@ -20,7 +20,7 @@ int BUTTON_HEIGHT=18;
#define ONLY_OPEN 2
//ïåðåìåííûå
#define title "Eolite File Manager v1.41"
#define title "Eolite File Manager v1.43"
dword selection_col = 0x94AECE;
dword lpanel_col = 0x00699C;
@ -383,10 +383,10 @@ void main()
rename_active=1;
break;
case 052: //Íàæàòà F3
IF (isdir==false) RunProgram("/sys/tinypad", #file_path);
IF (!isdir) RunProgram("/sys/tinypad", #file_path);
break;
case 053: //Íàæàòà F4
IF (isdir==false) RunProgram("/sys/develop/heed", #file_path);
IF (!isdir) RunProgram("/sys/develop/heed", #file_path);
break;
case 054: //F5
Open_Dir(#path,1);
@ -398,16 +398,14 @@ void main()
for (i=curbtn+za_kadrom+1; i<count; i++)
{
copystr(file_mas[i]*304+buf+72,#temp);
AL=DSBYTE[#temp];
IF(AL>='A')&&(AL<='Z')DSBYTE[#temp]=AL|0x20;
IF (temp[0]==key)
IF (temp[0]==key) || (temp[0]==key-32)
{
FileList_ReDraw(i-curbtn-za_kadrom);
break;
}
}
}
BREAK;
break;
case evReDraw:
draw_window();
}
@ -583,12 +581,10 @@ void Open_Dir(dword temp_, redraw){
char path_[4096],
somelen=strlen(temp_)-1;
//debug("reading directory");
//debug(temp_);
if (redraw<>ONLY_SHOW)
{
copystr(temp_, #path_);
if (somelen) path_[somelen]=0x00;
if (somelen) path_[somelen]=NULL;
if (buf) free(buf);
buf = malloc(32);
@ -656,7 +652,7 @@ inline Sorting()
IF (sort_num==2) Sort_by_Type(k,count-1);
IF (sort_num==3) Sort_by_Size(k,count-1);
//åñëè ïàïêà ".." íå ïåðâàÿ, ñòàâèì å¸ òóäà
IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k=k-1; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]><file_mas[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];
}
@ -693,8 +689,8 @@ void Del_File(byte dodel)
IF (del_file_rez<>0)
{
Write_Error(del_file_rez);
IF (isdir==true) ShowMessage("Error. Folder isn't empty.");
IF (isdir==false) ShowMessage("Error. Filesystem read-only.");
IF ( isdir) ShowMessage("Error. Folder isn't empty.");
IF (!isdir) ShowMessage("Error. Filesystem read-only.");
}
}
del_active=0;
@ -727,8 +723,8 @@ void Paste()
{
copystr(#copy_file,#file_path);
Del_File(true);
copy_file='';
cut_active=0;
copy_file=NULL;
cut_active=false;
}
SelectFile(#new_copy_path+strchr(#new_copy_path,'/'));
}
@ -801,10 +797,11 @@ void SelectFile(dword that_file)
void Dir_Up()
{
char cur_folder[4096];
if (!strcmp(#path,"/")) return;
if (path[1]==NULL) return;
i=strlen(#path)-1;
path[i]=0x00;
do i--; while (path[i]<>'/'); copystr(#path+i+1,#cur_folder);
do i--; while (path[i]<>'/');
copystr(#path+i+1,#cur_folder);
path[i+1]=0x00;
SelectFile(#cur_folder);
}

View File

@ -38,7 +38,7 @@ void about_dialog()
DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,"About Eolite");
DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè
PutPaletteImage(#logo,85,85,43,7,#logo_pal);
WriteText(46,100,0x90,0xBF40BF,"Eolite v1.41",0);
WriteText(46,100,0x90,0xBF40BF,"Eolite v1.43",0);
$add ebx, 1<<16
$int 0x40
WriteText(55,120,0x80,0,"Developers:",0);

View File

@ -133,6 +133,25 @@ int DeleleFile(dword del_file_path)
$int 0x40
}
///////////////////////////
// Ïàğàìåòğû ôàéëà //
///////////////////////////
/*f70 getinfo_file_70;
BDVK getinfo_file_info;
:dword GetFileInfo(dword file_path)
{
getinfo_file_70.func = 5;
getinfo_file_70.param1 =
getinfo_file_70.param2 =
getinfo_file_70.param3 = 0;
getinfo_file_70.param4 = #getinfo_file_info;
getinfo_file_70.rezerv = 0;
getinfo_file_70.name = file_path;
$mov eax,70
$mov ebx,#getinfo_file_70.func
$int 0x40
}*/
///////////////////////////
// Ñêîïèðîâàòü ôàéë //
///////////////////////////
@ -140,7 +159,7 @@ f70 CopyFile_f;
inline fastcall int CopyFile(dword EBX,ECX)
{
BDVK CopyFile_atr;
dword s=EBX, d=ECX, cBufer=0;
dword s=EBX, d=ECX, cBufer=0, rezult;
CopyFile_f.func = 5;
CopyFile_f.param1 = 0;
CopyFile_f.param2 = 0;
@ -155,23 +174,11 @@ inline fastcall int CopyFile(dword EBX,ECX)
if (!EAX)
{
cBufer = malloc(2*CopyFile_atr.sizelo);
ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, s);
IF (!EAX)
{
CopyFile_f.func = 2;
CopyFile_f.param1 = 0;
CopyFile_f.param2 = 0;
CopyFile_f.param3 = CopyFile_atr.sizelo;
CopyFile_f.param4 = cBufer;
CopyFile_f.rezerv = 0;
CopyFile_f.name = d;
$mov eax, 70
$mov ebx, #CopyFile_f
$int 0x40
if (!ReadFile(0, CopyFile_atr.sizelo, cBufer, s))
rezult = CreateFile(CopyFile_atr.sizelo, cBufer, d);
free(cBufer);
}
}
return EAX;
return rezult;
}

View File

@ -1,8 +1,9 @@
16.11.12 -- v1.4
16.11.12 -- v1.43
- при минимальном размере окна учитывается количество дисков в системе;
- добавлен фон на левую панель;
- изменения в организации файлов;
- удаление виртуальных дисков типа /tmpX/1.
- удаление виртуальных дисков типа /tmpX/1;
- исправлена страшнейшая утечка памяти равная размеру копируемого файла;
- улучшения в организации файлов и кода.
15.11.12 -- v1.36
- устранена утечка памяти при сканировании устройств;