summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@mysql.com <>2006-06-19 12:45:34 +0300
committermonty@mysql.com <>2006-06-19 12:45:34 +0300
commit860661a2dc5905396f1e6ee4b163bdf29dc2b6fe (patch)
treeb1eef84ec3b6195237d928b1ebea0aaa0acf90a7 /sql
parent37d7bbb335fd3d3c578a724790ce5f5cbc049ce9 (diff)
downloadmariadb-git-860661a2dc5905396f1e6ee4b163bdf29dc2b6fe.tar.gz
unsigned char -> uchar
Added missing copyright Indentation and prototype fixes Fixed compiler warning
Diffstat (limited to 'sql')
-rw-r--r--sql/event.cc4
-rw-r--r--sql/field.cc10
-rw-r--r--sql/filesort.cc104
-rw-r--r--sql/ha_ndbcluster.cc4
-rw-r--r--sql/ha_ndbcluster_binlog.cc10
-rw-r--r--sql/item_strfunc.cc6
-rw-r--r--sql/log_event.cc6
-rw-r--r--sql/opt_range.cc12
-rw-r--r--sql/sql_crypt.cc4
-rw-r--r--sql/sql_string.cc6
-rw-r--r--sql/tztime.cc14
11 files changed, 90 insertions, 90 deletions
diff --git a/sql/event.cc b/sql/event.cc
index 9ca5c62fc1c..2e78ef3e3d8 100644
--- a/sql/event.cc
+++ b/sql/event.cc
@@ -205,8 +205,8 @@ LEX_STRING interval_type_to_name[] = {
int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
{
- return cs->coll->strnncollsp(cs, (unsigned char *) s.str,s.length,
- (unsigned char *) t.str,t.length, 0);
+ return cs->coll->strnncollsp(cs, (uchar *) s.str,s.length,
+ (uchar *) t.str,t.length, 0);
}
diff --git a/sql/field.cc b/sql/field.cc
index 1f65adca2d5..f5b75e6a4cd 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5211,7 +5211,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
else if (nr > 1900)
nr-= 1900;
}
- *ptr= (char) (unsigned char) nr;
+ *ptr= (char) (uchar) nr;
return error;
}
@@ -5243,7 +5243,7 @@ int Field_year::store(longlong nr, bool unsigned_val)
else if (nr > 1900)
nr-= 1900;
}
- *ptr= (char) (unsigned char) nr;
+ *ptr= (char) (uchar) nr;
return 0;
}
@@ -6200,9 +6200,9 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
void Field_string::sort_string(char *to,uint length)
{
- uint tmp=my_strnxfrm(field_charset,
- (unsigned char *) to, length,
- (unsigned char *) ptr, field_length);
+ uint tmp= my_strnxfrm(field_charset,
+ (uchar*) to, length,
+ (uchar*) ptr, field_length);
DBUG_ASSERT(tmp == length);
}
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 4e48df5db9f..e712bed9e13 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -672,62 +672,62 @@ static void make_sortkey(register SORTPARAM *param,
switch (sort_field->result_type) {
case STRING_RESULT:
{
- CHARSET_INFO *cs=item->collation.collation;
- char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
- int diff;
- uint sort_field_length;
-
- if (maybe_null)
- *to++=1;
- /* All item->str() to use some extra byte for end null.. */
- String tmp((char*) to,sort_field->length+4,cs);
- String *res= item->str_result(&tmp);
- if (!res)
- {
- if (maybe_null)
- bzero((char*) to-1,sort_field->length+1);
- else
- {
- DBUG_PRINT("warning",
- ("Got null on something that shouldn't be null"));
- bzero((char*) to,sort_field->length); // Avoid crash
- }
- break;
- }
- length= res->length();
- sort_field_length= sort_field->length - sort_field->suffix_length;
- diff=(int) (sort_field_length - length);
- if (diff < 0)
- {
- diff=0; /* purecov: inspected */
- length= sort_field_length;
- }
- if (sort_field->suffix_length)
- {
- /* Store length last in result_string */
- store_length(to + sort_field_length, length,
- sort_field->suffix_length);
- }
- if (sort_field->need_strxnfrm)
+ CHARSET_INFO *cs=item->collation.collation;
+ char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
+ int diff;
+ uint sort_field_length;
+
+ if (maybe_null)
+ *to++=1;
+ /* All item->str() to use some extra byte for end null.. */
+ String tmp((char*) to,sort_field->length+4,cs);
+ String *res= item->str_result(&tmp);
+ if (!res)
+ {
+ if (maybe_null)
+ bzero((char*) to-1,sort_field->length+1);
+ else
{
- char *from=(char*) res->ptr();
- uint tmp_length;
- if ((unsigned char *)from == to)
- {
- set_if_smaller(length,sort_field->length);
- memcpy(param->tmp_buffer,from,length);
- from=param->tmp_buffer;
- }
- tmp_length= my_strnxfrm(cs,to,sort_field->length,
- (unsigned char *) from, length);
- DBUG_ASSERT(tmp_length == sort_field->length);
+ DBUG_PRINT("warning",
+ ("Got null on something that shouldn't be null"));
+ bzero((char*) to,sort_field->length); // Avoid crash
}
- else
+ break;
+ }
+ length= res->length();
+ sort_field_length= sort_field->length - sort_field->suffix_length;
+ diff=(int) (sort_field_length - length);
+ if (diff < 0)
+ {
+ diff=0; /* purecov: inspected */
+ length= sort_field_length;
+ }
+ if (sort_field->suffix_length)
+ {
+ /* Store length last in result_string */
+ store_length(to + sort_field_length, length,
+ sort_field->suffix_length);
+ }
+ if (sort_field->need_strxnfrm)
+ {
+ char *from=(char*) res->ptr();
+ uint tmp_length;
+ if ((uchar*) from == to)
{
- my_strnxfrm(cs,(uchar*)to,length,(const uchar*)res->ptr(),length);
- cs->cset->fill(cs, (char *)to+length,diff,fill_char);
+ set_if_smaller(length,sort_field->length);
+ memcpy(param->tmp_buffer,from,length);
+ from=param->tmp_buffer;
}
- break;
+ tmp_length= my_strnxfrm(cs,to,sort_field->length,
+ (uchar*) from, length);
+ DBUG_ASSERT(tmp_length == sort_field->length);
+ }
+ else
+ {
+ my_strnxfrm(cs,(uchar*)to,length,(const uchar*)res->ptr(),length);
+ cs->cset->fill(cs, (char *)to+length,diff,fill_char);
+ }
+ break;
}
case INT_RESULT:
{
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 8c4d6d18b9b..89d426770ec 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -119,7 +119,7 @@ int ndbcluster_util_inited= 0;
static Ndb* g_ndb= NULL;
Ndb_cluster_connection* g_ndb_cluster_connection= NULL;
-unsigned char g_node_id_map[max_ndb_nodes];
+uchar g_node_id_map[max_ndb_nodes];
// Handler synchronization
pthread_mutex_t ndbcluster_mutex;
@@ -1005,7 +1005,7 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
if (data.unique_index_attrid_map)
my_free((char*)data.unique_index_attrid_map, MYF(0));
- data.unique_index_attrid_map= (unsigned char*)my_malloc(sz,MYF(MY_WME));
+ data.unique_index_attrid_map= (uchar*)my_malloc(sz,MYF(MY_WME));
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 3b93eb4b4c9..eeacd568978 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -138,7 +138,7 @@ static void print_records(TABLE *table, const char *record)
for (int i= 0; i < n && pos < 20; i++)
{
- pos+= sprintf(&buf[pos]," %x", (int) (unsigned char) field_ptr[i]);
+ pos+= sprintf(&buf[pos]," %x", (int) (uchar) field_ptr[i]);
}
buf[pos]= 0;
DBUG_PRINT("info",("[%u]field_ptr[0->%d]: %s", j, n, buf));
@@ -870,11 +870,11 @@ int ndbcluster_setup_binlog_table_shares(THD *thd)
struct Cluster_schema
{
- unsigned char db_length;
+ uchar db_length;
char db[64];
- unsigned char name_length;
+ uchar name_length;
char name[64];
- unsigned char slock_length;
+ uchar slock_length;
uint32 slock[SCHEMA_SLOCK_SIZE/4];
unsigned short query_length;
char *query;
@@ -973,7 +973,7 @@ static char *ndb_pack_varchar(const NDBCOL *col, char *buf,
memcpy(buf, str, sz);
break;
case NDBCOL::ArrayTypeShortVar:
- *(unsigned char*)buf= (unsigned char)sz;
+ *(uchar*)buf= (uchar)sz;
memcpy(buf + 1, str, sz);
break;
case NDBCOL::ArrayTypeMediumVar:
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index eb1fbf4855d..0a004047220 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -127,11 +127,11 @@ String *Item_func_md5::val_str(String *str)
if (sptr)
{
my_MD5_CTX context;
- unsigned char digest[16];
+ uchar digest[16];
null_value=0;
my_MD5Init (&context);
- my_MD5Update (&context,(unsigned char *) sptr->ptr(), sptr->length());
+ my_MD5Update (&context,(uchar *) sptr->ptr(), sptr->length());
my_MD5Final (digest, &context);
if (str->alloc(32)) // Ensure that memory is free
{
@@ -170,7 +170,7 @@ String *Item_func_sha::val_str(String *str)
mysql_sha1_reset(&context); /* We do not have to check for error here */
/* No need to check error as the only case would be too long message */
mysql_sha1_input(&context,
- (const unsigned char *) sptr->ptr(), sptr->length());
+ (const uchar *) sptr->ptr(), sptr->length());
/* Ensure that memory is free and we got result */
if (!( str->alloc(SHA1_HASH_SIZE*2) ||
(mysql_sha1_result(&context,digest))))
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 78ab54aeb79..40afed3ca59 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -5681,7 +5681,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
/* If malloc fails, catched in is_valid() */
if ((m_memory= my_malloc(m_colcnt, MYF(MY_WME))))
{
- m_coltype= reinterpret_cast<unsigned char*>(m_memory);
+ m_coltype= reinterpret_cast<uchar*>(m_memory);
for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
m_coltype[i]= m_table->field[i]->type();
}
@@ -5737,11 +5737,11 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
/* Extract the length of the various parts from the buffer */
byte const* const ptr_dblen= (byte const*)vpart + 0;
- m_dblen= *(unsigned char*) ptr_dblen;
+ m_dblen= *(uchar*) ptr_dblen;
/* Length of database name + counter + terminating null */
byte const* const ptr_tbllen= ptr_dblen + m_dblen + 2;
- m_tbllen= *(unsigned char*) ptr_tbllen;
+ m_tbllen= *(uchar*) ptr_tbllen;
/* Length of table name + counter + terminating null */
byte const* const ptr_colcnt= ptr_tbllen + m_tbllen + 2;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index c905d8aada7..21d5cb28ea2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -5157,8 +5157,8 @@ get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field,
static SEL_ARG *
-get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
- Item_func::Functype type,Item *value)
+get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
+ KEY_PART *key_part, Item_func::Functype type,Item *value)
{
uint maybe_null=(uint) field->real_maybe_null();
bool optimize_range;
@@ -9119,10 +9119,10 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
uint field_length= cur_part->store_length;
if ((cur_range->maybe_null &&
- cur_range->min_value[0] && cur_range->max_value[0])
- ||
- (memcmp(cur_range->min_value, cur_range->max_value, field_length) == 0))
- { /* cur_range specifies 'IS NULL' or an equality condition. */
+ cur_range->min_value[0] && cur_range->max_value[0]) ||
+ !memcmp(cur_range->min_value, cur_range->max_value, field_length))
+ {
+ /* cur_range specifies 'IS NULL' or an equality condition. */
memcpy(key_ptr, cur_range->min_value, field_length);
key_ptr+= field_length;
*key_infix_len+= field_length;
diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc
index f21a109e95d..4e73941fb49 100644
--- a/sql/sql_crypt.cc
+++ b/sql/sql_crypt.cc
@@ -52,7 +52,7 @@ void SQL_CRYPT::crypt_init(ulong *rand_nr)
decode_buff[+i]=a;
}
for (i=0 ; i <= 255 ; i++)
- encode_buff[(unsigned char) decode_buff[i]]=i;
+ encode_buff[(uchar) decode_buff[i]]=i;
org_rand=rand;
shift=0;
}
@@ -75,7 +75,7 @@ void SQL_CRYPT::decode(char *str,uint length)
for (uint i=0; i < length; i++)
{
shift^=(uint) (my_rnd(&rand)*255.0);
- uint idx= (uint) ((unsigned char) str[0] ^ shift);
+ uint idx= (uint) ((uchar) str[0] ^ shift);
*str = decode_buff[idx];
shift^= (uint) (uchar) *str++;
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 19ee9f259dc..596f4edadac 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -720,8 +720,8 @@ void String::qs_append(uint i)
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
{
return cs->coll->strnncollsp(cs,
- (unsigned char *) s->ptr(),s->length(),
- (unsigned char *) t->ptr(),t->length(), 0);
+ (uchar *) s->ptr(),s->length(),
+ (uchar *) t->ptr(),t->length(), 0);
}
@@ -734,7 +734,7 @@ int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
t Second string
NOTE:
- Strings are compared as a stream of unsigned chars
+ Strings are compared as a stream of uchars
RETURN
< 0 s < t
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 77d7efdcf7c..f8de9bb48aa 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -107,7 +107,7 @@ typedef struct st_time_zone_info
uint revcnt; // Number of transition descr. for TIME->my_time_t conversion
/* The following are dynamical arrays are allocated in MEM_ROOT */
my_time_t *ats; // Times of transitions between time types
- unsigned char *types; // Local time types for transitions
+ uchar *types; // Local time types for transitions
TRAN_TYPE_INFO *ttis; // Local time types descriptions
#ifdef ABBR_ARE_USED
/* Storage for local time types abbreviations. They are stored as ASCIIZ */
@@ -222,7 +222,7 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
sp->ats= (my_time_t *)tzinfo_buf;
tzinfo_buf+= ALIGN_SIZE(sp->timecnt * sizeof(my_time_t));
- sp->types= (unsigned char *)tzinfo_buf;
+ sp->types= (uchar *)tzinfo_buf;
tzinfo_buf+= ALIGN_SIZE(sp->timecnt);
sp->ttis= (TRAN_TYPE_INFO *)tzinfo_buf;
tzinfo_buf+= ALIGN_SIZE(sp->typecnt * sizeof(TRAN_TYPE_INFO));
@@ -237,7 +237,7 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
for (i= 0; i < sp->timecnt; i++)
{
- sp->types[i]= (unsigned char) *p++;
+ sp->types[i]= (uchar) *p++;
if (sp->types[i] >= sp->typecnt)
return 1;
}
@@ -248,10 +248,10 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
ttisp= &sp->ttis[i];
ttisp->tt_gmtoff= int4net(p);
p+= 4;
- ttisp->tt_isdst= (unsigned char) *p++;
+ ttisp->tt_isdst= (uchar) *p++;
if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
return 1;
- ttisp->tt_abbrind= (unsigned char) *p++;
+ ttisp->tt_abbrind= (uchar) *p++;
if (ttisp->tt_abbrind > sp->charcnt)
return 1;
}
@@ -1801,7 +1801,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
TIME_ZONE_INFO structure
*/
my_time_t ats[TZ_MAX_TIMES];
- unsigned char types[TZ_MAX_TIMES];
+ uchar types[TZ_MAX_TIMES];
TRAN_TYPE_INFO ttis[TZ_MAX_TYPES];
#ifdef ABBR_ARE_USED
char chars[max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))];
@@ -2038,7 +2038,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
tz_info->ats= (my_time_t *)alloc_buff;
memcpy(tz_info->ats, ats, tz_info->timecnt * sizeof(my_time_t));
alloc_buff+= ALIGN_SIZE(sizeof(my_time_t) * tz_info->timecnt);
- tz_info->types= (unsigned char *)alloc_buff;
+ tz_info->types= (uchar *)alloc_buff;
memcpy(tz_info->types, types, tz_info->timecnt);
alloc_buff+= ALIGN_SIZE(tz_info->timecnt);
#ifdef ABBR_ARE_USED