Commit d1a0d28f903f9d3eff03f06e299cde5a7998216e

Pali Rohár 2021-02-03T21:00:28

Fix MSVC 14.00 compile warning: warning C4244: '=' : conversion from 'ULONG_PTR' to 'char', possible loss of data

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/dlfcn.c b/src/dlfcn.c
index 80bd119..394ee19 100644
--- a/src/dlfcn.c
+++ b/src/dlfcn.c
@@ -192,7 +192,7 @@ static void save_err_ptr_str( const void *ptr, DWORD dwMessageId )
 
     for( i = 0; i < 2 * sizeof( ptr ); i++ )
     {
-        num = ( ( (ULONG_PTR) ptr ) >> ( 8 * sizeof( ptr ) - 4 * ( i + 1 ) ) ) & 0xF;
+        num = (char) ( ( ( (ULONG_PTR) ptr ) >> ( 8 * sizeof( ptr ) - 4 * ( i + 1 ) ) ) & 0xF );
         ptr_buf[2 + i] = num + ( ( num < 0xA ) ? '0' : ( 'A' - 0xA ) );
     }