Piotr Caban : msvcp90: Fixed copied buffer siezes in functions operating on wchar_t.
Alexandre Julliard
julliard at winehq.org
Tue Sep 11 16:59:07 CDT 2012
Module: wine
Branch: master
Commit: 5258b3a219c310175e32b837b39214dd37c5d061
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5258b3a219c310175e32b837b39214dd37c5d061
Author: Piotr Caban <piotr at codeweavers.com>
Date: Tue Sep 11 16:08:21 2012 +0200
msvcp90: Fixed copied buffer siezes in functions operating on wchar_t.
---
dlls/msvcp100/ios.c | 8 ++++----
dlls/msvcp90/ios.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/msvcp100/ios.c b/dlls/msvcp100/ios.c
index 9d6ad67..57c1aa4 100644
--- a/dlls/msvcp100/ios.c
+++ b/dlls/msvcp100/ios.c
@@ -1822,11 +1822,11 @@ streamsize __thiscall basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *thi
chunk = count-copied;
if(chunk > 0) {
- memcpy_s(ptr+copied, size, *this->prpos, chunk);
+ memcpy_s(ptr+copied, size, *this->prpos, chunk*sizeof(wchar_t));
*this->prpos += chunk;
*this->prsize -= chunk;
copied += chunk;
- size -= chunk;
+ size -= chunk*sizeof(wchar_t);
}else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
ptr[copied] = c;
copied++;
@@ -2315,7 +2315,7 @@ streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this,
chunk = count-copied;
if(chunk > 0) {
- memcpy(*this->pwpos, ptr+copied, chunk);
+ memcpy(*this->pwpos, ptr+copied, chunk*sizeof(wchar_t));
*this->pwpos += chunk;
*this->pwsize -= chunk;
copied += chunk;
@@ -3948,7 +3948,7 @@ void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const w
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
- memcpy(buf, str, count);
+ memcpy(buf, str, count*sizeof(wchar_t));
this->seekhigh = buf + count;
this->state |= STRINGBUF_allocated;
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 82010c6..699ac98 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -1812,11 +1812,11 @@ streamsize __thiscall basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *thi
chunk = count-copied;
if(chunk > 0) {
- memcpy_s(ptr+copied, size, *this->prpos, chunk);
+ memcpy_s(ptr+copied, size, *this->prpos, chunk*sizeof(wchar_t));
*this->prpos += chunk;
*this->prsize -= chunk;
copied += chunk;
- size -= chunk;
+ size -= chunk*sizeof(wchar_t);
}else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
ptr[copied] = c;
copied++;
@@ -2305,7 +2305,7 @@ streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this,
chunk = count-copied;
if(chunk > 0) {
- memcpy(*this->pwpos, ptr+copied, chunk);
+ memcpy(*this->pwpos, ptr+copied, chunk*sizeof(wchar_t));
*this->pwpos += chunk;
*this->pwsize -= chunk;
copied += chunk;
@@ -3938,7 +3938,7 @@ void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const w
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
- memcpy(buf, str, count);
+ memcpy(buf, str, count*sizeof(wchar_t));
this->seekhigh = buf + count;
this->state |= STRINGBUF_allocated;
More information about the wine-cvs
mailing list