← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2703)

 

#At lp:maria

 2703 knielsen@xxxxxxxxxxxxxxx	2009-05-20
      Fix accessing ulong enum option as uint, failing on 64-bit big-endian.
      modified:
        mysys/my_getopt.c

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2009-04-25 10:05:32 +0000
+++ b/mysys/my_getopt.c	2009-05-20 15:34:34 +0000
@@ -647,7 +647,7 @@ static int setval(const struct my_option
 	return EXIT_OUT_OF_MEMORY;
       break;
     case GET_ENUM:
-      if (((*(int*)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
+      if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
         return EXIT_ARGUMENT_INVALID;
       break;
     case GET_SET:
@@ -983,7 +983,7 @@ static void init_one_value(const struct 
     *((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
     break;
   case GET_ENUM:
-    *((uint*) variable)= (uint) value;
+    *((ulong*) variable)= (uint) value;
     break;
   case GET_UINT:
     *((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
@@ -1221,7 +1221,7 @@ void my_print_variables(const struct my_
 	}
 	break;
       case GET_ENUM:
-        printf("%s\n", get_type(optp->typelib, *(uint*) value));
+        printf("%s\n", get_type(optp->typelib, *(ulong*) value));
 	break;
       case GET_STR:
       case GET_STR_ALLOC:                    /* fall through */




Follow ups