mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng10] Imported from libpng-1.0.22rc1.tar
This commit is contained in:
16
pngrutil.c
16
pngrutil.c
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user