# HG changeset patch # User Matt Harbison # Date 1426301440 14400 # Node ID f208ce59a6e58cf73bd32aa63044080cfeb9f4ca # Parent e02a0a4194180287f997bc7ea7290e671730def8 manifest.c: ensure realloc_if_full() returns 1 or 0 This fixes an MSVC 2008 warning that I don't see with gcc 4.6.3-2: warning C4047: 'return' : 'bool' differs in levels of indirection from 'line *' More importantly, the truncation from pointer to 'unsigned char' would have returned 0 if self->lines pointed to an address divisible by 0xFF, which causes find_lines() to return MANIFEST_OOM. I was able to cause this to happen in a trivial program with the gcc compiler. diff -r e02a0a419418 -r f208ce59a6e5 mercurial/manifest.c --- a/mercurial/manifest.c Thu Mar 12 14:20:32 2015 -0700 +++ b/mercurial/manifest.c Fri Mar 13 22:50:40 2015 -0400 @@ -104,7 +104,7 @@ self->maxlines *= 2; self->lines = realloc(self->lines, self->maxlines * sizeof(line)); } - return self->lines; + return !!self->lines; } /*