View Issue Details

IDProjectCategoryView StatusLast Update
0025512LazarusWidgetsetpublic2014-12-05 20:12
ReporterBart BroersmaAssigned ToPaul Ishenin 
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindowOS VersionWin7
Product Version1.3 (SVN)Product Buildr43552  
Target VersionFixed in Version1.4 
Summary0025512: Compilation for WinCE broken by revision 43069 (graphics.pp)
DescriptionWhile trying to cross compile (win32->wince, fpc 2.6.4RC1) I got

C:\devel\lazarus\lcl\graphics.pp(2805,80) Error: Incompatible type for
arg no. 3: Got "PChar", expected "PWideChar"

2789 function CreateBitmapFromResourceName(Instance: THandle; const
ResName: String): TCustomBitmap;
2790 var
2791 ResHandle: TFPResourceHandle;
2792 Stream: TResourceStream;
2793 GraphicClass: TGraphicClass;
2794 begin
2795 ResHandle := FindResource(Instance, PChar(ResName), PChar(RT_BITMAP));
2796 if ResHandle <> 0 then
2797 begin
2798 Result := TBitmap.Create;
2799 Result.LoadFromResourceName(Instance, ResName);
2800 Exit;
2801 end;
2802 ResHandle := FindResource(Instance, PChar(ResName), PChar(RT_RCDATA));
2803 if ResHandle <> 0 then
2804 begin
2805 Stream := TResourceStream.Create(Instance, PChar(ResName),
PChar(RT_RCDATA)); <<== Error on this line
Additional InformationPossible fix attached.
TagsNo tags attached.
Fixed in Revision43697
LazTarget-
WidgetsetWinCE
Attached Files
  • graphics.wince.diff (989 bytes)
    Index: lcl/graphics.pp
    ===================================================================
    --- lcl/graphics.pp	(revision 43692)
    +++ lcl/graphics.pp	(working copy)
    @@ -2791,6 +2791,9 @@
       ResHandle: TFPResourceHandle;
       Stream: TResourceStream;
       GraphicClass: TGraphicClass;
    +  {$IFDEF WINCE}
    +  ResNameW: WideString;
    +  {$ENDIF}
     begin
       ResHandle := FindResource(Instance, PChar(ResName), PChar(RT_BITMAP));
       if ResHandle <> 0 then
    @@ -2802,7 +2805,12 @@
       ResHandle := FindResource(Instance, PChar(ResName), PChar(RT_RCDATA));
       if ResHandle <> 0 then
       begin
    +    {$IFDEF WINCE}
    +    ResNameW := Utf8ToUtf16(ResName);
    +    Stream := TResourceStream.Create(Instance, ResNameW, PWideChar(RT_RCDATA));
    +    {$ELSE}
         Stream := TResourceStream.Create(Instance, PChar(ResName), PChar(RT_RCDATA));
    +    {$ENDIF}
         try
           GraphicClass := GetPicFileFormats.FindByStreamFormat(Stream);
           if Assigned(GraphicClass) and GraphicClass.InheritsFrom(TCustomBitmap) then
    
    graphics.wince.diff (989 bytes)

Relationships

has duplicate 0025344 closedStephano Graphics.pp patch for compiling LCL under WinCE target 

Activities

Bart Broersma

2014-01-11 02:49

developer  

graphics.wince.diff (989 bytes)
Index: lcl/graphics.pp
===================================================================
--- lcl/graphics.pp	(revision 43692)
+++ lcl/graphics.pp	(working copy)
@@ -2791,6 +2791,9 @@
   ResHandle: TFPResourceHandle;
   Stream: TResourceStream;
   GraphicClass: TGraphicClass;
+  {$IFDEF WINCE}
+  ResNameW: WideString;
+  {$ENDIF}
 begin
   ResHandle := FindResource(Instance, PChar(ResName), PChar(RT_BITMAP));
   if ResHandle <> 0 then
@@ -2802,7 +2805,12 @@
   ResHandle := FindResource(Instance, PChar(ResName), PChar(RT_RCDATA));
   if ResHandle <> 0 then
   begin
+    {$IFDEF WINCE}
+    ResNameW := Utf8ToUtf16(ResName);
+    Stream := TResourceStream.Create(Instance, ResNameW, PWideChar(RT_RCDATA));
+    {$ELSE}
     Stream := TResourceStream.Create(Instance, PChar(ResName), PChar(RT_RCDATA));
+    {$ENDIF}
     try
       GraphicClass := GetPicFileFormats.FindByStreamFormat(Stream);
       if Assigned(GraphicClass) and GraphicClass.InheritsFrom(TCustomBitmap) then
graphics.wince.diff (989 bytes)

Bart Broersma

2014-01-11 02:51

developer   ~0072362

With proposed patch it will compile, however I have absolutely no clue if it then works as expected (I have no way to test).

Paul Ishenin

2014-01-11 04:25

manager   ~0072363

Please test.

Bart Broersma

2014-01-11 14:35

developer   ~0072370

It builds OK.
Can't test if it "works".

Issue History

Date Modified Username Field Change
2014-01-11 02:49 Bart Broersma New Issue
2014-01-11 02:49 Bart Broersma Status new => assigned
2014-01-11 02:49 Bart Broersma Assigned To => Paul Ishenin
2014-01-11 02:49 Bart Broersma File Added: graphics.wince.diff
2014-01-11 02:50 Bart Broersma Severity minor => block
2014-01-11 02:51 Bart Broersma Note Added: 0072362
2014-01-11 04:25 Paul Ishenin Fixed in Revision => 43697
2014-01-11 04:25 Paul Ishenin Note Added: 0072363
2014-01-11 04:25 Paul Ishenin Status assigned => resolved
2014-01-11 04:25 Paul Ishenin Fixed in Version => 1.4
2014-01-11 04:25 Paul Ishenin Resolution open => fixed
2014-01-11 14:35 Bart Broersma Note Added: 0072370
2014-01-11 14:35 Bart Broersma Status resolved => closed
2014-12-05 20:12 Stephano Relationship added has duplicate 0025344