- return a precomputed result for a NULL string

- pass strlen an LPSTR to eliminate a sign warning
This commit is contained in:
Mike McCormack 2005-08-22 09:19:38 +00:00 committed by Alexandre Julliard
parent 6bb46e31e7
commit 6c8527c31c
1 changed files with 17 additions and 15 deletions

View File

@ -813,17 +813,20 @@ HRESULT WINAPI CoCreateGuid(GUID *pguid)
*/
HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id)
{
const BYTE *s = (const BYTE *) idstr;
const BYTE *s;
int i;
BYTE table[256];
if (!s)
s = "{00000000-0000-0000-0000-000000000000}";
else { /* validate the CLSID string */
if (!idstr) {
memset( id, 0, sizeof (CLSID) );
return S_OK;
}
if (strlen(s) != 38)
/* validate the CLSID string */
if (strlen(idstr) != 38)
return CO_E_CLASSSTRING;
s = (const BYTE *) idstr;
if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') || (s[24]!='-') || (s[37]!='}'))
return CO_E_CLASSSTRING;
@ -834,7 +837,6 @@ HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id)
((s[i] >= 'A') && (s[i] <= 'F'))))
return CO_E_CLASSSTRING;
}
}
TRACE("%s -> %p\n", s, id);