From ff74f51ef8b2d1a46b27e7a6749f0667dbd76497 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Aug 2013 15:07:08 +0000 Subject: custom base64 functions removed from all pascal plugins git-svn-id: http://svn.miranda-ng.org/main/trunk@5720 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman/actman.dpr | 1 - plugins/Actman/i_inoutxm.inc | 6 +- plugins/Actman30/actman.dpr | 1 - plugins/Actman30/iac_global.pas | 6 +- plugins/Actman30/make.bat | 2 +- plugins/ShlExt/shlcom.pas | 7 --- plugins/Utils.pas/base64.pas | 108 ------------------------------------ plugins/Watrack/formats/fmt_ogg.pas | 9 +-- plugins/Watrack/proto/proto.pas | 2 +- 9 files changed, 15 insertions(+), 127 deletions(-) delete mode 100644 plugins/Utils.pas/base64.pas diff --git a/plugins/Actman/actman.dpr b/plugins/Actman/actman.dpr index 5428411585..d7e073ff1b 100644 --- a/plugins/Actman/actman.dpr +++ b/plugins/Actman/actman.dpr @@ -43,7 +43,6 @@ uses dbsettings, mirutils, syswin, - base64, question, mApiCardM, global, diff --git a/plugins/Actman/i_inoutxm.inc b/plugins/Actman/i_inoutxm.inc index febe8e55d2..bbde13483a 100644 --- a/plugins/Actman/i_inoutxm.inc +++ b/plugins/Actman/i_inoutxm.inc @@ -215,6 +215,7 @@ var tmpbuf:array [0..63] of AnsiChar; dbv:TDBVARIANT; is_chat:boolean; + bufLen:int; begin with xmlparser do begin @@ -242,7 +243,8 @@ begin DBVT_UTF8 : WideToUTF8(getAttrValue(node,ioCUID),dbv.szVal.A); DBVT_WCHAR : StrDupW(dbv.szVal.W,getAttrValue(node,ioCUID)); DBVT_BLOB : begin - Base64Decode(FastWideToAnsi(getAttrValue(node,ioCUID),pAnsiChar(dbv.pbVal)),dbv.pbVal); + dbv.pbVal := mir_base64_decode(FastWideToAnsi(getAttrValue(node,ioCUID),pAnsiChar(dbv.pbVal)), bufLen); + dbv.cpbVal := bufLen; end; end; end; @@ -813,7 +815,7 @@ begin end; DBVT_WCHAR : AddAttr(node,ioCUID,cws.szVal.W); DBVT_BLOB : begin - p1:=Base64Encode(cws.pbVal,cws.cpbVal); + p1:=mir_base64_encode(cws.pbVal,cws.cpbVal); AddAttr(node,ioCUID,FastAnsiToWide(p1,p)); mFreeMem(p1); mFreeMem(p); diff --git a/plugins/Actman30/actman.dpr b/plugins/Actman30/actman.dpr index 2f22cda9e2..b4a2cf1566 100644 --- a/plugins/Actman30/actman.dpr +++ b/plugins/Actman30/actman.dpr @@ -38,7 +38,6 @@ uses dbsettings, mirutils, syswin, - base64, question, mApiCardM, global, diff --git a/plugins/Actman30/iac_global.pas b/plugins/Actman30/iac_global.pas index 64a8604b2c..58d15007ea 100644 --- a/plugins/Actman30/iac_global.pas +++ b/plugins/Actman30/iac_global.pas @@ -94,7 +94,7 @@ function ImportContactINI(node:pointer):THANDLE; implementation -uses Common, global, dbsettings, base64, mirutils; +uses Common, global, dbsettings, mirutils; //----- tBaseAction code ----- const @@ -308,6 +308,7 @@ var dbv:TDBVARIANT; tmp:pWideChar; is_chat:boolean; + bufLen:int; begin with xmlparser do begin @@ -336,7 +337,8 @@ begin DBVT_UTF8 : WideToUTF8(tmp,dbv.szVal.A); DBVT_WCHAR : dbv.szVal.W:=tmp; DBVT_BLOB : begin - Base64Decode(FastWideToAnsi(tmp,pAnsiChar(dbv.pbVal)),dbv.pbVal); + dbv.pbVal := mir_base64_decode(FastWideToAnsi(tmp,pAnsiChar(dbv.pbVal)),bufLen); + dbv.cpbVal := bufLen; end; end; end; diff --git a/plugins/Actman30/make.bat b/plugins/Actman30/make.bat index 36cbb97ab5..6e10afe21f 100644 --- a/plugins/Actman30/make.bat +++ b/plugins/Actman30/make.bat @@ -2,7 +2,7 @@ set myopts=-dMiranda set dprname=actman.dpr -for /R %%I in (*.rc) do ..\delphi\brcc32.exe %myopts% %%I -fo%%~npI.res >nul +for /R %%I in (*.rc) do brcc32.exe %myopts% %%I -fo%%~npI.res >nul if /i '%1' == 'fpc' ( ..\FPC\bin\fpc.exe %myopts% %dprname% %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/plugins/ShlExt/shlcom.pas b/plugins/ShlExt/shlcom.pas index 97fef24660..93a5d27695 100644 --- a/plugins/ShlExt/shlcom.pas +++ b/plugins/ShlExt/shlcom.pas @@ -2104,7 +2104,6 @@ var dbv: TDBVariant; bits: pint; bGroupMode: Boolean; - tid: Cardinal; cloned: PHeaderIPC; szMiranda: PChar; begin @@ -2278,12 +2277,6 @@ begin end; procedure InvokeThreadServer; -var -{$IFDEF FPC} - tid: LongWord; -{$ELSE} - tid: Cardinal; -{$ENDIF} var hMainThread: THandle; begin diff --git a/plugins/Utils.pas/base64.pas b/plugins/Utils.pas/base64.pas deleted file mode 100644 index d6cebae930..0000000000 --- a/plugins/Utils.pas/base64.pas +++ /dev/null @@ -1,108 +0,0 @@ -unit Base64; - -interface - -uses windows; - -{ Base64 encode and decode a string } -function Base64Encode(src:pByte;len:integer):PAnsiChar; -function Base64Decode(src:PAnsiChar;var dst:pByte):integer; - -{******************************************************************************} -{******************************************************************************} -implementation - -uses common; - -const - base64chars{:array [0..63] of AnsiChar}:PAnsiChar = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - -function Base64Encode(src:pByte;len:integer):PAnsiChar; -var - dst:PAnsiChar; -begin - if (src=nil) or (len<=0) then - begin - result:=nil; - exit; - end; - mGetMem(result,((len*4+11) div (12*4))+1); - dst:=result; - - while len>0 do - begin - dst^:=base64chars[src^ shr 2]; inc(dst); - if len=1 then - begin - dst^:=base64chars[(src^ and 3) shl 4]; inc(dst); - dst^:='='; inc(dst); - dst^:='='; inc(dst); - break; - end; - dst^:=base64chars[((src^ and 3) shl 4) or (pbyte(PAnsiChar(src)+1)^ shr 4)]; inc(dst); inc(src); - if len=2 then - begin - dst^:=base64chars[(src^ and $F) shl 2]; inc(dst); - dst^:='='; inc(dst); - break; - end; - dst^:=base64chars[((src^ and $F) shl 2) or (pbyte(PAnsiChar(src)+1)^ shr 6)]; inc(dst); inc(src); - dst^:=base64chars[src^ and $3F]; inc(dst); inc(src); - dec(len,3); - end; - dst^:=#0; -end; - -function Base64CharToInt(c:AnsiChar):byte; -begin - case c of - 'A'..'Z': result:=ord(c)-ord('A'); - 'a'..'z': result:=ord(c)-ord('a')+26; - '0'..'9': result:=ord(c)-ord('0')+52; - '+': result:=62; - '/': result:=63; - '=': result:=64; - else - result:=255; - end; -end; - -function Base64Decode(src:PAnsiChar;var dst:pByte):integer; -var - slen:integer; - ptr:pByte; - b1,b2,b3,b4:byte; -begin - if (src=nil) or (src^=#0) then - begin - result:=0; - dst:=nil; - exit; - end; - pAnsiChar(ptr):=src; - while ptr^<>0 do inc(ptr); - slen:=PAnsiChar(ptr)-src; - mGetMem(ptr,(slen*3) div 4); - dst:=ptr; - result:=0; - while slen>0 do - begin - b1:=Base64CharToInt(src^); inc(src); - b2:=Base64CharToInt(src^); inc(src); - b3:=Base64CharToInt(src^); inc(src); - b4:=Base64CharToInt(src^); inc(src); - dec(slen,4); - if (b1=255) or (b1=64) or (b2=255) or (b2=64) or (b3=255) or (b4=255) then - break; - ptr^:=(b1 shl 2) or (b2 shr 4); inc(ptr); inc(result); - if b3=64 then - break; - ptr^:=(b2 shl 4) or (b3 shr 2); inc(ptr); inc(result); - if b4=64 then - break; - ptr^:=b4 or (b3 shl 6); inc(ptr); inc(result); - end; -end; - -end. diff --git a/plugins/Watrack/formats/fmt_ogg.pas b/plugins/Watrack/formats/fmt_ogg.pas index 4b05b80c2c..2e36f6d8df 100644 --- a/plugins/Watrack/formats/fmt_ogg.pas +++ b/plugins/Watrack/formats/fmt_ogg.pas @@ -3,14 +3,14 @@ unit fmt_OGG; {$include compilers.inc} interface -uses wat_api; +uses wat_api, m_api; function ReadOGG(var Info:tSongInfo):boolean; cdecl; function ReadSPX(var Info:tSongInfo):boolean; cdecl; function ReadfLaC(var Info:tSongInfo):boolean; cdecl; implementation -uses windows,common,io,tags,srv_format,base64,utils; +uses windows,common,io,tags,srv_format,utils; const OGGSign = $5367674F; //OggS @@ -111,7 +111,8 @@ type procedure OGGGetComment(ptr:PAnsiChar;size:integer;var Info:tSongInfo); var - clen,alen,len,values:dword; + alen,len,values:dword; + clen:int; ls:PAnsiChar; value:PAnsiChar; cover:pByte; @@ -150,7 +151,7 @@ begin else if (Info.track=0) and (lstrcmpia(ls,'TRACKNUMBER')=0) then Info.track:=StrToInt(value) - else if (cover=nil) and (lstrcmpia(ls,'COVERART')=0) then clen:=Base64Decode(value,cover) + else if (cover=nil) and (lstrcmpia(ls,'COVERART')=0) then cover:=mir_base64_decode(value,clen) else if lstrcmpia(ls,'COVERARTMIME')=0 then ext:=GetImageType(nil,value); end; dec(values); diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index 5befc5e2d8..e0e3a94dcf 100644 --- a/plugins/Watrack/proto/proto.pas +++ b/plugins/Watrack/proto/proto.pas @@ -257,7 +257,7 @@ begin curpos:=nil; if DisablePlugin<>dsPermanent then begin - if CallService(MS_WAT_GETMUSICINFO,0,0)=uint_ptr(WAT_PLS_NOTFOUND) then + if CallService(MS_WAT_GETMUSICINFO,0,0)=WAT_PLS_NOTFOUND then begin s:=#0#0#0'No player found at this time'; textpos:=s+3; -- cgit v1.2.3