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.
Reviewed-by: Brian Osman <email@example.com>
Reviewed-by: Mike Reed <firstname.lastname@example.org>
Commit-Queue: Mike Klein <email@example.com>
3 files changed