Menu

range checking - bug?

2002-03-26
2002-03-26
  • Jiri Barton

    Jiri Barton - 2002-03-26

    I'm using Delphi 6 SP2 on Win2k. Have someone tried to run an app with Direct SQL having Range Checking enabled?
    Then, I get the range checking error in uMysqlVio, Line 959: ip_addr := inet_addr(PHost);
    - and it happens everytime I run it.

    I could post the source code of the demo, if someone's interested - it's really only testing the connection.

     
    • Cristian Nicola

      Cristian Nicola - 2002-03-26

      It isnt a bug .. actually is just a simple mistake .. for some strange reasons delphi reports range checking errors on large integers if you use cardinal data-type. To fix this problem just replace in line 735 (uMysqlVio new version - vio_open var section) the
          ip_addr:cardinal;
      with
          ip_addr:longint;
      I hope there arent any other places where there is something similar :), but nevertheless if you get a range checking on a cardinal just switch it to a longint.
      Regards,
      Cristian Nicola
      ps
      From delphi help
      Longint    signed 32-bit
      Cardinal unsigned 32-bit
      The range checking error comes when the sign bit is used (altough it is still a valid cardinal value).

       
    • Nobody/Anonymous

      You could just typecast the result of inet_addr to cardinal:
      ip_addr := cardinal(inet_addr(pchar(host)));
      in line 959.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.