Menu

another range checking;-)

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

    Jiri Barton - 2002-03-26

    procedure hashPassword in uMsqlclient, line 444: nr2:= nr2+((nr2 shl 8) xor nr); This error arrises because you add two int64 and the result often exceeds the maxint for int64. How can I tell D6 to ignore this?

     
    • Nobody/Anonymous

      As before .. typecast it :)
      nr2:= int64(nr2+((nr2 shl 8) xor nr));
      and if that is not enough, you may need to typecast the operands too
      nr2:= int64(nr2+int64(int64(nr2 shl int64(8)) xor int64(nr))); something like that ... but i guess the first one should be ok.
      Regards,
      Cristian

       
    • Jiri Barton

      Jiri Barton - 2002-03-26

      I tried that, but it still throws Range Error:-( The integer range overflow occurs before it is typecasted.

       
      • Nobody/Anonymous

        It is quite weird as i can't reproduce that one .. yet .. haev you tried to typecast all operands so the operations will be done on 64 bits?

        Cristian

         
        • Jiri Barton

          Jiri Barton - 2002-03-27

          Sorry, it is integer overflow checking and can be turned off for the specific line as follows:

          {$IFOPT Q+}{$DEFINE RISON}{$ENDIF}{$Q-}
          nr2:= nr2+((nr2 shl 8) xor nr);
          {$IFDEF RISON}{$Q+}{$UNDEF RISON}{$ENDIF}

           
    • Nobody/Anonymous

      Thank you very much for your contribution. I will upload today a version with both checks active.
      Once again many thanks.
      Cristian
      ps: wouldnt you be interested to join the project?
      ps2: if you know someone who may need a delphi programmer .. i'm looking

       
      • Jiri Barton

        Jiri Barton - 2002-03-27

        Interested: yes, having time: no. I'm currently working for a non-profit org on compulsary basis (!), writing a db (my first:-). So I'm just beginning with db, but have a vast background on UI and simulations (BCB for 6 years, Delphi 3 years) and C++ (for 10 years).
        So I'd like to stay DirectSQL tester:-) I might switch the server to PostgreSQL so I was pleased to see your plans for the PostgreSQL (I've found only shareware drivers so far:-(

         
    • Nobody/Anonymous

      Wellcome in :)
      Yet considering your experience i think you could do more than just testing .. if you will look to the overall time scale of the project you will see that i don't have alot of free time either ... So it is pretty much a free time project.
      I'm wondering if there is any other (better) way we could talk except this forum .. as i would really love to ask you some advanced c questions (if you have time of course).

      Cristian

       

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.