Fix some GCC warnings.

Drop unnecessary () in `const char* (*fText)`.  Sure, whatever.

Then a couple tweaks where we use strncpy():

    In one case in SkICC.cpp, GCC warns us we're passing sizeof(dst) as
    the copy count, which can be error prone because you may miss a
    terminating nul.  I believe the existing strncpy() behavior is what
    we want here, so I've stifled this and left a note.  We don't really
    want a terminating nul... we want a zero fill of the remaining dst.

    On the other side of that if-statment in that same function, GCC
    warns that we've passed exactly sizeof(src) as the copy count when
    writing the calculated description prefix, which again might be
    buggy due to a missed terminating nul.  Seemed like memcpy() was the
    way to go here for that prefix. Ultimately we check to make sure we
    wrote every single destination byte.

    Over in SkPDFMetadata.cpp, strncpy() is concerned once again that
    we're copying strlen(src) and thus omitting the terminating nul.  As
    usual we don't want that terminating nul, so switch to memcpy() to
    make that explicit.

I'm starting to think strncpy() is too helpful to reason about sanely.

Change-Id: I1bcd5f4e406ca388c1c236c5f3ee531bf1737705
Reviewed-by: Brian Osman <>
Reviewed-by: Mike Reed <>
Commit-Queue: Mike Klein <>
3 files changed