On Fri, 14 Sep 2007 09:41:18 +0100
"James Urquhart" <[EMAIL PROTECTED]> wrote:

> Alban,
> 
> The reference for strncpy states:
> 
> "Copies the first num characters of source to destination. If the end
> of the source C string (which is signaled by a null-character) is
> found before num characters have been copied, destination is padded
> with zeros until a total of num characters have been written to it."
> 
> Thus the string should automatically be 0 padded.

Right, seems that I always jumped over that last sentence in the man
page.

> I was going to just do it byte-by-byte, but then that would likely
> have overcomplicated the code.

As I said it's just taste, but I find something like this much more
explicit:

        for(i=0 ; i < 9 && r->sym->sym[i] ; i++)
            scc_fd_w8(fd,~r->sym->sym[i]);
        for( ; i < 9 ; i++)
            scc_fd_w8(fd,0xFF);

> With regards to ^=, i can't seem to find a binary not operator, only a
> logical not operator. So xor with 0xFF is a suitable alternative -
> which is what actually what ScummVM does too.

The xor will work just fine, no pb there. But as a^0xFF == ~a I find the
first form is a kind of light obfuscation.

Anyway, all this nitpicking aside I'm going to apply your patch.

        Albeu


_______________________________________________
ScummC-general mailing list
[email protected]
https://mail.gna.org/listinfo/scummc-general

Reply via email to