mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 01:04:50 +01:00 
			
		
		
		
	lazutils: fix compilation after cpstrrtl merge
git-svn-id: trunk@42642 -
This commit is contained in:
		
							parent
							
								
									68bb020129
								
							
						
					
					
						commit
						f3358d8050
					
				| @ -447,6 +447,9 @@ begin | |||||||
|   {$endif} |   {$endif} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | {$IF DEFINED(WinCE) OR (FPC_FULLVERSION>=20701)} | ||||||
|  |   {$define FindData_W} | ||||||
|  | {$endif} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function FindMatch(var f: TSearchRec) : Longint; | function FindMatch(var f: TSearchRec) : Longint; | ||||||
| @ -467,14 +470,16 @@ begin | |||||||
|   { The structures are different at this point |   { The structures are different at this point | ||||||
|     in win32 it is the ansi structure with a utf-8 string |     in win32 it is the ansi structure with a utf-8 string | ||||||
|     in wince it is a wide structure } |     in wince it is a wide structure } | ||||||
|   {$ifdef WinCE} |   {$ifdef FindData_W} | ||||||
|   f.Name:=UTF8Encode(F.FindData.cFileName); |   f.Name:=UTF8Encode(UnicodeString(F.FindData.cFileName)); | ||||||
|   {$else} |   {$else} | ||||||
|   f.Name:=F.FindData.cFileName; |   f.Name:=F.FindData.cFileName; | ||||||
|   {$endif} |   {$endif} | ||||||
|   Result:=0; |   Result:=0; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | {$IFNDEF FindData_W} | ||||||
|  | 
 | ||||||
| { This function does not really convert from wide to ansi, but from wide to | { This function does not really convert from wide to ansi, but from wide to | ||||||
|   a utf-8 encoded ansi version of the data structures in win32 and does |   a utf-8 encoded ansi version of the data structures in win32 and does | ||||||
|   nothing in wince |   nothing in wince | ||||||
| @ -485,9 +490,6 @@ var | |||||||
|   ws: WideString; |   ws: WideString; | ||||||
|   an: AnsiString; |   an: AnsiString; | ||||||
| begin | begin | ||||||
|   {$ifdef WinCE} |  | ||||||
|   ansi := wide; |  | ||||||
|   {$else} |  | ||||||
|   SetLength(ws, length(wide.cAlternateFileName)); |   SetLength(ws, length(wide.cAlternateFileName)); | ||||||
|   Move(wide.cAlternateFileName[0], ws[1], length(ws)*2); |   Move(wide.cAlternateFileName[0], ws[1], length(ws)*2); | ||||||
|   an := AnsiString(ws); // no need to utf8 for cAlternateFileName (it's always ansi encoded)
 |   an := AnsiString(ws); // no need to utf8 for cAlternateFileName (it's always ansi encoded)
 | ||||||
| @ -509,12 +511,12 @@ begin | |||||||
|     dwReserved0 := wide.dwReserved0; |     dwReserved0 := wide.dwReserved0; | ||||||
|     dwReserved1 := wide.dwReserved1; |     dwReserved1 := wide.dwReserved1; | ||||||
|   end; |   end; | ||||||
|   {$endif} |  | ||||||
| end; | end; | ||||||
|  | {$ENDIF} | ||||||
| 
 | 
 | ||||||
| function FindFirstWide(const Path: string; Attr: Longint; out Rslt: TSearchRec): Longint; | function FindFirstWide(const Path: string; Attr: Longint; out Rslt: TSearchRec): Longint; | ||||||
| var | var | ||||||
|   find  : TWIN32FINDDATAW; |   find: TWIN32FINDDATAW; | ||||||
| begin | begin | ||||||
|   Rslt.Name:=Path; |   Rslt.Name:=Path; | ||||||
|   Rslt.Attr:=attr; |   Rslt.Attr:=attr; | ||||||
| @ -528,18 +530,26 @@ begin | |||||||
|     Exit; |     Exit; | ||||||
|   end; |   end; | ||||||
|   { Find file with correct attribute } |   { Find file with correct attribute } | ||||||
|  |   {$IFNDEF FindData_W} | ||||||
|   FindWideToAnsi(find, Rslt.FindData); |   FindWideToAnsi(find, Rslt.FindData); | ||||||
|   Result:=FindMatch(Rslt); |   {$ELSE} | ||||||
|  |   Rslt.FindData := find; | ||||||
|  |   {$IFEND} | ||||||
|  |   Result := FindMatch(Rslt); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function FindNextWide(var Rslt: TSearchRec): Longint; | function FindNextWide(var Rslt: TSearchRec): Longint; | ||||||
| var | var | ||||||
|   wide  : TWIN32FINDDATAW; |   wide: TWIN32FINDDATAW; | ||||||
| begin | begin | ||||||
|   if FindNextFileW(Rslt.FindHandle, wide) then |   if FindNextFileW(Rslt.FindHandle, wide) then | ||||||
|   begin |   begin | ||||||
|  |     {$IFNDEF FindData_W} | ||||||
|     FindWideToAnsi(wide, Rslt.FindData); |     FindWideToAnsi(wide, Rslt.FindData); | ||||||
|  |     {$ELSE} | ||||||
|  |     Rslt.FindData := wide; | ||||||
|  |     {$ENDIF} | ||||||
|     Result := FindMatch(Rslt); |     Result := FindMatch(Rslt); | ||||||
|   end |   end | ||||||
|   else |   else | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 paul
						paul