View Issue Details

IDProjectCategoryView StatusLast Update
0034928FPCDocumentationpublic2019-01-26 19:04
ReporterLacaKAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.0.4Product Build 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034928: UnicodeCharLenToString, UnicodeCharToString indicated as return type AnsiString, but in code they return UnicodeString
DescriptionThere is documented as return type AnsiString:
 https://lazarus-ccr.sourceforge.io/docs/rtl/system/unicodecharlentostring.html
 https://lazarus-ccr.sourceforge.io/docs/rtl/system/unicodechartostring.html
but real return type is UnicodeString

I do not know what should be true?
TagsNo tags attached.
Fixed in Revision1546
FPCOldBugId0
FPCTarget
Attached Files

Activities

Thaddy de Koning

2019-01-22 11:01

reporter   ~0113573

Last edited: 2019-01-22 11:03

View 3 revisions

The real return type is AnsiString as specified.
The result is very strongly typed as AnsiString.
There is also a compiler warning.....

LacaK

2019-01-22 11:45

developer   ~0113575

In rtl/inc/ustrings.inc:
1002 {*****************************************************************************
1003 Public functions, In interface.
1004 *****************************************************************************}
1005
1006 function UnicodeCharToString(S : PUnicodeChar) : *UnicodeString*;
1007 begin
1008 result:=UnicodeCharLenToString(s,Length(UnicodeString(s)));
1009 end;
...
1047 function UnicodeCharLenToString(S : PUnicodeChar;Len : SizeInt) : *UnicodeString*;
1048 begin
1049 SetLength(result,Len);
1050 Move(S^,Pointer(Result)^,Len*2);
1051 end;

Serge Anvarov

2019-01-22 23:37

reporter   ~0113587

https://www.freepascal.org/docs-html/rtl/system/unicodechartostring.html

LacaK

2019-01-23 09:46

developer   ~0113593

Yes here is function signature okay, but in text is there still: "... to an AnsiString value" same for https://www.freepascal.org/docs-html/rtl/system/unicodecharlentostring.html

Marco van de Voort

2019-01-25 13:40

manager   ~0113615

Fixed those two in r1543. Leave report open because of -var variants (like https://www.freepascal.org/docs-html/rtl/system/unicodechartostrvar.html)

that are overloaded which the docs don't show.

Michael Van Canneyt

2019-01-26 10:18

administrator   ~0113632

Thanks Marco. I fixed the remaining unicode/widestring versions.

@Laco, in case of doubt: the declaration is always correct, it comes from the sources itself.

Issue History

Date Modified Username Field Change
2019-01-22 10:24 LacaK New Issue
2019-01-22 10:24 LacaK Status new => assigned
2019-01-22 10:24 LacaK Assigned To => Michael Van Canneyt
2019-01-22 11:01 Thaddy de Koning Note Added: 0113573
2019-01-22 11:02 Thaddy de Koning Note Edited: 0113573 View Revisions
2019-01-22 11:03 Thaddy de Koning Note Edited: 0113573 View Revisions
2019-01-22 11:45 LacaK Note Added: 0113575
2019-01-22 23:37 Serge Anvarov Note Added: 0113587
2019-01-23 09:46 LacaK Note Added: 0113593
2019-01-25 12:55 Marco van de Voort Fixed in Revision => 1543
2019-01-25 13:40 Marco van de Voort Note Added: 0113615
2019-01-26 10:18 Michael Van Canneyt Fixed in Revision 1543 => 1546
2019-01-26 10:18 Michael Van Canneyt Note Added: 0113632
2019-01-26 10:18 Michael Van Canneyt Status assigned => resolved
2019-01-26 10:18 Michael Van Canneyt Fixed in Version => 3.3.1
2019-01-26 10:18 Michael Van Canneyt Resolution open => fixed
2019-01-26 10:18 Michael Van Canneyt Target Version => 3.2.0
2019-01-26 19:04 LacaK Status resolved => closed