En/na Vincent Snijders ha escrit:
On Wed, 27 Jun 2007 19:38:03 +0200
Luca Olivetti <[EMAIL PROTECTED]> wrote:

En/na Luca Olivetti ha escrit:
En/na Cesar Romero ha escrit:
Where S is initialized?
I only see L initialized.

[]s


Cesar Romero
442:  L:=length(s);
443:  if L<1 then exit;
444:  case s[1] of

so I can't see how it could possibly be uninitialized.
nothwithstanding the fact that if length(s)<1 line 444 won't be executed, so the "uninitialized" should be flagged in line 442, I know that this chunk is inside

procedure TButlerPhone.Receive(s: string);

so s is a parameter.
This procedure is called exclusively from

procedure TStatusThread.Receive;
begin
  FOwner.Receive(FData)
end;

(FOwner is a TButlerPhone)

which in turn is called only here:

          FData:=copy(buffer,i+2,L-1);
          if buffer[i+L+1]=checksum(FData) then
          begin
           if not terminated then synchronize(@Receive);
          end else

And another writeln confirms that L is 1 when valgrind complains, so the string is definitely initialized.

Did you write to that string or merely set its length using SetLength?

The string was passed as a value parameter, coming from fdata:


FData:=copy(buffer,i+2,L-1) (buffer is a static array of char, FData is a string, field of the class)

if buffer[i+L+1]=checksum(FData) then
  synchronize(@receive) ----->

TStatusThread.Receive;
begin
  FOwner.Receive(FData)


procedure TButlerPhone.Receive(s: string);
....
  L:=length(s);
writeln('>>>>>>>>>>>>>>>>>>>>>>> ',L); ---> to confirm, and it's always >0
  if L<1 then exit;
  case s[1] of  --> here valgrind complains




Anyway, I doubt the problems is here, it only strikes me that valgrind complains.

Bye
--
Luca

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to