Piotr Caban : msvcp90: Added basic_streambuf<char>::{ctor, dtor} implementation.

Alexandre Julliard julliard at winehq.org
Wed Aug 24 14:05:26 CDT 2011


Module: wine
Branch: master
Commit: a1bfde59098c33140310156c3d0aefdadea48164
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a1bfde59098c33140310156c3d0aefdadea48164

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Aug 24 14:38:53 2011 +0200

msvcp90: Added basic_streambuf<char>::{ctor, dtor} implementation.

---

 dlls/msvcp90/ios.c     |   61 +++++++++++++++++++++++++++++++++++++++--------
 dlls/msvcp90/msvcp90.h |    3 ++
 2 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 5dd6af8..47d3d5c 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -126,6 +126,10 @@ typedef struct {
     locale *loc;
 } basic_streambuf_char;
 
+void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char*);
+void __thiscall basic_streambuf_char_setp(basic_streambuf_char*, char*, char*);
+void __thiscall basic_streambuf_char_setg(basic_streambuf_char*, char*, char*, char*);
+
 typedef struct {
     ios_base child;
     basic_streambuf_char *strbuf;
@@ -917,8 +921,9 @@ char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor_uninitialized, 8)
 basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_streambuf_char *this, int uninitialized)
 {
-    FIXME("(%p %d) stub\n", this, uninitialized);
-    return NULL;
+    TRACE("(%p %d)\n", this, uninitialized);
+    this->vtable = &MSVCP_basic_streambuf_char_vtable;
+    return this;
 }
 
 /* ??0?$basic_streambuf at DU?$char_traits at D@std@@@std@@IAE at XZ */
@@ -926,8 +931,14 @@ basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_s
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor, 4)
 basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char *this)
 {
-    FIXME("(%p) stub\n", this);
-    return NULL;
+    TRACE("(%p)\n", this);
+
+    this->vtable = &MSVCP_basic_streambuf_char_vtable;
+    this->loc = MSVCRT_operator_new(sizeof(locale));
+    locale_ctor(this->loc);
+    basic_streambuf_char__Init_empty(this);
+
+    return this;
 }
 
 /* ??1?$basic_streambuf at DU?$char_traits at D@std@@@std@@UAE at XZ */
@@ -935,13 +946,16 @@ basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_dtor, 4)
 void __thiscall basic_streambuf_char_dtor(basic_streambuf_char *this)
 {
-    FIXME("(%p) stub\n", this);
+    TRACE("(%p)\n", this);
+
+    locale_dtor(this->loc);
+    MSVCRT_operator_delete(this->loc);
 }
 
 DEFINE_THISCALL_WRAPPER(MSVCP_basic_streambuf_char_vector_dtor, 8)
 basic_streambuf_char* __thiscall MSVCP_basic_streambuf_char_vector_dtor(basic_streambuf_char *this, unsigned int flags)
 {
-    TRACE("(%p %x) stub\n", this, flags);
+    TRACE("(%p %x)\n", this, flags);
     if(flags & 2) {
         /* we have an array, with the number of elements stored before the first object */
         int i, *ptr = (int *)this-1;
@@ -999,7 +1013,14 @@ char* __thiscall basic_streambuf_char__Gnpreinc(basic_streambuf_char *this)
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init, 28)
 void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf, char **gn, int *gc, char **pf, char **pn, int *pc)
 {
-    FIXME("(%p %p %p %p %p %p %p) stub\n", this, gf, gn, gc, pf, pn, pc);
+    TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
+
+    this->prbuf = gf;
+    this->pwbuf = pf;
+    this->prpos = gn;
+    this->pwpos = pn;
+    this->prsize = gc;
+    this->pwsize = pc;
 }
 
 /* ?_Init@?$basic_streambuf at DU?$char_traits at D@std@@@std@@IAEXXZ */
@@ -1007,7 +1028,17 @@ void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init_empty, 4)
 void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char *this)
 {
-    FIXME("(%p) stub\n", this);
+    TRACE("(%p)\n", this);
+
+    this->prbuf = &this->rbuf;
+    this->pwbuf = &this->wbuf;
+    this->prpos = &this->rpos;
+    this->pwpos = &this->wpos;
+    this->prsize = &this->rsize;
+    this->pwsize = &this->wsize;
+
+    basic_streambuf_char_setp(this, NULL, NULL);
+    basic_streambuf_char_setg(this, NULL, NULL, NULL);
 }
 
 /* ?_Lock@?$basic_streambuf at DU?$char_traits at D@std@@@std@@QAEXXZ */
@@ -1288,7 +1319,11 @@ basic_streambuf_char* __thiscall basic_streambuf_char_setbuf(basic_streambuf_cha
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setg, 16)
 void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *first, char *next, char *last)
 {
-    FIXME("(%p %p %p %p) stub\n", this, first, next, last);
+    TRACE("(%p %p %p %p)\n", this, first, next, last);
+
+    this->rbuf = first;
+    this->rpos = next;
+    this->rsize = last-next;
 }
 
 /* ?setp@?$basic_streambuf at DU?$char_traits at D@std@@@std@@IAEXPAD00 at Z */
@@ -1296,7 +1331,11 @@ void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *firs
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp_next, 16)
 void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char *first, char *next, char *last)
 {
-    FIXME("(%p %p %p %p) stub\n", this, first, next, last);
+    TRACE("(%p %p %p %p)\n", this, first, next, last);
+
+    this->wbuf = first;
+    this->wpos = next;
+    this->wsize = last-next;
 }
 
 /* ?setp@?$basic_streambuf at DU?$char_traits at D@std@@@std@@IAEXPAD0 at Z */
@@ -1304,7 +1343,7 @@ void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char
 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp, 12)
 void __thiscall basic_streambuf_char_setp(basic_streambuf_char *this, char *first, char *last)
 {
-    FIXME("(%p %p %p) stub\n", this, first, last);
+    basic_streambuf_char_setp_next(this, first, first, last);
 }
 
 /* ?sgetc@?$basic_streambuf at DU?$char_traits at D@std@@@std@@QAEHXZ */
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 6bc81ba..d80c361 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -195,6 +195,9 @@ typedef struct
     struct locale__Locimp *ptr;
 } locale;
 
+locale* __thiscall locale_ctor(locale*);
+void __thiscall locale_dtor(locale*);
+
 /* class _Lockit */
 typedef struct {
     int locktype;




More information about the wine-cvs mailing list