msvcrt: Update search position when no token was found in strtok.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
32bbef5d3e
commit
bf7244442d
|
@ -287,7 +287,11 @@ char * CDECL strtok( char *str, const char *delim )
|
||||||
if (!(str = data->strtok_next)) return NULL;
|
if (!(str = data->strtok_next)) return NULL;
|
||||||
|
|
||||||
while (*str && strchr( delim, *str )) str++;
|
while (*str && strchr( delim, *str )) str++;
|
||||||
if (!*str) return NULL;
|
if (!*str)
|
||||||
|
{
|
||||||
|
data->strtok_next = str;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
ret = str++;
|
ret = str++;
|
||||||
while (*str && !strchr( delim, *str )) str++;
|
while (*str && !strchr( delim, *str )) str++;
|
||||||
if (*str) *str++ = 0;
|
if (*str) *str++ = 0;
|
||||||
|
|
|
@ -1685,6 +1685,14 @@ static void test_strtok(void)
|
||||||
"third call string (%p) \'%s\' return %p\n",
|
"third call string (%p) \'%s\' return %p\n",
|
||||||
teststr, testcases_strtok[i].string, strret);
|
teststr, testcases_strtok[i].string, strret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strcpy( teststr, "test a=b" );
|
||||||
|
strret = strtok( teststr, " " );
|
||||||
|
ok( strret == teststr, "strret = %p, expected %p\n", strret, teststr );
|
||||||
|
strret = strtok( NULL, "ab=" );
|
||||||
|
ok( !strret, "strret = %p, expected NULL\n", strret );
|
||||||
|
strret = strtok( NULL, "=" );
|
||||||
|
ok( !strret, "strret = %p, expected NULL\n", strret );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_strtol(void)
|
static void test_strtol(void)
|
||||||
|
|
Loading…
Reference in New Issue