[fpc-pascal] A simple "exception handling" question

Bob Richards bob at tamara-b.org
Sun Jan 29 05:20:02 CET 2006


Michalis Kamburelis wrote:

> There's a bug in Hex2Dec implementation -- it returns 0 instead of
> raising EConvertError. Here's a patch:
> 
> Index: strutils.pp
> ===================================================================
> --- strutils.pp    (wersja 2298)
> +++ strutils.pp    (kopia robocza)
> @@ -1156,7 +1156,7 @@
>      HexStr:='$'+ S
>    else
>      HexStr:=S;
> -  Result:=StrTointDef(HexStr,0);
> +  Result:=StrToint(HexStr);
>  end;
> 
>  function Dec2Numb(N: Longint; Len, Base: Byte): string;
> _______________________________________________

First, thanks for the reply; I applied the patch, it applied without a problem, verified
the new StrUtils.pp source, all OK as per the patch. Recompiled strutils.ppu. The function
still returns a zero on error.

Is there another patch I need as well?
This is fpc 2.0.0 on Linux, but at this level I don't think it should matter.

Sorry for being dense :-(

Bob

-- 
PGP Encrypted E-Mail Prefered
Public Key at: http://www.tamara-b.org/~bob/pubkey.asc
.



More information about the fpc-pascal mailing list