[json-glib: 1/2] scanner: use macro instead of cast to convert pointer to integer




commit 8c5fabe962b7337066dac7a697d23fce257a5d64
Author: Dimitry Andric <dim FreeBSD org>
Date:   Wed Aug 19 03:35:16 2020 +0000

    scanner: use macro instead of cast to convert pointer to integer
    
    Clang 11 build failed due to a new warning (part of -Werror=pointer-to-int-cast):
    ../json-glib/json-scanner.c:928:13: error: cast to smaller integer type 'GTokenType' from 'gpointer' (aka 
'void *') [-Werror,-Wvoid-pointer-to-enum-cast]
            *token_p = (GTokenType) value_p->v_symbol;
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Jan Beich <jbeich FreeBSD org>

 json-glib/json-scanner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/json-glib/json-scanner.c b/json-glib/json-scanner.c
index 0c9919f..59dd29c 100644
--- a/json-glib/json-scanner.c
+++ b/json-glib/json-scanner.c
@@ -925,7 +925,7 @@ json_scanner_get_token_i (JsonScanner       *scanner,
       
     case G_TOKEN_SYMBOL:
       if (scanner->config->symbol_2_token)
-       *token_p = (GTokenType) value_p->v_symbol;
+       *token_p = GPOINTER_TO_INT (value_p->v_symbol);
       break;
       
     case G_TOKEN_BINARY:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]