Ok here is what's bizarre:

Remember this was working application, The only thing I have done,
between the  working build and the build that is causing exceptions is
to change my folder structure around and backup!

I thought it was time to think `outside the box', so last night I
tried deleting the dcu file for the encrypt unit, I had tried `build
all projects' before in the case something had been corrupted but
thought I would try it anyway. Compiled again but no change, my main
app still caused exception errors.

So this morning I thought I would try adding the encrypt unit to
another project, So I  made another project, and added the `offending'
unit. Added a button that on clicking would call the procedure in
exactly the same way as my first app does. The new project  works
fine….. doesn't even care if range and overflow are checked or
unchecked!!! I did not change ANY code in the encrypt unit!!!! So just
went back to my original app, compiled and……………….. it all worked just
like it used to……….

So I seemed to have solved the problem!  


But it leaves me baffled and worried that it might happen again and
wondering what happened, why and will it happen again? 

And I still don't understand why I can quiet happily assign a number
much larger than the word limit to a word variable, whether range
checking is on or off. Reminds me a bit of C where your allowed to do
anything you want.

BTW I'm running D6 on winXP Pro.

Pete


--- In [email protected], "petesouthwest" <[EMAIL PROTECTED]>
wrote:
>
> Hi
> 
> C1 and C2 are constants and have the same value in both the test app
> that works and the app that causes the exception. The values are the
> same as on the original code.
> 
> Pete
> 
> --- In [email protected], [EMAIL PROTECTED] wrote:
> >
> > C1 and C2 do not look to be defined in the body of the function. Can
> you 
> > investigate this path?
> > 
> > Horia
> > 
> > 
> > 
> >
>
--------------------------------------------------------------------------------
> > From: [email protected] [mailto:[EMAIL PROTECTED]
> On Behalf Of 
> > petesouthwest
> > Sent: Friday, January 13, 2006 12:13 PM
> > To: [email protected]
> > Subject: [delphi-en] Problem with out of range error
> > 
> > 
> > Hi
> > 
> > I thought I had successfully added some code I found to
> > encrypt/decrypt a string into my project.
> > I found the code in several places and it appeared that most people
> > thought it worked. It had been written by someone in TeamB too. 
> > 
> > However, although it worked fine when i first added and compiled my
> > application, it seems to have developed an odd error with this
function:
> > function InternalEncrypt(const S: AnsiString; Key: Word): AnsiString;
> > var
> >   I: Word;
> >   Seed: Word;
> > begin
> >   Result := S;
> >   Seed := Key;
> >   for I := 1 to Length(Result) do
> >   begin
> >     Result[I] := Char(Byte(Result[I]) xor (Seed shr 8));
> >     Seed := (Byte(Result[I]) + Seed) * Word(C1) + Word(C2)
> >   end
> > end;
> > 
> > ..........
> >
>







-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to