Recent

Author Topic: General „Is it a bug in FP/ Lazarus“ thread.  (Read 17106 times)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #15 on: December 17, 2013, 12:30:30 am »
Oddly, sometimes BCDToInt(120) returns 78, and sometimes it returns 120 >:(

You mean it returns different result with the same parameter value?

Quote
I suppose you are talking about that:
Code: [Select]

TBcd  = packed record
   Precision: Byte;
   SignSpecialPlaces: Byte;
   Fraction: packed array [0..31] of Byte;
 end;

Right. I don't know how an integer can be casted to TBcd.
You could ask about it in FPC mailing list. Some of the clever FPC devels will know.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #16 on: December 17, 2013, 12:40:40 pm »
Oddly, sometimes BCDToInt(120) returns 78, and sometimes it returns 120 >:(

You mean it returns different result with the same parameter value?
 
Well, I just found why. There are two functions. BCDtoInt and BCDToInteger.

BCDToInt(120)= 78 //BCDToInt does not belong to FmtBCD
BCDToInteger (120)=120
The correct use for  BCDToInteger and BCDToString is
Code: [Select]
var
  MyBCD: tBCD;
begin
  MyBCD.Fraction[0]:=120; //hex 12
MyBCD.Precision:=2;  //app crashes if precision is not stated.
ShowMessage (IntToStr (BCDToInteger(MyBCD)));
  ShowMessage (BCDToStr(MyBCD));
end;
Well, yet still it is not that simple. If a wrong byte is sent the app crashes (exception is generated). Practically either exceptions shall be handled, or the byte array shall be checked for BCD validity first.
And yet, no direction of conversion is given, so the byte array might need to be reversed, before conversion.
So there is a bug and it is just as you explained-  BCDToStr and BCDToInteger accept integer values, but they should not. And when they do, they return a wrong result.
« Last Edit: December 17, 2013, 12:43:38 pm by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Timewarp

  • Full Member
  • ***
  • Posts: 144
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #17 on: February 05, 2014, 06:08:28 pm »
Just noticed, maybe FPC rev26434 should be merged to fixes branch also

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #18 on: February 05, 2014, 07:40:49 pm »
Maybe somebody did :-)

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #19 on: July 21, 2014, 12:40:49 pm »
When using PO files to translate Lazarus apps, some strings are marked as FUZZY.
When PO files are used in native *nix apps, strings marked at FUZZY are a ignored.
But Lazarus does not ignore them, which is definitely a problem, because such strings often occur after automatic translation with for example PoEdit, whose automatic translations are often disastrous.
Example:
Code: [Select]
#: tfobject3d.rendering.caption
#, fuzzy
msgid "Rendering"
msgstr "Измазване"
In an application, the displayed text shall be Rendering,  because the entry is marked as fuzzy, but in Lazarus apps  displayed text is  Измазване.
Maybe there is a way to tell Lazarus to ignore fuzzy strings, or that is simply a bug?
« Last Edit: July 25, 2014, 09:21:08 am by paskal »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #20 on: July 21, 2014, 12:54:28 pm »
The logical solution would seem to fix the fuzzy translation IMO.
http://www.gnu.org/software/gettext/manual/html_node/Fuzzy-Entries.html
"Fuzzy entries, even if they account for translated entries for most other purposes, usually call for revision by the translator."
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #21 on: July 24, 2014, 12:23:00 pm »
Yes, the logical solution is that the translator should check fuzzy items, but the translated values shall not be displayed, until the fuzzy flag is removed. Our Gnome translation coordinator confirmed that this is how it should be.
I will report it as a bug.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

CM630

  • Hero Member
  • *****
  • Posts: 1091
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: General „Is it a bug in FP/ Lazarus“ thread.
« Reply #22 on: July 25, 2014, 09:28:53 am »
Reported as bug 26527.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018