diff options
-rw-r--r-- | client/mysqltest.cc | 4 | ||||
-rw-r--r-- | include/m_string.h | 4 | ||||
-rw-r--r-- | mysys/charset.c | 4 | ||||
-rw-r--r-- | mysys/mf_soundex.c | 2 | ||||
-rw-r--r-- | mysys/my_getopt.c | 2 | ||||
-rw-r--r-- | sql/create_options.cc | 9 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 4 | ||||
-rw-r--r-- | sql/opt_range.cc | 13 | ||||
-rw-r--r-- | sql/partition_info.cc | 4 | ||||
-rw-r--r-- | sql/slave.cc | 4 | ||||
-rw-r--r-- | sql/sql_bitmap.h | 2 | ||||
-rw-r--r-- | sql/sql_partition.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 8 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | storage/innodb_plugin/handler/ha_innodb.cc | 6 | ||||
-rw-r--r-- | storage/maria/ma_dbug.c | 4 | ||||
-rw-r--r-- | storage/maria/maria_chk.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_dbug.c | 4 | ||||
-rw-r--r-- | storage/myisam/myisamchk.c | 2 | ||||
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 10 | ||||
-rw-r--r-- | strings/longlong2str.c | 7 | ||||
-rw-r--r-- | strings/my_vsnprintf.c | 14 |
22 files changed, 58 insertions, 55 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 466de547a26..0a7bf9b556d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7671,7 +7671,7 @@ void mark_progress(struct st_command* command __attribute__((unused)), die("Out of memory"); /* Milliseconds since start */ - end= longlong2str(timer, buf, 10); + end= longlong10_to_str(timer, buf, 10); dynstr_append_mem(&ds_progress, buf, (int)(end-buf)); dynstr_append_mem(&ds_progress, "\t", 1); @@ -8429,7 +8429,7 @@ void timer_output(void) { char buf[32], *end; ulonglong timer= timer_now() - timer_start; - end= longlong2str(timer, buf, 10); + end= longlong10_to_str(timer, buf, 10); str_to_file(timer_file,buf, (int) (end-buf)); /* Timer has been written to the file, don't use it anymore */ timer_file= 0; diff --git a/include/m_string.h b/include/m_string.h index 31719781a48..61b7f41a61d 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -210,7 +210,7 @@ extern char *str2int(const char *src,int radix,long lower,long upper, long *val); longlong my_strtoll10(const char *nptr, char **endptr, int *error); #if SIZEOF_LONG == SIZEOF_LONG_LONG -#define longlong2str(A,B,C) int2str((A),(B),(C),1) +#define longlong2str(A,B,C,D) int2str((A),(B),(C),(D)) #define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) #undef strtoll #define strtoll(A,B,C) strtol((A),(B),(C)) @@ -223,7 +223,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error); #endif #else #ifdef HAVE_LONG_LONG -extern char *longlong2str(longlong val,char *dst,int radix); + extern char *longlong2str(longlong val,char *dst,int radix, int upcase); extern char *longlong10_to_str(longlong val,char *dst,int radix); #if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) extern longlong strtoll(const char *str, char **ptr, int base); diff --git a/mysys/charset.c b/mysys/charset.c index 7cf8a8b828d..153ef8b7e2c 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -406,9 +406,9 @@ static my_pthread_once_t charsets_template= MY_PTHREAD_ONCE_INIT; static void init_available_charsets(void) { char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; - struct charset_info_st **cs; + struct charset_info_st **cs; - bzero(&all_charsets,sizeof(all_charsets)); + bzero((char*) &all_charsets,sizeof(all_charsets)); init_compiled_charsets(MYF(0)); /* Copy compiled charsets */ diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c index fe30d8c81af..3a3dab52dd6 100644 --- a/mysys/mf_soundex.c +++ b/mysys/mf_soundex.c @@ -47,7 +47,7 @@ void soundex(CHARSET_INFO * cs,register char * out_pntr, char * in_pntr, { char ch,last_ch; reg3 char * end; - register uchar *map=cs->to_upper; + register const uchar *map=cs->to_upper; if (remove_garbage) { diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 82a691d550a..b8a5c5d14bd 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -1271,7 +1271,7 @@ void my_print_variables(const struct my_option *options) printf("%s\n", llstr(*((longlong*) value), buff)); break; case GET_ULL: - longlong2str(*((ulonglong*) value), buff, 10); + longlong10_to_str(*((ulonglong*) value), buff, 10); printf("%s\n", buff); break; case GET_DOUBLE: diff --git a/sql/create_options.cc b/sql/create_options.cc index f060b3b7204..4478fc14791 100644 --- a/sql/create_options.cc +++ b/sql/create_options.cc @@ -136,9 +136,10 @@ static bool set_one_value(ha_create_table_option *opt, DBUG_RETURN(0); } - my_option optp= { opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL, - REQUIRED_ARG, opt->def_value, opt->min_value, opt->max_value, - 0, opt->block_size, 0}; + my_option optp= + { opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL, + REQUIRED_ARG, opt->def_value, opt->min_value, opt->max_value, + 0, (long) opt->block_size, 0}; ulonglong orig_val= strtoull(value->str, NULL, 10); my_bool unused; @@ -167,7 +168,7 @@ static bool set_one_value(ha_create_table_option *opt, { uint *val= (uint *)((char *)base + opt->offset), num; - *val= opt->def_value; + *val= (uint) opt->def_value; if (!value->str) DBUG_RETURN(0); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4c90eceec99..cafabe9a3ee 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2701,7 +2701,7 @@ String *Item_func_conv::val_str(String *str) from_base, &endptr, &err); } - ptr= longlong2str(dec, ans, to_base); + ptr= longlong2str(dec, ans, to_base, 1); if (str->copy(ans, (uint32) (ptr-ans), default_charset())) return &my_empty_string; return str; @@ -2868,7 +2868,7 @@ String *Item_func_hex::val_str(String *str) if ((null_value= args[0]->null_value)) return 0; - ptr= longlong2str(dec,ans,16); + ptr= longlong2str(dec,ans,16,1); if (str->copy(ans,(uint32) (ptr-ans),default_charset())) return &my_empty_string; // End of memory return str; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2f88841d6a2..044f1ce1391 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -9010,7 +9010,7 @@ void QUICK_RANGE_SELECT::add_keys_and_lengths(String *key_names, uint length; KEY *key_info= head->key_info + index; key_names->append(key_info->name); - length= longlong2str(max_used_key_length, buf, 10) - buf; + length= longlong10_to_str(max_used_key_length, buf, 10) - buf; used_lengths->append(buf, length); } @@ -9035,7 +9035,7 @@ void QUICK_INDEX_MERGE_SELECT::add_keys_and_lengths(String *key_names, KEY *key_info= head->key_info + quick->index; key_names->append(key_info->name); - length= longlong2str(quick->max_used_key_length, buf, 10) - buf; + length= longlong10_to_str(quick->max_used_key_length, buf, 10) - buf; used_lengths->append(buf, length); } if (pk_quick_select) @@ -9043,7 +9043,8 @@ void QUICK_INDEX_MERGE_SELECT::add_keys_and_lengths(String *key_names, KEY *key_info= head->key_info + pk_quick_select->index; key_names->append(','); key_names->append(key_info->name); - length= longlong2str(pk_quick_select->max_used_key_length, buf, 10) - buf; + length= (longlong10_to_str(pk_quick_select->max_used_key_length, buf, 10) + - buf); used_lengths->append(','); used_lengths->append(buf, length); } @@ -9068,7 +9069,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names, used_lengths->append(','); } key_names->append(key_info->name); - length= longlong2str(quick->max_used_key_length, buf, 10) - buf; + length= longlong10_to_str(quick->max_used_key_length, buf, 10) - buf; used_lengths->append(buf, length); } @@ -9077,7 +9078,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names, KEY *key_info= head->key_info + cpk_quick->index; key_names->append(','); key_names->append(key_info->name); - length= longlong2str(cpk_quick->max_used_key_length, buf, 10) - buf; + length= longlong10_to_str(cpk_quick->max_used_key_length, buf, 10) - buf; used_lengths->append(','); used_lengths->append(buf, length); } @@ -11240,7 +11241,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::add_keys_and_lengths(String *key_names, char buf[64]; uint length; key_names->append(index_info->name); - length= longlong2str(max_used_key_length, buf, 10) - buf; + length= longlong10_to_str(max_used_key_length, buf, 10) - buf; used_lengths->append(buf, length); } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 0de8e478f03..1bf137011ab 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1104,8 +1104,8 @@ void partition_info::print_no_partition_found(TABLE *table) if (part_expr->null_value) buf_ptr= (char*)"NULL"; else - longlong2str(err_value, buf, - part_expr->unsigned_flag ? 10 : -10); + longlong10_to_str(err_value, buf, + part_expr->unsigned_flag ? 10 : -10); my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr); dbug_tmp_restore_column_map(table->read_set, old_map); } diff --git a/sql/slave.cc b/sql/slave.cc index 3df5c0df0b2..1421f300804 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3969,11 +3969,11 @@ bool flush_relay_log_info(Relay_log_info* rli) my_b_seek(file, 0L); pos=strmov(buff, rli->group_relay_log_name); *pos++='\n'; - pos=longlong2str(rli->group_relay_log_pos, pos, 10); + pos= longlong10_to_str(rli->group_relay_log_pos, pos, 10); *pos++='\n'; pos=strmov(pos, rli->group_master_log_name); *pos++='\n'; - pos=longlong2str(rli->group_master_log_pos, pos, 10); + pos=longlong10_to_str(rli->group_master_log_pos, pos, 10); *pos='\n'; if (my_b_write(file, (uchar*) buff, (size_t) (pos-buff)+1)) error=1; diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index e07806a56ab..58e19c1d1fa 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -162,7 +162,7 @@ public: my_bool is_subset(const Bitmap<64>& map2) const { return !(map & ~map2.map); } my_bool is_overlapping(const Bitmap<64>& map2) const { return (map & map2.map)!= 0; } my_bool operator==(const Bitmap<64>& map2) const { return map == map2.map; } - char *print(char *buf) const { longlong2str(map,buf,16); return buf; } + char *print(char *buf) const { longlong2str(map,buf,16,1); return buf; } ulonglong to_ulonglong() const { return map; } class Iterator : public Table_map_iterator { diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 3dae2d1e8b4..6058db4aad4 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1905,7 +1905,7 @@ static int add_int(File fptr, longlong number) static int add_uint(File fptr, ulonglong number) { char buff[32]; - longlong2str(number, buff, 10); + longlong2str(number, buff, 10, 1); return add_string(fptr, buff); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 59d9d72e778..69e4f302803 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -16859,8 +16859,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, item_list.push_back(new Item_string(key_info->name, strlen(key_info->name), system_charset_info)); - length= longlong2str(tab->ref.key_length, keylen_str_buf, 10) - - keylen_str_buf; + length= (longlong10_to_str(tab->ref.key_length, keylen_str_buf, 10) - + keylen_str_buf); item_list.push_back(new Item_string(keylen_str_buf, length, system_charset_info)); for (store_key **ref=tab->ref.key_copy ; *ref ; ref++) @@ -16878,8 +16878,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, register uint length; item_list.push_back(new Item_string(key_info->name, strlen(key_info->name),cs)); - length= longlong2str(key_info->key_length, keylen_str_buf, 10) - - keylen_str_buf; + length= (longlong10_to_str(key_info->key_length, keylen_str_buf, 10) - + keylen_str_buf); item_list.push_back(new Item_string(keylen_str_buf, length, system_charset_info)); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e1d223eadad..a2290cf0758 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1171,7 +1171,7 @@ static bool get_field_default_value(THD *thd, TABLE *table, if (field_type == MYSQL_TYPE_BIT) { longlong dec= field->val_int(); - char *ptr= longlong2str(dec, tmp + 2, 2); + char *ptr= longlong2str(dec, tmp + 2, 2, 1); uint32 length= (uint32) (ptr - tmp); tmp[0]= 'b'; tmp[1]= '\''; diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 1c2a880c070..4d4fd185567 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -2672,7 +2672,7 @@ innobase_rollback_to_savepoint( /* TODO: use provided savepoint data area to store savepoint data */ - longlong2str((ulint)savepoint, name, 36); + longlong2str((ulint)savepoint, name, 36, 1); error = (int) trx_rollback_to_savepoint_for_mysql(trx, name, &mysql_binlog_cache_pos); @@ -2703,7 +2703,7 @@ innobase_release_savepoint( /* TODO: use provided savepoint data area to store savepoint data */ - longlong2str((ulint)savepoint, name, 36); + longlong2str((ulint)savepoint, name, 36, 1); error = (int) trx_release_savepoint_for_mysql(trx, name); @@ -2750,7 +2750,7 @@ innobase_savepoint( /* TODO: use provided savepoint data area to store savepoint data */ char name[64]; - longlong2str((ulint)savepoint,name,36); + longlong2str((ulint)savepoint,name,36,1); error = (int) trx_savepoint_for_mysql(trx, name, (ib_int64_t)0); diff --git a/storage/maria/ma_dbug.c b/storage/maria/ma_dbug.c index ea69975ad4b..0d2db0d4f4b 100644 --- a/storage/maria/ma_dbug.c +++ b/storage/maria/ma_dbug.c @@ -124,7 +124,7 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg, case HA_KEYTYPE_LONGLONG: { char buff[21]; - longlong2str(mi_sint8korr(key),buff,-10); + longlong10_to_str(mi_sint8korr(key),buff,-10); VOID(fprintf(stream,"%s",buff)); key=end; break; @@ -132,7 +132,7 @@ void _ma_print_keydata(FILE *stream, register HA_KEYSEG *keyseg, case HA_KEYTYPE_ULONGLONG: { char buff[21]; - longlong2str(mi_sint8korr(key),buff,10); + longlong10_to_str(mi_sint8korr(key),buff,10); VOID(fprintf(stream,"%s",buff)); key=end; break; diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 985e9d2bc85..35f7f0f6c29 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -1512,7 +1512,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) printf("Recordlength: %16d\n",(int) share->base.pack_reclength); if (! maria_is_all_keys_active(share->state.key_map, share->base.keys)) { - longlong2str(share->state.key_map,buff,2); + longlong2str(share->state.key_map,buff,2,1); printf("Using only keys '%s' of %d possibly keys\n", buff, share->base.keys); } diff --git a/storage/myisam/mi_dbug.c b/storage/myisam/mi_dbug.c index 659abdce131..1a61d4823b5 100644 --- a/storage/myisam/mi_dbug.c +++ b/storage/myisam/mi_dbug.c @@ -118,7 +118,7 @@ void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg, case HA_KEYTYPE_LONGLONG: { char buff[21]; - longlong2str(mi_sint8korr(key),buff,-10); + longlong10_to_str(mi_sint8korr(key),buff,-10); VOID(fprintf(stream,"%s",buff)); key=end; break; @@ -126,7 +126,7 @@ void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg, case HA_KEYTYPE_ULONGLONG: { char buff[21]; - longlong2str(mi_sint8korr(key),buff,10); + longlong10_to_str(mi_sint8korr(key),buff,10); VOID(fprintf(stream,"%s",buff)); key=end; break; diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index c7ab2baa87c..592426a3690 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -1314,7 +1314,7 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) printf("Recordlength: %13d\n",(int) share->base.pack_reclength); if (! mi_is_all_keys_active(share->state.key_map, share->base.keys)) { - longlong2str(share->state.key_map,buff,2); + longlong2str(share->state.key_map,buff,2,1); printf("Using only keys '%s' of %d possibly keys\n", buff, share->base.keys); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index ad4a1f8d3bd..68da379b841 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -2459,11 +2459,11 @@ innobase_change_buffering_inited_ok: my_b_seek(&info_file, 0L); pos=strmov(buff, trx_sys_mysql_relay_log_name); *pos++='\n'; - pos=longlong2str(trx_sys_mysql_relay_log_pos, pos, 10); + pos=longlong10_to_str(trx_sys_mysql_relay_log_pos, pos, 10); *pos++='\n'; pos=strmov(pos, trx_sys_mysql_master_log_name); *pos++='\n'; - pos=longlong2str(trx_sys_mysql_master_log_pos, pos, 10); + pos=longlong10_to_str(trx_sys_mysql_master_log_pos, pos, 10); *pos='\n'; if (my_b_write(&info_file, (uchar*) buff, (size_t) (pos-buff)+1)) @@ -2931,7 +2931,7 @@ innobase_rollback_to_savepoint( /* TODO: use provided savepoint data area to store savepoint data */ - longlong2str((ulint)savepoint, name, 36); + longlong2str((ulint)savepoint, name, 36, 1); error = (int) trx_rollback_to_savepoint_for_mysql(trx, name, &mysql_binlog_cache_pos); @@ -2962,7 +2962,7 @@ innobase_release_savepoint( /* TODO: use provided savepoint data area to store savepoint data */ - longlong2str((ulint)savepoint, name, 36); + longlong2str((ulint)savepoint, name, 36, 1); error = (int) trx_release_savepoint_for_mysql(trx, name); @@ -3009,7 +3009,7 @@ innobase_savepoint( /* TODO: use provided savepoint data area to store savepoint data */ char name[64]; - longlong2str((ulint)savepoint,name,36); + longlong2str((ulint)savepoint,name,36,1); error = (int) trx_savepoint_for_mysql(trx, name, (ib_int64_t)0); diff --git a/strings/longlong2str.c b/strings/longlong2str.c index d7de5bb0f7c..61b45b731c4 100644 --- a/strings/longlong2str.c +++ b/strings/longlong2str.c @@ -46,11 +46,12 @@ This assumes that longlong multiplication is faster than longlong division. */ -char *longlong2str(longlong val,char *dst,int radix) +char *longlong2str(longlong val,char *dst,int radix, int upcase) { char buffer[65]; register char *p; long long_val; + const char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower; ulonglong uval= (ulonglong) val; if (radix < 0) @@ -80,14 +81,14 @@ char *longlong2str(longlong val,char *dst,int radix) { ulonglong quo= uval/(uint) radix; uint rem= (uint) (uval- quo* (uint) radix); - *--p = _dig_vec_upper[rem]; + *--p = _dig_vec[rem]; uval= quo; } long_val= (long) uval; while (long_val != 0) { long quo= long_val/radix; - *--p = _dig_vec_upper[(uchar) (long_val - quo*radix)]; + *--p = _dig_vec[(uchar) (long_val - quo*radix)]; long_val= quo; } while ((*dst++ = *p++) != 0) ; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 79267461c47..fbe4c1bdf6f 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -235,19 +235,19 @@ static char *process_int_arg(char *to, char *end, size_t length, store_start= buff; if (arg_type == 'd') - store_end= int10_to_str(par, store_start, -10); + store_end= longlong10_to_str(par, store_start, -10); else if (arg_type == 'u') - store_end= int10_to_str(par, store_start, 10); + store_end= longlong10_to_str(par, store_start, 10); else if (arg_type == 'p') { store_start[0]= '0'; store_start[1]= 'x'; - store_end= int2str(par, store_start + 2, 16, 0); + store_end= longlong2str(par, store_start + 2, 16, 0); } else { DBUG_ASSERT(arg_type == 'X' || arg_type =='x'); - store_end= int2str(par, store_start, 16, (arg_type == 'X')); + store_end= longlong2str(par, store_start, 16, (arg_type == 'X')); } if ((res_length= (size_t) (store_end - store_start)) > to_length) @@ -430,9 +430,9 @@ start: { /* Integer parameter */ longlong larg; - length= ((print_arr[i].flags & LENGTH_ARG) ? - args_arr[print_arr[i].length].longlong_arg : - (longlong) print_arr[i].length); + length= (int) ((print_arr[i].flags & LENGTH_ARG) ? + args_arr[print_arr[i].length].longlong_arg : + (longlong) print_arr[i].length); if (args_arr[print_arr[i].arg_idx].have_longlong) larg = args_arr[print_arr[i].arg_idx].longlong_arg; |