[Groonga-mysql-commit] mroonga/mroonga [master] [storage] suppress warnings with gcc -O2.

Back to archive index

null+****@clear***** null+****@clear*****
2012年 2月 28日 (火) 09:53:48 JST


Kouhei Sutou	2012-02-28 09:53:48 +0900 (Tue, 28 Feb 2012)

  New Revision: 1737fdd354b70abb1968629ffafe1cade248adba

  Log:
    [storage] suppress warnings with gcc -O2.
    
    fixes #1295
    
    Reported by Kazuhiko Shiozaki. Thanks!!!

  Modified files:
    ha_mroonga.cc

  Modified: ha_mroonga.cc (+16 -6)
===================================================================
--- ha_mroonga.cc    2012-02-27 23:07:59 +0900 (27c619a)
+++ ha_mroonga.cc    2012-02-28 09:53:48 +0900 (ceb1eee)
@@ -8606,17 +8606,18 @@ int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info,
     }
 
     enum {
+      TYPE_UNKNOWN,
       TYPE_LONG_LONG_NUMBER,
       TYPE_NUMBER,
       TYPE_FLOAT,
       TYPE_DOUBLE,
       TYPE_BYTE_SEQUENCE
-    } data_type;
-    uint32 data_size;
-    int int_value;
-    long long int long_long_value;
-    float float_value;
-    double double_value;
+    } data_type = TYPE_UNKNOWN;
+    uint32 data_size = 0;
+    int int_value = 0;
+    long long int long_long_value = 0;
+    float float_value = 0.0;
+    double double_value = 0.0;
     switch (field->real_type()) {
     case MYSQL_TYPE_DECIMAL:
       data_type = TYPE_BYTE_SEQUENCE;
@@ -8739,6 +8740,11 @@ int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info,
     }
 
     switch (data_type) {
+    case TYPE_UNKNOWN:
+      // TODO: This will not be happen. This is just for
+      // suppressing warnings by gcc -O2. :<
+      error = HA_ERR_UNSUPPORTED;
+      break;
     case TYPE_LONG_LONG_NUMBER:
       if (decode)
         *((uint8_t *)(&long_long_value)) ^= 0x80;
@@ -8800,6 +8806,10 @@ int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info,
       break;
     }
 
+    if (error) {
+      break;
+    }
+
     current_key += data_size;
     current_buffer += data_size;
     *encoded_length += data_size;




Groonga-mysql-commit メーリングリストの案内
Back to archive index