[x265] [PATCH] threading.h: fix WaitForSingleObject return type

Johannes Kauffmann johanneskauffmann at hotmail.com
Sun Jun 11 11:24:12 UTC 2023


WaitForSingleObject returns a DWORD, which is unsigned. This fixes the
following warning for every threading.h include:

  threading.h:285:41: warning: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘DWORD’ {aka ‘long unsigned int’} [-Wsign-compare]
    285 |         return rt != WAIT_TIMEOUT && rt != WAIT_FAILED;
        |
---
 source/common/threading.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/common/threading.h b/source/common/threading.h
index 8a5c39cf0..bcbd0eedf 100644
--- a/source/common/threading.h
+++ b/source/common/threading.h
@@ -281,7 +281,7 @@ public:
 
     bool take(const uint32_t time_out = INFINITE)
     {
-        int32_t rt = WaitForSingleObject(m_sem, time_out);
+        DWORD rt = WaitForSingleObject(m_sem, time_out);
         return rt != WAIT_TIMEOUT && rt != WAIT_FAILED;
     }
 
-- 
2.34.1



More information about the x265-devel mailing list