[libpng16] use PNG_LIBPNG_VER_STRING[i] in png_user_version_check()

This commit is contained in:
Glenn Randers-Pehrson 2014-11-05 15:02:45 -06:00
parent a2fe24d186
commit 5be76ae252

31
png.c
View File

@ -178,38 +178,39 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
do do
{ {
i++; i++;
if (user_png_ver[i] != png_libpng_ver[i]) if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (user_png_ver[i] == '.') if (user_png_ver[i] == '.')
found_dots++; found_dots++;
} while (found_dots < 2 && png_libpng_ver[i] != 0 && user_png_ver[i] != 0); } while (found_dots < 2 && user_png_ver[i] != 0 &&
PNG_LIBPNG_VER_STRING[i] != 0);
} }
else else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if ((png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) != 0) if ((png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) != 0)
{ {
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
size_t pos = 0; size_t pos = 0;
char m[128]; char m[128];
pos = png_safecat(m, (sizeof m), pos, pos = png_safecat(m, (sizeof m), pos,
"Application built with libpng-"); "Application built with libpng-");
pos = png_safecat(m, (sizeof m), pos, user_png_ver); pos = png_safecat(m, (sizeof m), pos, user_png_ver);
pos = png_safecat(m, (sizeof m), pos, " but running with "); pos = png_safecat(m, (sizeof m), pos, " but running with ");
pos = png_safecat(m, (sizeof m), pos, png_libpng_ver); pos = png_safecat(m, (sizeof m), pos, PNG_LIBPNG_VER_STRING);
PNG_UNUSED(pos) PNG_UNUSED(pos)
png_warning(png_ptr, m); png_warning(png_ptr, m);
#endif #endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_ptr->flags = 0; png_ptr->flags = 0;
#endif #endif
return 0; return 0;
} }
/* Success return. */ /* Success return. */
return 1; return 1;