View Issue Details

IDProjectCategoryView StatusLast Update
0037481pas2jsrtlpublic2020-08-06 14:16
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWebOSWindows 
Fixed in Versiontrunk 
Summary0037481: Problems finding resources
DescriptionWhen a unit is declared with names with uppercase letters, RTL does not find the resource because they put a Lowercase in the search. I've attached the fix.
TagsNo tags attached.
Fixed in Revision46228
Attached Files

Activities

henrique

2020-08-04 15:19

reporter  

p2jsres.pp.patch (349 bytes)   
Index: p2jsres.pp
===================================================================
--- p2jsres.pp	(revision 807)
+++ p2jsres.pp	(working copy)
@@ -90,7 +90,7 @@
   RTLInfo : TRTLResourceInfo;
 
 begin
-  RTLInfo:=rtlGetResource(lowercase(aName));
+  RTLInfo:=rtlGetResource(aName);
   Result:=Assigned(RTLInfo);
   if Result then
     begin
p2jsres.pp.patch (349 bytes)   

Michael Van Canneyt

2020-08-04 15:43

administrator   ~0124544

The fix was actually elsewhere.
Resourcenames are case insensitive, so they must be written lowercased. I fixed the compiler.

Thanks for reporting !

henrique

2020-08-05 23:03

reporter   ~0124587

It still doesn't work. I attached a patch with the fix.

henrique

2020-08-05 23:04

reporter   ~0124588

p2jsres.patch (662 bytes)   
From 5801f8de96be752662fc1c756a80a4ae43babd58 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Wed, 5 Aug 2020 18:01:45 -0300
Subject: [PATCH] GitignoreAAA

---
 packages/rtl/p2jsres.pp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/rtl/p2jsres.pp b/packages/rtl/p2jsres.pp
index 8179e1b..926ba9b 100644
--- a/packages/rtl/p2jsres.pp
+++ b/packages/rtl/p2jsres.pp
@@ -90,7 +90,7 @@ Var
   RTLInfo : TRTLResourceInfo;
 
 begin
-  RTLInfo:=rtlGetResource(lowercase(aName));
+  RTLInfo:=rtlGetResource(aName);
   Result:=Assigned(RTLInfo);
   if Result then
     begin
-- 
2.28.0.windows.1

p2jsres.patch (662 bytes)   

Michael Van Canneyt

2020-08-05 23:08

administrator   ~0124589

Last edited: 2020-08-05 23:09

View 2 revisions

Your patch is not correct either.

The resource names must be case insensitive.
For this reason, the compiler writes them lowercase, the RTL routines must read them lowercase.

If there are non-lowercase names, the compiler must be fixed, not the RTL.

henrique

2020-08-06 13:20

reporter   ~0124612

Adjusted compiler to save resource name in minuscule letters.
pas2jsjsresources.patch (882 bytes)   
From 46b1c0ad5e411397352522e050528dee6f5d987c Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Thu, 6 Aug 2020 08:19:17 -0300
Subject: [PATCH] Corrigido bug de resource.

---
 src/pas2jsjsresources.pp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pas2jsjsresources.pp b/src/pas2jsjsresources.pp
index 02bba96..4b43ca5 100644
--- a/src/pas2jsjsresources.pp
+++ b/src/pas2jsjsresources.pp
@@ -83,7 +83,7 @@ begin
   aName:=Options.Values['name'];
   if aName='' then
     aName:=ChangeFileExt(ExtractFileName(aFileName),'');
-  Result:=Format(SAddResource,[aName,LowerCase(CurrentUnitName),aFormat,aData]);
+  Result:=Format(SAddResource,[LowerCase(aName),LowerCase(CurrentUnitName),aFormat,aData]);
 end;
 
 procedure TJSResourceHandler.HandleResource(aFileName: string; Options: TStrings);
-- 
2.28.0.windows.1

pas2jsjsresources.patch (882 bytes)   

Michael Van Canneyt

2020-08-06 14:16

administrator   ~0124613

Well, you beat me to it. Thank you very much :-)

Committed in revision r46287.

Issue History

Date Modified Username Field Change
2020-08-04 15:19 henrique New Issue
2020-08-04 15:19 henrique File Added: p2jsres.pp.patch
2020-08-04 15:43 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-08-04 15:43 Michael Van Canneyt Status new => resolved
2020-08-04 15:43 Michael Van Canneyt Resolution open => fixed
2020-08-04 15:43 Michael Van Canneyt Fixed in Version => trunk
2020-08-04 15:43 Michael Van Canneyt Fixed in Revision => 46228
2020-08-04 15:43 Michael Van Canneyt Note Added: 0124544
2020-08-05 23:03 henrique Status resolved => feedback
2020-08-05 23:03 henrique Resolution fixed => open
2020-08-05 23:03 henrique Note Added: 0124587
2020-08-05 23:04 henrique Note Added: 0124588
2020-08-05 23:04 henrique File Added: p2jsres.patch
2020-08-05 23:04 henrique Status feedback => assigned
2020-08-05 23:08 Michael Van Canneyt Note Added: 0124589
2020-08-05 23:09 Michael Van Canneyt Note Edited: 0124589 View Revisions
2020-08-06 13:20 henrique Note Added: 0124612
2020-08-06 13:20 henrique File Added: pas2jsjsresources.patch
2020-08-06 14:16 Michael Van Canneyt Status assigned => resolved
2020-08-06 14:16 Michael Van Canneyt Resolution open => fixed
2020-08-06 14:16 Michael Van Canneyt Note Added: 0124613