From da87b3fa0479333cfe9505713f6ffaa54b9ba543 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 31 Dec 2014 17:08:47 +0000 Subject: pascal code: reformat, small fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@11700 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Watrack/formats/fmt_mp3.pas | 16 +++++++------- plugins/Watrack/formats/fmt_ogg.pas | 29 ++++++++++++------------- plugins/Watrack/formats/fmt_real.pas | 40 +++++++++++++++++------------------ plugins/Watrack/formats/fmt_wma.pas | 4 ++-- plugins/Watrack/formats/tag_id3v1.inc | 10 ++++----- plugins/Watrack/formats/tag_id3v2.inc | 12 +++++------ 6 files changed, 55 insertions(+), 56 deletions(-) (limited to 'plugins/Watrack/formats') diff --git a/plugins/Watrack/formats/fmt_mp3.pas b/plugins/Watrack/formats/fmt_mp3.pas index 45c0888daa..e9d5d68eed 100644 --- a/plugins/Watrack/formats/fmt_mp3.pas +++ b/plugins/Watrack/formats/fmt_mp3.pas @@ -125,18 +125,18 @@ end; function SearchStart(f:THANDLE; var l:array of byte):Boolean; var CurPos:longint; - Buf:array [0..ScanSize] of byte; + buf:array [0..ScanSize] of byte; i,j:integer; begin CurPos:=FilePos(f)-4; Seek(f,CurPos); - j:=BlockRead(f,Buf,ScanSize); + j:=BlockRead(f,buf,ScanSize); i:=0; while i$F0) then + if (i<(j-2)) and (buf[i]=$FF) and //FF FB E4 + ((buf[i+1] and $E0)=$E0) and + ((buf[i+2] and $F0)<>$F0) then begin Seek(f,CurPos+i); BlockRead(f,l,4); @@ -257,7 +257,7 @@ var w:word; b:byte; flag:integer; - version,layer:integer; + version,Layer:integer; // vbitrate:integer; // FrmCnt:integer; begin @@ -385,8 +385,8 @@ begin end; l:=ReadDWord(p,endptr); version:=(l2b(l)[1] and $18) shr 3; - layer :=(l2b(l)[1] and $06) shr 1; - Info.kbps :=btable[version and 1][layer-1][l2b(l)[2] shr 4]; + Layer :=(l2b(l)[1] and $06) shr 1; + Info.kbps :=btable[version and 1][Layer-1][l2b(l)[2] shr 4]; Info.khz :=(stable[version][(l2b(l)[2] and $0C) shr 2]) div 1000; Info.channels:=l2b(l)[3] shr 6; if Info.channels=3 then diff --git a/plugins/Watrack/formats/fmt_ogg.pas b/plugins/Watrack/formats/fmt_ogg.pas index d0ba567d08..fbe959d48b 100644 --- a/plugins/Watrack/formats/fmt_ogg.pas +++ b/plugins/Watrack/formats/fmt_ogg.pas @@ -5,12 +5,12 @@ unit fmt_OGG; interface uses wat_api; -function ReadOGG(var Info:wat_api.tSongInfo):boolean; cdecl; -function ReadSPX(var Info:wat_api.tSongInfo):boolean; cdecl; -function ReadfLaC(var Info:wat_api.tSongInfo):boolean; cdecl; +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,utils, m_api; +uses windows,common,io,tags,srv_format,base64,utils; const OGGSign = $5367674F; //OggS @@ -95,12 +95,12 @@ const 5 : CUESHEET } type - MetaHdr = packed record + tMetaHdr = packed record blocktype:byte; blocklen:array [0..2] of byte; end; type - StreamInfo = packed record + tStreamInfo = packed record MinBlockSize:word; MaxBlocksize:word; MinFrameSize:array [0..2] of byte; @@ -109,10 +109,9 @@ type MD5:array [0..15] of byte; end; -procedure OGGGetComment(ptr:PAnsiChar;size:integer;var Info:wat_api.tSongInfo); +procedure OGGGetComment(ptr:PAnsiChar;size:integer;var Info:tSongInfo); var - alen,len,values:dword; - clen:int; + clen,alen,len,values:dword; ls:PAnsiChar; value:PAnsiChar; cover:pByte; @@ -151,7 +150,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 cover:=mir_base64_decode(value,clen) + else if (cover=nil) and (lstrcmpia(ls,'COVERART')=0) then clen:=Base64Decode(value,cover) else if lstrcmpia(ls,'COVERARTMIME')=0 then ext:=GetImageType(nil,value); end; dec(values); @@ -185,7 +184,7 @@ begin end; end; -function ReadSPX(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadSPX(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; OGGHdr:tOGGHdr; @@ -243,7 +242,7 @@ begin result:=0; end; -function ReadOGG(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadOGG(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; OGGHdr:tOGGHdr; @@ -368,12 +367,12 @@ begin CloseHandle(f); end; -function ReadfLaC(var Info:wat_api.tSongInfo):boolean; cdecl; +function ReadfLaC(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; data64:int64; - hdr:MetaHdr; - frm:StreamInfo; + hdr:tMetaHdr; + frm:tStreamInfo; id:dword; flag:integer; size:dword; diff --git a/plugins/Watrack/formats/fmt_real.pas b/plugins/Watrack/formats/fmt_real.pas index 8d5f5bf72d..1d69a2f353 100644 --- a/plugins/Watrack/formats/fmt_real.pas +++ b/plugins/Watrack/formats/fmt_real.pas @@ -23,7 +23,7 @@ const type tChunk = packed record ID:dword; - Len:dword; //with Chunk; + len:dword; //with Chunk; end; type @@ -43,32 +43,32 @@ type procedure SkipStr(var p:PAnsiChar;alen:integer); var - len:integer; + llen:integer; begin if alen=2 then - len:=(ord(p[0]) shl 8)+ord(p[1]) + llen:=(ord(p[0]) shl 8)+ord(p[1]) else - len:=ord(p[0]); + llen:=ord(p[0]); inc(p,alen); -// if len>0 then - inc(p,len); +// if llen>0 then + inc(p,llen); end; function ReadStr(var p:PAnsiChar;alen:integer):PAnsiChar; var - len:integer; + llen:integer; begin if alen=2 then - len:=(ord(p[0]) shl 8)+ord(p[1]) + llen:=(ord(p[0]) shl 8)+ord(p[1]) else - len:=ord(p[0]); + llen:=ord(p[0]); inc(p,alen); - if len>0 then + if llen>0 then begin - mGetMem(result,len+1); - move(p^,result^,len); - result[len]:=#0; - inc(p,len); + mGetMem(result,llen+1); + move(p^,result^,llen); + result[llen]:=#0; + inc(p,llen); end else result:=nil; @@ -103,15 +103,15 @@ begin while FilePos(f)SizeOf(chunk) then // channels-1: ofs=$0A break; - Skip(f,chunk.Len-SizeOf(chunk)); + Skip(f,chunk.len-SizeOf(chunk)); end; end; ReadID3v1(f,Info); diff --git a/plugins/Watrack/formats/fmt_wma.pas b/plugins/Watrack/formats/fmt_wma.pas index ed575147ac..8027ce052d 100644 --- a/plugins/Watrack/formats/fmt_wma.pas +++ b/plugins/Watrack/formats/fmt_wma.pas @@ -295,7 +295,7 @@ type size :word; bitmap :BITMAPINFOHEADER; end; - Prefix = packed record + tPrefix = packed record StreamType :tGUID; ECGUID :tGUID; // Error Correction TimeOffset :int64; @@ -309,7 +309,7 @@ var tmpguid:pGUID; begin tmpguid:=pointer(ptr); - inc(ptr,SizeOf(Prefix)); //ofset to Type-Specific Data + inc(ptr,SizeOf(tPrefix)); //ofset to Type-Specific Data if CompareGUID(tmpguid^,ASF_Audio_Media) then begin Info.channels:=pAudio(ptr)^.Channels; diff --git a/plugins/Watrack/formats/tag_id3v1.inc b/plugins/Watrack/formats/tag_id3v1.inc index bd1db906bb..5e1f89539a 100644 --- a/plugins/Watrack/formats/tag_id3v1.inc +++ b/plugins/Watrack/formats/tag_id3v1.inc @@ -61,7 +61,7 @@ procedure ID3v1_CheckLyric(var Info:tSongInfo;f:THANDLE;ofs:integer); const maxlen = 5100; var - tagHdr:array [0..9] of AnsiChar; + TagHdr:array [0..9] of AnsiChar; buf:array [0..maxlen] of AnsiChar; ptr,ptr1:PAnsiChar; i,size:integer; @@ -69,9 +69,9 @@ var c:dword; begin Seek(f,ofs); - BlockRead(f,tagHdr,LyricEndLen); - tagHdr[9]:=#0; - if StrCmp(tagHdr,Lyric1End,LyricEndLen)=0 then + BlockRead(f,TagHdr,LyricEndLen); + TagHdr[9]:=#0; + if StrCmp(TagHdr,Lyric1End,LyricEndLen)=0 then begin if Info.lyric=nil then begin @@ -91,7 +91,7 @@ begin end; end; end - else if StrCmp(tagHdr,Lyric2End,LyricEndLen)=0 then + else if StrCmp(TagHdr,Lyric2End,LyricEndLen)=0 then begin Seek(f,ofs-6); BlockRead(f,buf,6); diff --git a/plugins/Watrack/formats/tag_id3v2.inc b/plugins/Watrack/formats/tag_id3v2.inc index 78660fdb6d..5ee98ca9e1 100644 --- a/plugins/Watrack/formats/tag_id3v2.inc +++ b/plugins/Watrack/formats/tag_id3v2.inc @@ -307,17 +307,17 @@ begin end; end; -function ID3v2_PreReadTag(var frm:tID3v2FrameHdr;var src:PAnsiChar;ver:integer):PAnsiChar; +function ID3v2_PreReadTag(var Frm:tID3v2FrameHdr;var src:PAnsiChar;ver:integer):PAnsiChar; var i:cardinal; dst:PAnsiChar; begin - mGetMem(result,frm.Size); - if Unsync or ((frm.Flags and $0200)<>0) then + mGetMem(result,Frm.Size); + if Unsync or ((Frm.Flags and $0200)<>0) then begin dst:=result; i:=0; - while i