[Groonga-commit] groonga/groonga at 6b167d2 [master] clang: suppress a warning

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 10 16:39:11 JST 2013


Kouhei Sutou	2013-06-10 16:39:11 +0900 (Mon, 10 Jun 2013)

  New Revision: 6b167d2f8f09e1c8d549ec5af4211826a9c455da
  https://github.com/groonga/groonga/commit/6b167d2f8f09e1c8d549ec5af4211826a9c455da

  Message:
    clang: suppress a warning
    
        lib/db.c:3098:7: warning: initializing 'int *'
              with an expression of type 'uint32_t *' (aka 'unsigned int *') converts
              between pointers to integer types with different sign [-Wpointer-sign]
              GRN_TABLE_EACH(ctx, table2, 0, 0, id, &key, &key_size, &value2, {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    It seems that we should treat all key sizes as unsigned int.

  Modified files:
    include/groonga.h

  Modified: include/groonga.h (+3 -2)
===================================================================
--- include/groonga.h    2013-06-10 13:51:28 +0900 (e6d1d19)
+++ include/groonga.h    2013-06-10 16:39:11 +0900 (bbc21f6)
@@ -3008,10 +3008,11 @@ GRN_API grn_rc grn_dat_cursor_delete(grn_ctx *ctx, grn_dat_cursor *c,
   grn_dat_cursor *_sc = grn_dat_cursor_open(ctx, dat, NULL, 0, NULL, 0, 0, -1, 0);\
   if (_sc) {\
     grn_id id;\
-    int *_ks = (key_size);\
+    unsigned int *_ks = (key_size);\
     if (_ks) {\
       while ((id = grn_dat_cursor_next(ctx, _sc))) {\
-        *(_ks) = grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
+        int _ks_raw = grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
+        *(_ks) = (unsigned int)_ks_raw;\
         block\
       }\
     } else {\
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index