Re: [fpc-pascal] Read-only global references

2011-03-06 Thread Mark Morgan Lloyd
Marcos Douglas wrote: Make a function to return a global variable does not make it read only. If I use your function like this: o := InitText; o := nil; //this is the same xInitText = nil Disagree. You are changing the value of o, not of xInitText. xInitText is initialised once somewhere in th

Re: [fpc-pascal] TBlowfishDecryptStream flaw

2011-03-06 Thread Michael Van Canneyt
On Sat, 5 Mar 2011, Jorge Aldo G. de F. Junior wrote: i have a problem with TBlowfishDecryptStream : [snip] The problem now is that it eats chars at the end of the generated lBuffer (tested by taking a tmemorystream thru tblowfishencryptstream, then taking the result to this tblowfishdecryp

Re: [fpc-pascal] TBlowfishDecryptStream flaw

2011-03-06 Thread Jorge Aldo G. de F. Junior
Check those two programs === Program A = Program A; Uses Classes, BlowFish; Var lSource, lIntermediate : TMemoryStream; lEncrypter : TBlowfishEncryptStream; Begin lSource := TMemoryStream.Create; lSource.LoadFromFile('test7.pas')

Re: [fpc-pascal] TBlowfishDecryptStream flaw

2011-03-06 Thread Michael Van Canneyt
On Sun, 6 Mar 2011, Jorge Aldo G. de F. Junior wrote: Check those two programs === Program A = [snip] = EOF = The problem consists that, if lIntermediate.Size is not equal to lSource.Size, i will not know how much bytes to "copyfrom" from the decrypter. Correct. You may n

Re: [fpc-pascal] circular reference

2011-03-06 Thread Marcos Douglas
On Sun, Mar 6, 2011 at 4:37 AM, Mattias Gaertner wrote: > On Sat, 5 Mar 2011 23:07:45 -0300 > Marcos Douglas wrote: > >> If circular reference not is a good practice (even if to use a >> implementation section) then I have to put all code, that works >> together, in the same unit, right? > > No,

Re: [fpc-pascal] Read-only global references

2011-03-06 Thread Marcos Douglas
On Sun, Mar 6, 2011 at 6:14 AM, Mark Morgan Lloyd wrote: > Marcos Douglas wrote: > Make a function to return a global variable does not make it read only. If I use your function like this: o := InitText; o := nil;  //this is the same xInitText = nil >>> >>> Disagree. You are ch

[fpc-pascal] Re: Read-only global references

2011-03-06 Thread leledumbo
Using functions is the only way I know (still it's not that "read only", accessing from assembly code still allows modification). For pointer based types, you could give a copy of the instance instead of the original one (if you want a better read only semantics where the function has persistent re

Re: [fpc-pascal] Re: Read-only global references

2011-03-06 Thread Mark Morgan Lloyd
leledumbo wrote: Using functions is the only way I know (still it's not that "read only", accessing from assembly code still allows modification). For pointer based types, you could give a copy of the instance instead of the original one (if you want a better read only semantics where the functio

Re: [fpc-pascal] Re: Read-only global references

2011-03-06 Thread Marcos Douglas
On Sun, Mar 6, 2011 at 4:16 PM, Mark Morgan Lloyd wrote: > leledumbo wrote: >> >> Using functions is the only way I know (still it's not that "read only", >> accessing from assembly code still allows modification). For pointer based >> types, you could give a copy of the instance instead of the or