[PATCH 10/13] msvcp90: Add implementation of _Concurrent_vector_Internal_resize.

Hua Meng 161220092 at smail.nju.edu.cn
Tue Jul 31 04:42:51 CDT 2018


Signed-off-by: Hua meng <161220092 at smail.nju.edu.cn>
---
 dlls/msvcp90/misc.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index 454933d502..bf0f228c6b 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -2004,11 +2004,37 @@ void * __thiscall _Concurrent_vector_base_v4__Internal_push_back(
 /* ?_Internal_resize at _Concurrent_vector_base_v4@details at Concurrency@@IEAAX_K00P6AXPEAX0 at ZP6AX1PEBX0@Z3 at Z */
 DEFINE_THISCALL_WRAPPER(_Concurrent_vector_base_v4__Internal_resize, 28)
 void __thiscall _Concurrent_vector_base_v4__Internal_resize(
-        _Concurrent_vector_base_v4 *this, MSVCP_size_t len1, MSVCP_size_t len2,
-        MSVCP_size_t len3, void (__cdecl *clear)(void*, MSVCP_size_t),
+        _Concurrent_vector_base_v4 *this, MSVCP_size_t resize, MSVCP_size_t element_size,
+        MSVCP_size_t max_size, void (__cdecl *clear)(void*, MSVCP_size_t),
         void (__cdecl *copy)(void*, const void*, MSVCP_size_t), const void *v)
 {
-    FIXME("(%p %ld %ld %ld %p %p %p) stub\n", this, len1, len2, len3, clear, copy, v);
+    MSVCP_size_t size, seg_no, end_seg_no, clear_element;
+
+    TRACE("(%p %ld %ld %ld %p %p %p)\n", this, resize, element_size, max_size, clear, copy, v);
+
+    if(resize > max_size) _vector_base_v4__Internal_throw_exception(this, 0);
+    size = this->early_size;
+    if(resize > size)
+        _Concurrent_vector_base_v4__Internal_grow_to_at_least_with_result(this,
+                resize, element_size, copy, v);
+    else if(resize == 0)
+        _Concurrent_vector_base_v4__Internal_clear(this, clear);
+    else if(resize < size)
+    {
+        seg_no = _vector_base_v4__Segment_index_of(size - 1);
+        end_seg_no = _vector_base_v4__Segment_index_of(resize - 1);
+        clear_element = size - (seg_no ? 1 << seg_no : 2);
+        if(clear_element > 0)
+            clear(this->segment[seg_no], clear_element);
+        if(seg_no) seg_no--;
+        for(; seg_no > end_seg_no; seg_no--)
+            clear(this->segment[seg_no], 1 << seg_no);
+        clear_element = (1 << (end_seg_no + 1)) - resize;
+        if(clear_element > 0)
+            clear((BYTE**)this->segment[end_seg_no] + element_size * (resize - ((1 << end_seg_no) & ~1)),
+                    clear_element);
+        this->early_size = resize;
+    }
 }
 
 /* ?_Internal_swap at _Concurrent_vector_base_v4@details at Concurrency@@IAEXAAV123@@Z */
-- 
2.11.0







More information about the wine-devel mailing list