2011/10/27 Frédéric Delanoy <frederic.delanoy(a)gmail.com>:
On Thu, Oct 27, 2011 at 08:38, Eric Pouech <eric.pouech(a)orange.fr> wrote:
why do we check for ptr being null or not, when we deref ptr one line above?
if (*ptr == '\n') ptr++; - WCMD_output_asis_len(message, (ptr) ? ptr - message : strlenW(message), handle); + WCMD_output_asis_len(message, (ptr) ? (DWORD)(ptr - message) : strlenW(message), handle); if (ptr) { numChars = 0; if (++line_count >= max_height - 1) {
It's dereferenced but incremented afterwards, so might be null after that line
Of course if (*ptr != '\n') the check is unnecessary. I guess the original author simply wanted to merge both cases. Might need some reorganization, but that's probably outside of the scope of this patch