Imported from libpng-1.2.14rc1.tar

This commit is contained in:
Glenn Randers-Pehrson
2006-11-20 07:55:23 -06:00
parent 11a89964b9
commit b8e76b586e
44 changed files with 124 additions and 112 deletions

View File

@@ -16,27 +16,29 @@
#if defined(PNG_READ_SUPPORTED)
#if defined(_WIN32_WCE)
#ifdef PNG_FLOATING_POINT_SUPPORTED
# if defined(_WIN32_WCE)
/* strtod() function is not supported on WindowsCE */
# ifdef PNG_FLOATING_POINT_SUPPORTED
__inline double strtod(const char *nptr, char **endptr)
__inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr)
{
double result = 0;
int len;
wchar_t *str, *end;
len = MultiByteToWideChar(CP_ACP, 0, nptr, -1, NULL, 0);
str = (wchar_t *)malloc(len * sizeof(wchar_t));
str = (wchar_t *)png_malloc(png_ptr, len * sizeof(wchar_t));
if ( NULL != str )
{
MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len);
result = wcstod(str, &end);
len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL);
*endptr = (char *)nptr + (png_strlen(nptr) - len + 1);
free(str);
png_free(str);
}
return result;
}
# else
# define png_strtod(p,a,b) strtod(a,b)
# endif
#endif
@@ -1731,7 +1733,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
ep = buffer + 1; /* skip unit byte */
#ifdef PNG_FLOATING_POINT_SUPPORTED
width = strtod(ep, &vp);
width = png_strtod(png_ptr, ep, &vp);
if (*vp)
{
png_warning(png_ptr, "malformed width string in sCAL chunk");
@@ -1754,7 +1756,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
ep++;
#ifdef PNG_FLOATING_POINT_SUPPORTED
height = strtod(ep, &vp);
height = png_strtod(png_ptr, ep, &vp);
if (*vp)
{
png_warning(png_ptr, "malformed height string in sCAL chunk");