Commit e80000e6 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

comctl32: Fix return values of string functions.

parent d29c9c84
...@@ -165,8 +165,8 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) ...@@ -165,8 +165,8 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen)
TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen); TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
if (!lpDest && lpSrc) if ((!lpDest || nMaxLen == 0) && lpSrc)
return strlen (lpSrc); return (strlen(lpSrc) + 1);
if (nMaxLen == 0) if (nMaxLen == 0)
return 0; return 0;
...@@ -176,12 +176,12 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) ...@@ -176,12 +176,12 @@ INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen)
return 0; return 0;
} }
len = strlen (lpSrc); len = strlen(lpSrc) + 1;
if (len >= nMaxLen) if (len >= nMaxLen)
len = nMaxLen - 1; len = nMaxLen;
RtlMoveMemory (lpDest, lpSrc, len); RtlMoveMemory (lpDest, lpSrc, len - 1);
lpDest[len] = '\0'; lpDest[len - 1] = '\0';
return len; return len;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment