msgpack-c icon indicating copy to clipboard operation
msgpack-c copied to clipboard

Fix for windows ce < 6.0 build.

Open bobik1 opened this issue 11 years ago • 1 comments

include/msgpack/unpack.hpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/msgpack/unpack.hpp b/include/msgpack/unpack.hpp
index 3ba9c2a..aac09e1 100644
--- a/include/msgpack/unpack.hpp
+++ b/include/msgpack/unpack.hpp
@@ -233,6 +233,22 @@ inline void init_count(void* buffer)
     *reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer) = 1;
 }

+#if defined(_WIN32_WCE) && _WIN32_WCE < 0x600
+
+inline void decl_count(void* buffer)
+{
+    if(_msgpack_sync_decr_and_fetch(reinterpret_cast<_msgpack_atomic_counter_t*>(buffer)) == 0) {
+        free(buffer);
+    }
+}
+
+inline void incr_count(void* buffer)
+{
+    _msgpack_sync_incr_and_fetch(reinterpret_cast<_msgpack_atomic_counter_t*>(buffer));
+}
+
+#else
+
 inline void decl_count(void* buffer)
 {
     if(_msgpack_sync_decr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer)) == 0) {
@@ -245,6 +261,8 @@ inline void incr_count(void* buffer)
     _msgpack_sync_incr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer));
 }

+#endif
+
 inline _msgpack_atomic_counter_t get_count(void* buffer)
 {
     return *reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer);

bobik1 avatar Dec 25 '14 16:12 bobik1

@bobik1 , thank you for reporting the issue.

I don't have a windows ce environment. So I don't understand what the problem is. Could you sent a pull request instead of pasting the diff. You can write the meaning of the change as a commit comment.

See: https://github.com/msgpack/msgpack-c/pulls https://help.github.com/articles/using-pull-requests/

redboltz avatar Jan 05 '15 00:01 redboltz