msvcirt: Implement istream::get for strings.
Signed-off-by: Iván Matellanes <matellanes.ivan@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f4bc213ce5
commit
14722ba20a
|
@ -3110,7 +3110,37 @@ void __thiscall istream_isfx(istream *this)
|
|||
DEFINE_THISCALL_WRAPPER(istream_get_str_delim, 16)
|
||||
istream* __thiscall istream_get_str_delim(istream *this, char *str, int count, int delim)
|
||||
{
|
||||
FIXME("(%p %p %d %d) stub\n", this, str, count, delim);
|
||||
ios *base = istream_get_ios(this);
|
||||
int ch, i = 0;
|
||||
|
||||
TRACE("(%p %p %d %d)\n", this, str, count, delim);
|
||||
|
||||
if (istream_ipfx(this, 1)) {
|
||||
while (i < count - 1) {
|
||||
if ((ch = streambuf_sgetc(base->sb)) == EOF) {
|
||||
base->state |= IOSTATE_eofbit;
|
||||
if (!i) /* tried to read, but not a single character was obtained */
|
||||
base->state |= IOSTATE_failbit;
|
||||
break;
|
||||
}
|
||||
if (ch == delim) {
|
||||
if (this->extract_delim) { /* discard the delimiter */
|
||||
streambuf_stossc(base->sb);
|
||||
this->count++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (str)
|
||||
str[i] = ch;
|
||||
streambuf_stossc(base->sb);
|
||||
i++;
|
||||
}
|
||||
this->count += i;
|
||||
istream_isfx(this);
|
||||
}
|
||||
if (str && count) /* append a null terminator, unless a string of 0 characters was requested */
|
||||
str[i] = 0;
|
||||
this->extract_delim = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -3121,8 +3151,7 @@ istream* __thiscall istream_get_str_delim(istream *this, char *str, int count, i
|
|||
DEFINE_THISCALL_WRAPPER(istream_get_str, 16)
|
||||
istream* __thiscall istream_get_str(istream *this, char *str, int count, char delim)
|
||||
{
|
||||
FIXME("(%p %p %d %c) stub\n", this, str, count, delim);
|
||||
return this;
|
||||
return istream_get_str_delim(this, str, count, (unsigned char) delim);
|
||||
}
|
||||
|
||||
/* ?get@istream@@QAEAAV1@PAEHD@Z */
|
||||
|
@ -3130,8 +3159,7 @@ istream* __thiscall istream_get_str(istream *this, char *str, int count, char de
|
|||
DEFINE_THISCALL_WRAPPER(istream_get_unsigned_str, 16)
|
||||
istream* __thiscall istream_get_unsigned_str(istream *this, unsigned char *str, int count, char delim)
|
||||
{
|
||||
FIXME("(%p %p %d %c) stub\n", this, str, count, delim);
|
||||
return this;
|
||||
return istream_get_str(this, (char*) str, count, delim);
|
||||
}
|
||||
|
||||
/* ?get@istream@@QAEAAV1@AAC@Z */
|
||||
|
|
|
@ -311,6 +311,8 @@ static istream* (*__thiscall p_istream_assign)(istream*, const istream*);
|
|||
static void (*__thiscall p_istream_vbase_dtor)(istream*);
|
||||
static void (*__thiscall p_istream_eatwhite)(istream*);
|
||||
static int (*__thiscall p_istream_ipfx)(istream*, int);
|
||||
static istream* (*__thiscall p_istream_get_str_delim)(istream*, char*, int, int);
|
||||
static istream* (*__thiscall p_istream_get_str)(istream*, char*, int, char);
|
||||
|
||||
/* Emulate a __thiscall */
|
||||
#ifdef __i386__
|
||||
|
@ -510,6 +512,8 @@ static BOOL init(void)
|
|||
SET(p_istream_vbase_dtor, "??_Distream@@QEAAXXZ");
|
||||
SET(p_istream_eatwhite, "?eatwhite@istream@@QEAAXXZ");
|
||||
SET(p_istream_ipfx, "?ipfx@istream@@QEAAHH@Z");
|
||||
SET(p_istream_get_str_delim, "?get@istream@@IEAAAEAV1@PEADHH@Z");
|
||||
SET(p_istream_get_str, "?get@istream@@QEAAAEAV1@PEADHD@Z");
|
||||
} else {
|
||||
p_operator_new = (void*)GetProcAddress(msvcrt, "??2@YAPAXI@Z");
|
||||
p_operator_delete = (void*)GetProcAddress(msvcrt, "??3@YAXPAX@Z");
|
||||
|
@ -631,6 +635,8 @@ static BOOL init(void)
|
|||
SET(p_istream_vbase_dtor, "??_Distream@@QAEXXZ");
|
||||
SET(p_istream_eatwhite, "?eatwhite@istream@@QAEXXZ");
|
||||
SET(p_istream_ipfx, "?ipfx@istream@@QAEHH@Z");
|
||||
SET(p_istream_get_str_delim, "?get@istream@@IAEAAV1@PADHH@Z");
|
||||
SET(p_istream_get_str, "?get@istream@@QAEAAV1@PADHD@Z");
|
||||
}
|
||||
SET(p_ios_static_lock, "?x_lockc@ios@@0U_CRT_CRITICAL_SECTION@@A");
|
||||
SET(p_ios_lockc, "?lockc@ios@@KAXXZ");
|
||||
|
@ -3418,6 +3424,7 @@ static void test_istream(void)
|
|||
const char filename1[] = "test1";
|
||||
const char filename2[] = "test2";
|
||||
int fd, ret;
|
||||
char buffer[32];
|
||||
|
||||
memset(&is1, 0xab, sizeof(istream));
|
||||
memset(&is2, 0xab, sizeof(istream));
|
||||
|
@ -3731,6 +3738,234 @@ if (0) /* crashes on native */
|
|||
ok(fb2.base.pbase == NULL, "wrong put base, expected %p got %p\n", NULL, fb2.base.pbase);
|
||||
ok(fb2.base.pptr == NULL, "wrong put pointer, expected %p got %p\n", NULL, fb2.base.pptr);
|
||||
|
||||
/* get_str_delim */
|
||||
is1.extract_delim = is1.count = 0xabababab;
|
||||
is1.base_ios.state = IOSTATE_badbit;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 30, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == (IOSTATE_badbit|IOSTATE_failbit), "expected %d got %d\n",
|
||||
IOSTATE_badbit|IOSTATE_failbit, is1.base_ios.state);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
is1.extract_delim = is1.count = 0xabababab;
|
||||
is1.base_ios.state = IOSTATE_goodbit;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 30, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == (IOSTATE_eofbit|IOSTATE_failbit), "expected %d got %d\n",
|
||||
IOSTATE_eofbit|IOSTATE_failbit, is1.base_ios.state);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
is1.extract_delim = is1.count = 0xabababab;
|
||||
is1.base_ios.state = IOSTATE_goodbit;
|
||||
is1.base_ios.flags = 0;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 0, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(buffer[0] == 'A', "expected 65 got %d\n", buffer[0]);
|
||||
is1.extract_delim = is1.count = 0xabababab;
|
||||
fb1.base.eback = fb1.base.gptr = fb1.base.base;
|
||||
fb1.base.egptr = fb1.base.base + 30;
|
||||
strcpy(fb1.base.base, " give \n you 11 ! up\t. ");
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 30, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 29, "expected 29 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 29, "wrong get pointer, expected %p got %p\n", fb1.base.base + 29, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base, 29), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[29] == 0, "expected 0 got %d\n", buffer[29]);
|
||||
fb1.base.gptr = fb1.base.egptr;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 1, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 30, "wrong get pointer, expected %p got %p\n", fb1.base.base + 30, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
is1.base_ios.flags = FLAGS_skipws;
|
||||
fb1.base.gptr = fb1.base.base;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 19, "expected 19 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 19, "wrong get pointer, expected %p got %p\n", fb1.base.base + 19, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base, 19), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[19] == 0, "expected 0 got %d\n", buffer[19]);
|
||||
fb1.base.gptr = fb1.base.base + 20;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 10, "expected 10 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_eofbit, "expected %d got %d\n", IOSTATE_eofbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base + 20, 10), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[10] == 0, "expected 0 got %d\n", buffer[10]);
|
||||
is1.extract_delim = 1;
|
||||
is1.base_ios.state = IOSTATE_goodbit;
|
||||
fb1.base.eback = fb1.base.base;
|
||||
fb1.base.gptr = fb1.base.base + 20;
|
||||
fb1.base.egptr = fb1.base.base + 30;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, -1);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 10, "expected 10 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_eofbit, "expected %d got %d\n", IOSTATE_eofbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base + 20, 10), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[10] == 0, "expected 0 got %d\n", buffer[10]);
|
||||
is1.base_ios.state = IOSTATE_goodbit;
|
||||
fb1.base.eback = fb1.base.gptr = fb1.base.base;
|
||||
fb1.base.egptr = fb1.base.base + 30;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, '\n');
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 9, "expected 9 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 9, "wrong get pointer, expected %p got %p\n", fb1.base.base + 9, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base, 9), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[9] == 0, "expected 0 got %d\n", buffer[9]);
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, '\n');
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 9, "wrong get pointer, expected %p got %p\n", fb1.base.base + 9, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
is1.extract_delim = 0xabababab;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, '\n');
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 1, "expected 1 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 10, "wrong get pointer, expected %p got %p\n", fb1.base.base + 10, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
*fb1.base.gptr = -50;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 2, -50);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 1, "expected 1 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 11, "wrong get pointer, expected %p got %p\n", fb1.base.base + 11, fb1.base.gptr);
|
||||
ok(buffer[0] == -50, "expected 0 got %d\n", buffer[0]);
|
||||
ok(buffer[1] == 0, "expected 0 got %d\n", buffer[1]);
|
||||
*fb1.base.gptr = -50;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 2, 206);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 11, "wrong get pointer, expected %p got %p\n", fb1.base.base + 11, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
is1.extract_delim = 3;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 2, 206);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 1, "expected 1 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 12, "wrong get pointer, expected %p got %p\n", fb1.base.base + 12, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 20, '!');
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 6, "expected 6 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 18, "wrong get pointer, expected %p got %p\n", fb1.base.base + 18, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base + 12, 6), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[6] == 0, "expected 0 got %d\n", buffer[6]);
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, NULL, 5, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 4, "expected 4 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 22, "wrong get pointer, expected %p got %p\n", fb1.base.base + 22, fb1.base.gptr);
|
||||
fb1.base.gptr = fb1.base.egptr;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, buffer, 10, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == (IOSTATE_eofbit|IOSTATE_failbit), "expected %d got %d\n",
|
||||
IOSTATE_eofbit|IOSTATE_failbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == NULL, "wrong get pointer, expected %p got %p\n", NULL, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
if (0) /* crashes on native */
|
||||
pis = call_func4(p_istream_get_str_delim, &is1, (char*) 0x1, 5, 0);
|
||||
|
||||
/* get_str */
|
||||
is1.extract_delim = is1.count = 0xabababab;
|
||||
is1.base_ios.state = IOSTATE_eofbit;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str, &is1, buffer, 10, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == (IOSTATE_eofbit|IOSTATE_failbit), "expected %d got %d\n",
|
||||
IOSTATE_eofbit|IOSTATE_failbit, is1.base_ios.state);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
is1.base_ios.state = IOSTATE_goodbit;
|
||||
fb1.base.eback = fb1.base.gptr = fb1.base.base;
|
||||
fb1.base.egptr = fb1.base.base + 30;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str, &is1, buffer, 20, 0);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 19, "expected 19 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 19, "wrong get pointer, expected %p got %p\n", fb1.base.base + 19, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base, 19), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[19] == 0, "expected 0 got %d\n", buffer[19]);
|
||||
is1.extract_delim = -1;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str, &is1, buffer, 20, '\t');
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 4, "expected 4 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 23, "wrong get pointer, expected %p got %p\n", fb1.base.base + 23, fb1.base.gptr);
|
||||
ok(!strncmp(buffer, fb1.base.base + 19, 3), "unexpected buffer content, got '%s'\n", buffer);
|
||||
ok(buffer[3] == 0, "expected 0 got %d\n", buffer[3]);
|
||||
*fb1.base.gptr = -50;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str, &is1, buffer, 5, -50);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 0, "expected 0 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 23, "wrong get pointer, expected %p got %p\n", fb1.base.base + 23, fb1.base.gptr);
|
||||
ok(buffer[0] == 0, "expected 0 got %d\n", buffer[0]);
|
||||
*(fb1.base.gptr + 1) = -40;
|
||||
*(fb1.base.gptr + 2) = -30;
|
||||
memset(buffer, 'A', sizeof(buffer));
|
||||
pis = call_func4(p_istream_get_str, &is1, buffer, 5, -30);
|
||||
ok(pis == &is1, "wrong return, expected %p got %p\n", &is1, pis);
|
||||
ok(is1.extract_delim == 0, "expected 0 got %d\n", is1.extract_delim);
|
||||
ok(is1.count == 2, "expected 2 got %d\n", is1.count);
|
||||
ok(is1.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, is1.base_ios.state);
|
||||
ok(fb1.base.gptr == fb1.base.base + 25, "wrong get pointer, expected %p got %p\n", fb1.base.base + 25, fb1.base.gptr);
|
||||
ok(buffer[0] == -50, "expected -50 got %d\n", buffer[0]);
|
||||
ok(buffer[1] == -40, "expected -40 got %d\n", buffer[1]);
|
||||
ok(buffer[2] == 0, "expected 0 got %d\n", buffer[2]);
|
||||
|
||||
call_func1(p_istream_vbase_dtor, &is1);
|
||||
call_func1(p_istream_vbase_dtor, &is2);
|
||||
call_func1(p_ostream_vbase_dtor, &os);
|
||||
|
|
Loading…
Reference in New Issue