unsigned char -> uchar

Added missing copyright
Indentation and prototype fixes
Fixed compiler warning


include/my_sys.h:
  Fix prototype for my_print_open_files.
  Indentation fixes
mysys/mf_keycache.c:
  Fix that key cache can be compiled without #define THREAD
mysys/my_error.c:
  Indentation cleanups
mysys/my_memmem.c:
  Added missing copyright.
  Fix include files
sql/event.cc:
  unsigned char -> uchar
sql/field.cc:
  unsigned char -> uchar
sql/filesort.cc:
  Indentation fix
sql/ha_ndbcluster.cc:
  unsigned char -> uchar
sql/ha_ndbcluster_binlog.cc:
  unsigned char -> uchar
sql/item_strfunc.cc:
  unsigned char -> uchar
sql/log_event.cc:
  unsigned char -> uchar
sql/opt_range.cc:
  Indentation fixes
sql/sql_crypt.cc:
  unsigned char -> uchar
sql/sql_string.cc:
  unsigned char -> uchar
sql/tztime.cc:
  unsigned char -> uchar
storage/heap/hp_extra.c:
  Clear also next_block (See heap_scan_init)
storage/heap/hp_test2.c:
  Set required struct memeber max_table_size
  (Fixes that hp_test2 works again)
storage/myisam/mi_rsamepos.c:
  Fixed bug in mi_rsame_with_pos
strings/decimal.c:
  Fixed compiler warning
This commit is contained in:
unknown 2006-06-19 12:45:34 +03:00
parent 7f19b1cc05
commit 4b316e6fd6
19 changed files with 141 additions and 102 deletions

View File

@ -547,7 +547,6 @@ extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName, extern File my_register_filename(File fd, const char *FileName,
enum file_type type_of_file, enum file_type type_of_file,
uint error_message_number, myf MyFlags); uint error_message_number, myf MyFlags);
extern void my_print_open_files(void);
extern File my_create(const char *FileName,int CreateFlags, extern File my_create(const char *FileName,int CreateFlags,
int AccessFlags, myf MyFlags); int AccessFlags, myf MyFlags);
extern int my_close(File Filedes,myf MyFlags); extern int my_close(File Filedes,myf MyFlags);
@ -638,7 +637,7 @@ extern void allow_break(void);
#endif #endif
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
void my_print_open_files(); void my_print_open_files(void);
#else #else
#define my_print_open_files() #define my_print_open_files()
#endif #endif
@ -672,13 +671,15 @@ extern my_string my_path(my_string to,const char *progname,
const char *own_pathname_part); const char *own_pathname_part);
extern my_string my_load_path(my_string to, const char *path, extern my_string my_load_path(my_string to, const char *path,
const char *own_path_prefix); const char *own_path_prefix);
extern int wild_compare(const char *str,const char *wildstr,pbool str_is_pattern); extern int wild_compare(const char *str,const char *wildstr,
pbool str_is_pattern);
extern WF_PACK *wf_comp(my_string str); extern WF_PACK *wf_comp(my_string str);
extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
extern void wf_end(struct wild_file_pack *buffer); extern void wf_end(struct wild_file_pack *buffer);
extern size_s strip_sp(my_string str); extern size_s strip_sp(my_string str);
extern void get_date(my_string to,int timeflag,time_t use_time); extern void get_date(my_string to,int timeflag,time_t use_time);
extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,pbool remove_garbage); extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,
pbool remove_garbage);
extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
uint reclength,enum cache_type type, uint reclength,enum cache_type type,
pbool use_async_io); pbool use_async_io);

View File

@ -470,8 +470,10 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
uint age_threshold) uint age_threshold)
{ {
int blocks; int blocks;
#ifdef THREAD
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
KEYCACHE_WQUEUE *wqueue; KEYCACHE_WQUEUE *wqueue;
#endif
DBUG_ENTER("resize_key_cache"); DBUG_ENTER("resize_key_cache");
if (!keycache->key_cache_inited) if (!keycache->key_cache_inited)
@ -1102,8 +1104,12 @@ static void unreg_request(KEY_CACHE *keycache,
static inline void remove_reader(BLOCK_LINK *block) static inline void remove_reader(BLOCK_LINK *block)
{ {
#ifdef THREAD
if (! --block->hash_link->requests && block->condvar) if (! --block->hash_link->requests && block->condvar)
keycache_pthread_cond_signal(block->condvar); keycache_pthread_cond_signal(block->condvar);
#else
--block->hash_link->requests;
#endif
} }
@ -1112,7 +1118,8 @@ static inline void remove_reader(BLOCK_LINK *block)
signals on its termination signals on its termination
*/ */
static inline void wait_for_readers(KEY_CACHE *keycache, BLOCK_LINK *block) static inline void wait_for_readers(KEY_CACHE *keycache __attribute__((unused)),
BLOCK_LINK *block)
{ {
#ifdef THREAD #ifdef THREAD
struct st_my_thread_var *thread= my_thread_var; struct st_my_thread_var *thread= my_thread_var;
@ -1209,7 +1216,6 @@ static HASH_LINK *get_hash_link(KEY_CACHE *keycache,
int file, my_off_t filepos) int file, my_off_t filepos)
{ {
reg1 HASH_LINK *hash_link, **start; reg1 HASH_LINK *hash_link, **start;
KEYCACHE_PAGE page;
#if defined(KEYCACHE_DEBUG) #if defined(KEYCACHE_DEBUG)
int cnt; int cnt;
#endif #endif
@ -1264,6 +1270,7 @@ restart:
#ifdef THREAD #ifdef THREAD
/* Wait for a free hash link */ /* Wait for a free hash link */
struct st_my_thread_var *thread= my_thread_var; struct st_my_thread_var *thread= my_thread_var;
KEYCACHE_PAGE page;
KEYCACHE_DBUG_PRINT("get_hash_link", ("waiting")); KEYCACHE_DBUG_PRINT("get_hash_link", ("waiting"));
page.file= file; page.file= file;
page.filepos= filepos; page.filepos= filepos;
@ -1588,8 +1595,10 @@ restart:
/* Remove the hash link for this page from the hash table */ /* Remove the hash link for this page from the hash table */
unlink_hash(keycache, block->hash_link); unlink_hash(keycache, block->hash_link);
/* All pending requests for this page must be resubmitted */ /* All pending requests for this page must be resubmitted */
#ifdef THREAD
if (block->wqueue[COND_FOR_SAVED].last_thread) if (block->wqueue[COND_FOR_SAVED].last_thread)
release_queue(&block->wqueue[COND_FOR_SAVED]); release_queue(&block->wqueue[COND_FOR_SAVED]);
#endif
} }
link_to_file_list(keycache, block, file, link_to_file_list(keycache, block, file,
(my_bool)(block->hash_link ? 1 : 0)); (my_bool)(block->hash_link ? 1 : 0));
@ -1669,7 +1678,7 @@ restart:
portion is less than read_length, but not less than min_length. portion is less than read_length, but not less than min_length.
*/ */
static void read_block(KEY_CACHE *keycache, static void read_block(KEY_CACHE *keycache __attribute__((unused)),
BLOCK_LINK *block, uint read_length, BLOCK_LINK *block, uint read_length,
uint min_length, my_bool primary) uint min_length, my_bool primary)
{ {
@ -1707,8 +1716,10 @@ static void read_block(KEY_CACHE *keycache,
KEYCACHE_DBUG_PRINT("read_block", KEYCACHE_DBUG_PRINT("read_block",
("primary request: new page in cache")); ("primary request: new page in cache"));
/* Signal that all pending requests for this page now can be processed */ /* Signal that all pending requests for this page now can be processed */
#ifdef THREAD
if (block->wqueue[COND_FOR_REQUESTED].last_thread) if (block->wqueue[COND_FOR_REQUESTED].last_thread)
release_queue(&block->wqueue[COND_FOR_REQUESTED]); release_queue(&block->wqueue[COND_FOR_REQUESTED]);
#endif
} }
else else
{ {
@ -1973,9 +1984,11 @@ int key_cache_insert(KEY_CACHE *keycache,
block->length= read_length+offset; block->length= read_length+offset;
KEYCACHE_DBUG_PRINT("key_cache_insert", KEYCACHE_DBUG_PRINT("key_cache_insert",
("primary request: new page in cache")); ("primary request: new page in cache"));
#ifdef THREAD
/* Signal that all pending requests for this now can be processed. */ /* Signal that all pending requests for this now can be processed. */
if (block->wqueue[COND_FOR_REQUESTED].last_thread) if (block->wqueue[COND_FOR_REQUESTED].last_thread)
release_queue(&block->wqueue[COND_FOR_REQUESTED]); release_queue(&block->wqueue[COND_FOR_REQUESTED]);
#endif
} }
remove_reader(block); remove_reader(block);
@ -2219,9 +2232,11 @@ static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block)
/* Keep track of the number of currently unused blocks. */ /* Keep track of the number of currently unused blocks. */
keycache->blocks_unused++; keycache->blocks_unused++;
#ifdef THREAD
/* All pending requests for this page must be resubmitted. */ /* All pending requests for this page must be resubmitted. */
if (block->wqueue[COND_FOR_SAVED].last_thread) if (block->wqueue[COND_FOR_SAVED].last_thread)
release_queue(&block->wqueue[COND_FOR_SAVED]); release_queue(&block->wqueue[COND_FOR_SAVED]);
#endif
} }
@ -2275,12 +2290,14 @@ static int flush_cached_blocks(KEY_CACHE *keycache,
if (!last_errno) if (!last_errno)
last_errno= errno ? errno : -1; last_errno= errno ? errno : -1;
} }
#ifdef THREAD
/* /*
Let to proceed for possible waiting requests to write to the block page. Let to proceed for possible waiting requests to write to the block page.
It might happen only during an operation to resize the key cache. It might happen only during an operation to resize the key cache.
*/ */
if (block->wqueue[COND_FOR_SAVED].last_thread) if (block->wqueue[COND_FOR_SAVED].last_thread)
release_queue(&block->wqueue[COND_FOR_SAVED]); release_queue(&block->wqueue[COND_FOR_SAVED]);
#endif
/* type will never be FLUSH_IGNORE_CHANGED here */ /* type will never be FLUSH_IGNORE_CHANGED here */
if (! (type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE)) if (! (type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE))
{ {

View File

@ -53,8 +53,10 @@ static struct my_err_head
int meh_first; /* error number matching array slot 0 */ int meh_first; /* error number matching array slot 0 */
int meh_last; /* error number matching last slot */ int meh_last; /* error number matching last slot */
} my_errmsgs_globerrs = {NULL, globerrs, EE_ERROR_FIRST, EE_ERROR_LAST}; } my_errmsgs_globerrs = {NULL, globerrs, EE_ERROR_FIRST, EE_ERROR_LAST};
static struct my_err_head *my_errmsgs_list= &my_errmsgs_globerrs; static struct my_err_head *my_errmsgs_list= &my_errmsgs_globerrs;
/* /*
Error message to user Error message to user
@ -76,7 +78,6 @@ int my_error(int nr, myf MyFlags, ...)
va_list args; va_list args;
char ebuff[ERRMSGSIZE + 20]; char ebuff[ERRMSGSIZE + 20];
DBUG_ENTER("my_error"); DBUG_ENTER("my_error");
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno)); DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
/* Search for the error messages array, which could contain the message. */ /* Search for the error messages array, which could contain the message. */
@ -102,6 +103,7 @@ int my_error(int nr, myf MyFlags, ...)
DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags)); DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags));
} }
/* /*
Error as printf Error as printf

View File

@ -1,4 +1,21 @@
#include "my_base.h" /* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include <m_string.h>
/* /*
my_memmem, port of a GNU extension. my_memmem, port of a GNU extension.

View File

@ -205,8 +205,8 @@ LEX_STRING interval_type_to_name[] = {
int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs) int sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs)
{ {
return cs->coll->strnncollsp(cs, (unsigned char *) s.str,s.length, return cs->coll->strnncollsp(cs, (uchar *) s.str,s.length,
(unsigned char *) t.str,t.length, 0); (uchar *) t.str,t.length, 0);
} }

View File

@ -5211,7 +5211,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
else if (nr > 1900) else if (nr > 1900)
nr-= 1900; nr-= 1900;
} }
*ptr= (char) (unsigned char) nr; *ptr= (char) (uchar) nr;
return error; return error;
} }
@ -5243,7 +5243,7 @@ int Field_year::store(longlong nr, bool unsigned_val)
else if (nr > 1900) else if (nr > 1900)
nr-= 1900; nr-= 1900;
} }
*ptr= (char) (unsigned char) nr; *ptr= (char) (uchar) nr;
return 0; 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) void Field_string::sort_string(char *to,uint length)
{ {
uint tmp=my_strnxfrm(field_charset, uint tmp= my_strnxfrm(field_charset,
(unsigned char *) to, length, (uchar*) to, length,
(unsigned char *) ptr, field_length); (uchar*) ptr, field_length);
DBUG_ASSERT(tmp == length); DBUG_ASSERT(tmp == length);
} }

View File

@ -672,62 +672,62 @@ static void make_sortkey(register SORTPARAM *param,
switch (sort_field->result_type) { switch (sort_field->result_type) {
case STRING_RESULT: case STRING_RESULT:
{ {
CHARSET_INFO *cs=item->collation.collation; CHARSET_INFO *cs=item->collation.collation;
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' '); char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
int diff; int diff;
uint sort_field_length; uint sort_field_length;
if (maybe_null) if (maybe_null)
*to++=1; *to++=1;
/* All item->str() to use some extra byte for end null.. */ /* All item->str() to use some extra byte for end null.. */
String tmp((char*) to,sort_field->length+4,cs); String tmp((char*) to,sort_field->length+4,cs);
String *res= item->str_result(&tmp); String *res= item->str_result(&tmp);
if (!res) if (!res)
{ {
if (maybe_null) if (maybe_null)
bzero((char*) to-1,sort_field->length+1); 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)
{
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);
}
else else
{ {
my_strnxfrm(cs,(uchar*)to,length,(const uchar*)res->ptr(),length); DBUG_PRINT("warning",
cs->cset->fill(cs, (char *)to+length,diff,fill_char); ("Got null on something that shouldn't be null"));
bzero((char*) to,sort_field->length); // Avoid crash
} }
break; 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)
{
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,
(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: case INT_RESULT:
{ {

View File

@ -119,7 +119,7 @@ int ndbcluster_util_inited= 0;
static Ndb* g_ndb= NULL; static Ndb* g_ndb= NULL;
Ndb_cluster_connection* g_ndb_cluster_connection= 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 // Handler synchronization
pthread_mutex_t ndbcluster_mutex; 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) if (data.unique_index_attrid_map)
my_free((char*)data.unique_index_attrid_map, MYF(0)); 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* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts; KEY_PART_INFO* end= key_part+key_info->key_parts;

View File

@ -138,7 +138,7 @@ static void print_records(TABLE *table, const char *record)
for (int i= 0; i < n && pos < 20; i++) 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; buf[pos]= 0;
DBUG_PRINT("info",("[%u]field_ptr[0->%d]: %s", j, n, buf)); 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 struct Cluster_schema
{ {
unsigned char db_length; uchar db_length;
char db[64]; char db[64];
unsigned char name_length; uchar name_length;
char name[64]; char name[64];
unsigned char slock_length; uchar slock_length;
uint32 slock[SCHEMA_SLOCK_SIZE/4]; uint32 slock[SCHEMA_SLOCK_SIZE/4];
unsigned short query_length; unsigned short query_length;
char *query; char *query;
@ -973,7 +973,7 @@ static char *ndb_pack_varchar(const NDBCOL *col, char *buf,
memcpy(buf, str, sz); memcpy(buf, str, sz);
break; break;
case NDBCOL::ArrayTypeShortVar: case NDBCOL::ArrayTypeShortVar:
*(unsigned char*)buf= (unsigned char)sz; *(uchar*)buf= (uchar)sz;
memcpy(buf + 1, str, sz); memcpy(buf + 1, str, sz);
break; break;
case NDBCOL::ArrayTypeMediumVar: case NDBCOL::ArrayTypeMediumVar:

View File

@ -127,11 +127,11 @@ String *Item_func_md5::val_str(String *str)
if (sptr) if (sptr)
{ {
my_MD5_CTX context; my_MD5_CTX context;
unsigned char digest[16]; uchar digest[16];
null_value=0; null_value=0;
my_MD5Init (&context); my_MD5Init (&context);
my_MD5Update (&context,(unsigned char *) sptr->ptr(), sptr->length()); my_MD5Update (&context,(uchar *) sptr->ptr(), sptr->length());
my_MD5Final (digest, &context); my_MD5Final (digest, &context);
if (str->alloc(32)) // Ensure that memory is free 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 */ 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 */ /* No need to check error as the only case would be too long message */
mysql_sha1_input(&context, 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 */ /* Ensure that memory is free and we got result */
if (!( str->alloc(SHA1_HASH_SIZE*2) || if (!( str->alloc(SHA1_HASH_SIZE*2) ||
(mysql_sha1_result(&context,digest)))) (mysql_sha1_result(&context,digest))))

View File

@ -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 malloc fails, catched in is_valid() */
if ((m_memory= my_malloc(m_colcnt, MYF(MY_WME)))) 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) for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
m_coltype[i]= m_table->field[i]->type(); 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 */ /* Extract the length of the various parts from the buffer */
byte const* const ptr_dblen= (byte const*)vpart + 0; 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 */ /* Length of database name + counter + terminating null */
byte const* const ptr_tbllen= ptr_dblen + m_dblen + 2; 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 */ /* Length of table name + counter + terminating null */
byte const* const ptr_colcnt= ptr_tbllen + m_tbllen + 2; byte const* const ptr_colcnt= ptr_tbllen + m_tbllen + 2;

View File

@ -5157,8 +5157,8 @@ get_mm_parts(RANGE_OPT_PARAM *param, COND *cond_func, Field *field,
static SEL_ARG * static SEL_ARG *
get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part, get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
Item_func::Functype type,Item *value) KEY_PART *key_part, Item_func::Functype type,Item *value)
{ {
uint maybe_null=(uint) field->real_maybe_null(); uint maybe_null=(uint) field->real_maybe_null();
bool optimize_range; 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; uint field_length= cur_part->store_length;
if ((cur_range->maybe_null && if ((cur_range->maybe_null &&
cur_range->min_value[0] && cur_range->max_value[0]) cur_range->min_value[0] && cur_range->max_value[0]) ||
|| !memcmp(cur_range->min_value, cur_range->max_value, field_length))
(memcmp(cur_range->min_value, cur_range->max_value, field_length) == 0)) {
{ /* cur_range specifies 'IS NULL' or an equality condition. */ /* cur_range specifies 'IS NULL' or an equality condition. */
memcpy(key_ptr, cur_range->min_value, field_length); memcpy(key_ptr, cur_range->min_value, field_length);
key_ptr+= field_length; key_ptr+= field_length;
*key_infix_len+= field_length; *key_infix_len+= field_length;

View File

@ -52,7 +52,7 @@ void SQL_CRYPT::crypt_init(ulong *rand_nr)
decode_buff[+i]=a; decode_buff[+i]=a;
} }
for (i=0 ; i <= 255 ; i++) for (i=0 ; i <= 255 ; i++)
encode_buff[(unsigned char) decode_buff[i]]=i; encode_buff[(uchar) decode_buff[i]]=i;
org_rand=rand; org_rand=rand;
shift=0; shift=0;
} }
@ -75,7 +75,7 @@ void SQL_CRYPT::decode(char *str,uint length)
for (uint i=0; i < length; i++) for (uint i=0; i < length; i++)
{ {
shift^=(uint) (my_rnd(&rand)*255.0); 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]; *str = decode_buff[idx];
shift^= (uint) (uchar) *str++; shift^= (uint) (uchar) *str++;
} }

View File

@ -720,8 +720,8 @@ void String::qs_append(uint i)
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs) int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
{ {
return cs->coll->strnncollsp(cs, return cs->coll->strnncollsp(cs,
(unsigned char *) s->ptr(),s->length(), (uchar *) s->ptr(),s->length(),
(unsigned char *) t->ptr(),t->length(), 0); (uchar *) t->ptr(),t->length(), 0);
} }
@ -734,7 +734,7 @@ int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
t Second string t Second string
NOTE: NOTE:
Strings are compared as a stream of unsigned chars Strings are compared as a stream of uchars
RETURN RETURN
< 0 s < t < 0 s < t

View File

@ -107,7 +107,7 @@ typedef struct st_time_zone_info
uint revcnt; // Number of transition descr. for TIME->my_time_t conversion uint revcnt; // Number of transition descr. for TIME->my_time_t conversion
/* The following are dynamical arrays are allocated in MEM_ROOT */ /* The following are dynamical arrays are allocated in MEM_ROOT */
my_time_t *ats; // Times of transitions between time types 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 TRAN_TYPE_INFO *ttis; // Local time types descriptions
#ifdef ABBR_ARE_USED #ifdef ABBR_ARE_USED
/* Storage for local time types abbreviations. They are stored as ASCIIZ */ /* 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; sp->ats= (my_time_t *)tzinfo_buf;
tzinfo_buf+= ALIGN_SIZE(sp->timecnt * sizeof(my_time_t)); 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); tzinfo_buf+= ALIGN_SIZE(sp->timecnt);
sp->ttis= (TRAN_TYPE_INFO *)tzinfo_buf; sp->ttis= (TRAN_TYPE_INFO *)tzinfo_buf;
tzinfo_buf+= ALIGN_SIZE(sp->typecnt * sizeof(TRAN_TYPE_INFO)); 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++) for (i= 0; i < sp->timecnt; i++)
{ {
sp->types[i]= (unsigned char) *p++; sp->types[i]= (uchar) *p++;
if (sp->types[i] >= sp->typecnt) if (sp->types[i] >= sp->typecnt)
return 1; return 1;
} }
@ -248,10 +248,10 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
ttisp= &sp->ttis[i]; ttisp= &sp->ttis[i];
ttisp->tt_gmtoff= int4net(p); ttisp->tt_gmtoff= int4net(p);
p+= 4; p+= 4;
ttisp->tt_isdst= (unsigned char) *p++; ttisp->tt_isdst= (uchar) *p++;
if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1) if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
return 1; return 1;
ttisp->tt_abbrind= (unsigned char) *p++; ttisp->tt_abbrind= (uchar) *p++;
if (ttisp->tt_abbrind > sp->charcnt) if (ttisp->tt_abbrind > sp->charcnt)
return 1; return 1;
} }
@ -1801,7 +1801,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
TIME_ZONE_INFO structure TIME_ZONE_INFO structure
*/ */
my_time_t ats[TZ_MAX_TIMES]; 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]; TRAN_TYPE_INFO ttis[TZ_MAX_TYPES];
#ifdef ABBR_ARE_USED #ifdef ABBR_ARE_USED
char chars[max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))]; 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; tz_info->ats= (my_time_t *)alloc_buff;
memcpy(tz_info->ats, ats, tz_info->timecnt * sizeof(my_time_t)); memcpy(tz_info->ats, ats, tz_info->timecnt * sizeof(my_time_t));
alloc_buff+= ALIGN_SIZE(sizeof(my_time_t) * tz_info->timecnt); 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); memcpy(tz_info->types, types, tz_info->timecnt);
alloc_buff+= ALIGN_SIZE(tz_info->timecnt); alloc_buff+= ALIGN_SIZE(tz_info->timecnt);
#ifdef ABBR_ARE_USED #ifdef ABBR_ARE_USED

View File

@ -57,6 +57,7 @@ int heap_reset(HP_INFO *info)
info->current_record= (ulong) ~0L; info->current_record= (ulong) ~0L;
info->current_hash_ptr=0; info->current_hash_ptr=0;
info->update=0; info->update=0;
info->next_block=0;
return 0; return 0;
} }
@ -83,4 +84,3 @@ static void heap_extra_keyflag(register HP_INFO *info,
} }
} }
} }

View File

@ -74,6 +74,7 @@ int main(int argc, char *argv[])
get_options(argc,argv); get_options(argc,argv);
bzero(&hp_create_info, sizeof(hp_create_info)); bzero(&hp_create_info, sizeof(hp_create_info));
hp_create_info.max_table_size= 1024L*1024L;
write_count=update=opt_delete=0; write_count=update=opt_delete=0;
key_check=0; key_check=0;

View File

@ -31,8 +31,9 @@
int mi_rsame_with_pos(MI_INFO *info, byte *record, int inx, my_off_t filepos) int mi_rsame_with_pos(MI_INFO *info, byte *record, int inx, my_off_t filepos)
{ {
DBUG_ENTER("mi_rsame_with_pos"); DBUG_ENTER("mi_rsame_with_pos");
DBUG_PRINT("enter",("index: %d filepos: %ld", inx, (long) filepos));
if (inx < -1 || ! mi_is_key_active(info->s->state.key_map, inx)) if (inx < -1 || inx >= 0 && ! mi_is_key_active(info->s->state.key_map, inx))
{ {
DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX); DBUG_RETURN(my_errno=HA_ERR_WRONG_INDEX);
} }

View File

@ -1353,7 +1353,7 @@ int bin2decimal(char *from, decimal_t *to, int precision, int scale)
} }
from+=i; from+=i;
*buf=x ^ mask; *buf=x ^ mask;
if (((uint32)*buf) >= powers10[intg0x+1]) if (((ulonglong)*buf) >= (ulonglong) powers10[intg0x+1])
goto err; goto err;
if (buf > to->buf || *buf != 0) if (buf > to->buf || *buf != 0)
buf++; buf++;