[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH 03/13 v2] msvcp90: Add implementation of _Concurrent_vector_Internal_capacity.
From:       Hua Meng <161220092 () smail ! nju ! edu ! cn>
Date:       2018-07-31 15:16:28
Message-ID: 8b4023e7-e1bd-b6ec-6c5e-b1f4b0a49b42 () smail ! nju ! edu ! cn+57FC4617032B6476
[Download RAW message or body]

Signed-off-by: Hua meng <161220092@smail.nju.edu.cn>
---
 dlls/msvcp90/misc.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index 7cd835bf56..c4671d469e 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -1780,6 +1780,9 @@ typedef struct __Concurrent_vector_base_v4
     void **segment;
 } _Concurrent_vector_base_v4;
 
+#define STORAGE_SIZE (sizeof(this->storage) / sizeof(this->storage[0]))
+#define SEGMENT_SIZE (sizeof(void*) * 8)
+
 /* ??1_Concurrent_vector_base_v4@details@Concurrency@@IAE@XZ */
 /* ??1_Concurrent_vector_base_v4@details@Concurrency@@IEAA@XZ */
 DEFINE_THISCALL_WRAPPER(_Concurrent_vector_base_v4_dtor, 4)
@@ -1810,8 +1813,18 @@ DEFINE_THISCALL_WRAPPER(_Concurrent_vector_base_v4__Internal_capacity, 4)
 MSVCP_size_t __thiscall _Concurrent_vector_base_v4__Internal_capacity(
         const _Concurrent_vector_base_v4 *this)
 {
-    FIXME("(%p) stub\n", this);
-    return 0;
+    MSVCP_size_t last_block;
+    int i;
+
+    TRACE("(%p)\n", this);
+
+    last_block = (this->segment == this->storage ? STORAGE_SIZE : SEGMENT_SIZE);
+    for(i = 0; i < last_block; i++)
+    {
+        if(!this->segment[i])
+            return !i ? 0 : 1 << i;
+    }
+    return 1 << i;
 }
 
 /* ?_Internal_clear@_Concurrent_vector_base_v4@details@Concurrency@@IAEIP6AXPAXI@Z@Z */
-- 
2.11.0







[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic