msvcirt: Add implementation of streambuf::snextc.
This commit is contained in:
parent
4c6507d94c
commit
fac4fdb56f
|
@ -597,6 +597,24 @@ int __thiscall streambuf_sputn(streambuf *this, const char *data, int length)
|
|||
return call_streambuf_xsputn(this, data, length);
|
||||
}
|
||||
|
||||
/* ?snextc@streambuf@@QAEHXZ */
|
||||
/* ?snextc@streambuf@@QEAAHXZ */
|
||||
DEFINE_THISCALL_WRAPPER(streambuf_snextc, 4)
|
||||
int __thiscall streambuf_snextc(streambuf *this)
|
||||
{
|
||||
TRACE("(%p)\n", this);
|
||||
if (this->unbuffered) {
|
||||
if (this->stored_char == EOF)
|
||||
call_streambuf_underflow(this);
|
||||
return this->stored_char = call_streambuf_underflow(this);
|
||||
} else {
|
||||
if (this->gptr >= this->egptr)
|
||||
call_streambuf_underflow(this);
|
||||
this->gptr++;
|
||||
return (this->gptr < this->egptr) ? *this->gptr : call_streambuf_underflow(this);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* ??1ios@@UAE@XZ (MSVCRTI.@)
|
||||
* class ios & __thiscall ios::-ios<<(void)
|
||||
|
|
|
@ -700,8 +700,8 @@
|
|||
# @ extern ?sh_none@filebuf@@2HB # static int const filebuf::sh_none
|
||||
# @ extern ?sh_read@filebuf@@2HB # static int const filebuf::sh_read
|
||||
# @ extern ?sh_write@filebuf@@2HB # static int const filebuf::sh_write
|
||||
@ stub -arch=win32 ?snextc@streambuf@@QAEHXZ # int __thiscall streambuf::snextc(void)
|
||||
@ stub -arch=win64 ?snextc@streambuf@@QEAAHXZ
|
||||
@ thiscall -arch=win32 ?snextc@streambuf@@QAEHXZ(ptr) streambuf_snextc
|
||||
@ cdecl -arch=win64 ?snextc@streambuf@@QEAAHXZ(ptr) streambuf_snextc
|
||||
@ stub -arch=win32 ?sputbackc@streambuf@@QAEHD@Z # int __thiscall streambuf::sputbackc(char)
|
||||
@ stub -arch=win64 ?sputbackc@streambuf@@QEAAHD@Z
|
||||
@ thiscall -arch=win32 ?sputc@streambuf@@QAEHH@Z(ptr long) streambuf_sputc
|
||||
|
|
|
@ -62,6 +62,7 @@ static void (*__thiscall p_streambuf_setb)(streambuf*, char*, char*, int);
|
|||
static void (*__thiscall p_streambuf_setlock)(streambuf*);
|
||||
static streambuf* (*__thiscall p_streambuf_setbuf)(streambuf*, char*, int);
|
||||
static int (*__thiscall p_streambuf_sgetc)(streambuf*);
|
||||
static int (*__thiscall p_streambuf_snextc)(streambuf*);
|
||||
static int (*__thiscall p_streambuf_sputc)(streambuf*, int);
|
||||
static int (*__thiscall p_streambuf_sync)(streambuf*);
|
||||
static void (*__thiscall p_streambuf_unlock)(streambuf*);
|
||||
|
@ -150,6 +151,7 @@ static BOOL init(void)
|
|||
SET(p_streambuf_setbuf, "?setbuf@streambuf@@UEAAPEAV1@PEADH@Z");
|
||||
SET(p_streambuf_setlock, "?setlock@streambuf@@QEAAXXZ");
|
||||
SET(p_streambuf_sgetc, "?sgetc@streambuf@@QEAAHXZ");
|
||||
SET(p_streambuf_snextc, "?snextc@streambuf@@QEAAHXZ");
|
||||
SET(p_streambuf_sputc, "?sputc@streambuf@@QEAAHH@Z");
|
||||
SET(p_streambuf_sync, "?sync@streambuf@@UEAAHXZ");
|
||||
SET(p_streambuf_unlock, "?unlock@streambuf@@QEAAXXZ");
|
||||
|
@ -169,6 +171,7 @@ static BOOL init(void)
|
|||
SET(p_streambuf_setbuf, "?setbuf@streambuf@@UAEPAV1@PADH@Z");
|
||||
SET(p_streambuf_setlock, "?setlock@streambuf@@QAEXXZ");
|
||||
SET(p_streambuf_sgetc, "?sgetc@streambuf@@QAEHXZ");
|
||||
SET(p_streambuf_snextc, "?snextc@streambuf@@QAEHXZ");
|
||||
SET(p_streambuf_sputc, "?sputc@streambuf@@QAEHH@Z");
|
||||
SET(p_streambuf_sync, "?sync@streambuf@@UAEHXZ");
|
||||
SET(p_streambuf_unlock, "?unlock@streambuf@@QAEXXZ");
|
||||
|
@ -564,6 +567,57 @@ static void test_streambuf(void)
|
|||
ok(sb3.stored_char == 'G', "wrong stored character, expected 'G' got %c\n", sb3.stored_char);
|
||||
ok(overflow_count == 14, "expected 3 calls to overflow, got %d\n", overflow_count - 11);
|
||||
|
||||
/* snextc */
|
||||
strcpy(sb.eback, "Test");
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb);
|
||||
ok(ret == 'e', "expected 'e' got '%c'\n", ret);
|
||||
ok(sb.gptr == sb.eback + 1, "wrong get pointer, expected %p got %p\n", sb.eback + 1, sb.gptr);
|
||||
test_this = &sb2;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb2);
|
||||
ok(ret == EOF, "expected EOF got '%c'\n", ret);
|
||||
ok(sb2.gptr == sb2.egptr + 1, "wrong get pointer, expected %p got %p\n", sb2.egptr + 1, sb2.gptr);
|
||||
ok(underflow_count == 39, "expected 2 calls to underflow, got %d\n", underflow_count - 37);
|
||||
sb2.gptr = sb2.egptr - 1;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb2);
|
||||
ok(ret == EOF, "expected EOF got '%c'\n", ret);
|
||||
ok(sb2.gptr == sb2.egptr, "wrong get pointer, expected %p got %p\n", sb2.egptr, sb2.gptr);
|
||||
ok(underflow_count == 40, "expected call to underflow\n");
|
||||
get_end = 0;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb2);
|
||||
ok(ret == 'o', "expected 'o' got '%c'\n", ret);
|
||||
ok(sb2.gptr == sb2.eback + 1, "wrong get pointer, expected %p got %p\n", sb2.eback + 1, sb2.gptr);
|
||||
ok(underflow_count == 41, "expected call to underflow\n");
|
||||
sb2.gptr = sb2.egptr - 1;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb2);
|
||||
ok(ret == 'W', "expected 'W' got '%c'\n", ret);
|
||||
ok(sb2.gptr == sb2.eback, "wrong get pointer, expected %p got %p\n", sb2.eback, sb2.gptr);
|
||||
ok(underflow_count == 42, "expected call to underflow\n");
|
||||
sb2.gptr = sb2.egptr;
|
||||
test_this = &sb3;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb3);
|
||||
ok(ret == 'l', "expected 'l' got '%c'\n", ret);
|
||||
ok(sb3.stored_char == 'l', "wrong stored character, expected 'l' got %c\n", sb3.stored_char);
|
||||
ok(underflow_count == 43, "expected call to underflow\n");
|
||||
buffer_pos = 22;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb3);
|
||||
ok(ret == 't', "expected 't' got '%c'\n", ret);
|
||||
ok(sb3.stored_char == 't', "wrong stored character, expected 't' got %c\n", sb3.stored_char);
|
||||
ok(underflow_count == 44, "expected call to underflow\n");
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb3);
|
||||
ok(ret == EOF, "expected EOF got '%c'\n", ret);
|
||||
ok(sb3.stored_char == EOF, "wrong stored character, expected EOF got %c\n", sb3.stored_char);
|
||||
ok(underflow_count == 45, "expected call to underflow\n");
|
||||
buffer_pos = 0;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb3);
|
||||
ok(ret == 'o', "expected 'o' got '%c'\n", ret);
|
||||
ok(sb3.stored_char == 'o', "wrong stored character, expected 'o' got %c\n", sb3.stored_char);
|
||||
ok(underflow_count == 47, "expected 2 calls to underflow, got %d\n", underflow_count - 45);
|
||||
sb3.stored_char = EOF;
|
||||
ret = (int) call_func1(p_streambuf_snextc, &sb3);
|
||||
ok(ret == 'p', "expected 'p' got '%c'\n", ret);
|
||||
ok(sb3.stored_char == 'p', "wrong stored character, expected 'p' got %c\n", sb3.stored_char);
|
||||
ok(underflow_count == 49, "expected 2 calls to underflow, got %d\n", underflow_count - 47);
|
||||
|
||||
SetEvent(lock_arg.test[3]);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
|
||||
|
|
|
@ -688,8 +688,8 @@
|
|||
# @ extern ?sh_none@filebuf@@2HB
|
||||
# @ extern ?sh_read@filebuf@@2HB
|
||||
# @ extern ?sh_write@filebuf@@2HB
|
||||
@ stub -arch=win32 ?snextc@streambuf@@QAEHXZ
|
||||
@ stub -arch=win64 ?snextc@streambuf@@QEAAHXZ
|
||||
@ thiscall -arch=win32 ?snextc@streambuf@@QAEHXZ(ptr) msvcirt.?snextc@streambuf@@QAEHXZ
|
||||
@ cdecl -arch=win64 ?snextc@streambuf@@QEAAHXZ(ptr) msvcirt.?snextc@streambuf@@QEAAHXZ
|
||||
@ stub -arch=win32 ?sputbackc@streambuf@@QAEHD@Z
|
||||
@ stub -arch=win64 ?sputbackc@streambuf@@QEAAHD@Z
|
||||
@ thiscall -arch=win32 ?sputc@streambuf@@QAEHH@Z(ptr long) msvcirt.?sputc@streambuf@@QAEHH@Z
|
||||
|
|
|
@ -760,8 +760,8 @@
|
|||
# @ extern ?sh_none@filebuf@@2HB
|
||||
# @ extern ?sh_read@filebuf@@2HB
|
||||
# @ extern ?sh_write@filebuf@@2HB
|
||||
@ stub -arch=win32 ?snextc@streambuf@@QAEHXZ
|
||||
@ stub -arch=win64 ?snextc@streambuf@@QEAAHXZ
|
||||
@ thiscall -arch=win32 ?snextc@streambuf@@QAEHXZ(ptr) msvcirt.?snextc@streambuf@@QAEHXZ
|
||||
@ cdecl -arch=win64 ?snextc@streambuf@@QEAAHXZ(ptr) msvcirt.?snextc@streambuf@@QEAAHXZ
|
||||
@ stub -arch=win32 ?sputbackc@streambuf@@QAEHD@Z
|
||||
@ stub -arch=win64 ?sputbackc@streambuf@@QEAAHD@Z
|
||||
@ thiscall -arch=win32 ?sputc@streambuf@@QAEHH@Z(ptr long) msvcirt.?sputc@streambuf@@QAEHH@Z
|
||||
|
|
Loading…
Reference in New Issue