Bob Richards wrote:
[...]

According to the docs on function "Hex2Dec" in Strutils:

"If S does not contain a valid hexadecimal value, an EConvertError exception will be 
raised."

So, what profound lack of understanding am I suffering from? Anybody?


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;
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to