mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm() Added 'Opened_files' status variable to track calls to my_open() Don't give warnings when running mysql_install_db Added option --source-install to mysql_install_db I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map() BUILD/compile-solaris-sparc-forte: Updated script to current Solaris installations Now we compile by default for 64 bits client/mysql.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) client/mysql_upgrade.c: Fixed compiler warning (on Forte) client/mysqladmin.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) client/mysqlcheck.c: Fixed compiler warning (on Forte) client/mysqldump.c: Fixed compiler warning (on Forte) client/mysqlslap.c: Fixed compiler warning (on Forte) client/mysqltest.c: Fixed compiler warning (on Forte) client/sql_string.cc: Avoid compiler warnings when using C function pointers in C++ configure.in: Added detection of mtmalloc and ieeefp.h extra/replace.c: Fixed compiler warning (on Forte) include/m_ctype.h: Added some typedef's to make it easy to use C function pointers in C++ include/my_sys.h: Added my_file_total_opened (counter for calls to my_open()) include/myisam.h: Fixed compiler warning (on Forte) libmysql/libmysql.c: Fixed compiler warning (on Forte) by adding casts and change types libmysql/manager.c: Fixed compiler warning (on Forte) by adding casts and change types mysql-test/r/ctype_cp932_binlog_stm.result: Updated positions (Needed because we didn't before correctly restore collation_database after running stored procedure mysys/my_fopen.c: Count number of opened files mysys/my_open.c: Count number of opened files mysys/my_static.c: Count number of opened files mysys/thr_alarm.c: Optimization to do less alarm() and pthread_sigmask() calls. Idea is to remember time for next pending alarm and not reschedule a new alarm if it's after the current one. Before we only did this if there was other pending alarms. We don't have to use pthread_sigmask() in case of 'USE_ONE_SIGNAL_HAND' as the alarm() signal will be blocked for the calling thread anyway and no other thread will have the alarm() signal enabled to call process_alarm() regex/regcomp.c: Fixed compiler warning (on Forte) by adding casts and change types scripts/mysql_install_db.sh: Added option --source-install to allow one to create a mysql database from the source tree without installing MySQL Don't give (unnecessary) warnings server-tools/instance-manager/angel.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) server-tools/instance-manager/thread_registry.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/event_db_repository.cc: index_read() -> index_read_map() sql/event_queue.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/field.cc: Fixed compiler warnings about hidden fields sql/ha_partition.cc: Fixed compiler warnings about hidden fields index_read() -> index_read_map() sql/ha_partition.h: index_read() -> index_read_map() sql/handler.cc: Added PAGE option to row types (to prepare for future) index_read() -> index_read_map() sql/handler.h: Added ROW_TYPE_PAGE (for future) Added flag to signal if table was to be created transactionally I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map() sql/item.cc: Fixed indentation Renamed local variable to avoid hiding class variable sql/item_cmpfunc.cc: Renamed local variable to avoid hiding class variable sql/item_cmpfunc.h: Removed not used variable sql/item_func.cc: Renamed local variable to avoid hiding class variable sql/item_strfunc.cc: Moved functions from Item_strfunc.cc sql/item_strfunc.h: Move functions to item_strfunc.cc Use C function pointer type to avoid compiler warnings (with Forte) sql/item_subselect.cc: index_read() -> index_read_map() sql/item_xmlfunc.cc: Renamed local variable to avoid hiding class variable Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/key.cc: Fixed indentation sql/log.cc: Renamed local variable to avoid hiding class variable sql/log_event.cc: Removed call to my_time() when creating class instance of Log_event() as this may have static instances. (One can't call my_time() before my_init()) index_read() -> index_read_map() Renamed local variable to avoid hiding class variable sql/log_event_old.cc: Renamed local variable to avoid hiding class variable sql/mysql_priv.h: Made all create_backup_ctx() declarations identical. This lifted up a bug where wrong create_backup_ctx() was called in some cases. Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/mysqld.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) Fixed indentation Don't call end_thr_alarm() when calling unireg_abort() as unireg_abort() already calls end_thr_alarm() Added variable 'Opened_files' (number of calls to my_open() or my_fopen()) Don't print 'loose' warnings when using --bootstrap (to avoid warnings when running mysql_install_db) Fixed compiler warnings sql/opt_range.cc: index_read() -> index_read_map() sql/opt_sum.cc: index_read() -> index_read_map() sql/partition_info.cc: Renamed local variable to avoid hiding class variable sql/rpl_filter.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/set_var.cc: Renamed local variable to avoid hiding class variable Added 'process_key_cache_t' type to avoid compiler warning (on Forte) sql/set_var.h: Added 'process_key_cache_t' type to avoid compiler warning (on Forte) sql/sp.cc: More debugging index_read() -> index_read_map() sql/sp_cache.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/sp_head.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) Moved 'saved_creation_ctx' higher up to be able to free objects allocated by create_backup_ctx() sql/sql_acl.cc: index_read() -> index_read_map() sql/sql_class.cc: Renamed local variable to avoid hiding class variable Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/sql_class.h: Renamed local variable to avoid hiding class variable sql/sql_db.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) sql/sql_delete.cc: Renamed local variable to avoid hiding class variable sql/sql_handler.cc: index_read() -> index_read_map() sql/sql_help.cc: index_read() -> index_read_map() sql/sql_insert.cc: index_read() -> index_read_map() Renamed local variable to avoid hiding class variable sql/sql_lex.cc: Renamed local variable to avoid hiding class variable sql/sql_plugin.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) index_read() -> index_read_map() Don't give warnings about not used plugins if we are using --warnings=0 sql/sql_select.cc: index_read() -> index_read_map() sql-common/client.c: Fixed compiler warning (on Forte) sql-common/my_time.c: Removed never accessed code Fixed compiler warning (on Forte) sql/sql_servers.cc: index_read() -> index_read_map() sql/sql_show.cc: Added TRANSACTIONAL to SHOW CREATE Fixed ROW_TYPE_PAGE sql/sql_string.cc: Avoid compiler warnings when using C function pointers in C++ sql/sql_table.cc: Set create_info->transactional if we used TRANSACTIONAL=1 sql/sql_udf.cc: index_read() -> index_read_map() sql/sql_yacc.yy: Added TRANSACTIONAL=0|1 to CREATE (for future) Added row type PAGE (was only partionally handled before) sql/strfunc.cc: Avoid compiler warnings when using C function pointers in C++ sql/table.cc: More DBUG statements Declare all create_backup_ctx() functions identically Remember if table was created with TRANSACTIONAL flag or not (future safe) Renamed local variable to avoid hiding class variable sql/table.h: Remember if table was created with TRANSACTIONAL=1 sql/tztime.cc: index_read() -> index_read_map() sql-common/pack.c: Fixed compiler warning (on Forte) storage/archive/archive_reader.c: Fixed compiler warning (on Forte) storage/archive/azio.c: Fixed compiler warning (on Forte) storage/blackhole/ha_blackhole.cc: index_read() -> index_read_map() storage/blackhole/ha_blackhole.h: index_read() -> index_read_map() storage/csv/ha_tina.cc: Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte) storage/example/ha_example.cc: index_read() -> index_read_map() storage/example/ha_example.h: index_read() -> index_read_map() storage/heap/ha_heap.cc: index_read() -> index_read_map() storage/heap/ha_heap.h: index_read() -> index_read_map() storage/heap/hp_test1.c: Fixed compiler warning (on Forte) storage/heap/hp_test2.c: Fixed compiler warning (on Forte) storage/myisam/ft_boolean_search.c: Fixed compiler warning (on Forte) storage/myisam/ft_nlq_search.c: Fixed compiler warning (on Forte) storage/myisam/ft_parser.c: Fixed compiler warning (on Forte) storage/myisam/ft_stopwords.c: Fixed compiler warning (on Forte) storage/myisam/ha_myisam.cc: index_read() -> index_read_map() storage/myisam/ha_myisam.h: index_read() -> index_read_map() storage/myisam/mi_check.c: Fixed compiler warning (on Forte) storage/myisam/mi_delete.c: Fixed compiler warning (on Forte) storage/myisam/mi_dynrec.c: Fixed compiler warning (on Forte) storage/myisam/mi_extra.c: Fixed compiler warning (on Forte) storage/myisam/mi_key.c: Fixed compiler warning (on Forte) storage/myisam/mi_keycache.c: Fixed compiler warning (on Forte) storage/myisam/mi_locking.c: Fixed compiler warning (on Forte) storage/myisam/mi_log.c: Fixed compiler warning (on Forte) storage/myisam/mi_open.c: Fixed compiler warning (on Forte) storage/myisam/mi_packrec.c: Fixed compiler warning (on Forte) storage/myisam/mi_page.c: Fixed compiler warning (on Forte) storage/myisam/mi_rkey.c: Added comment storage/myisam/mi_search.c: Fixed compiler warning (on Forte) storage/myisam/mi_statrec.c: Fixed compiler warning (on Forte) storage/myisam/mi_test1.c: Fixed compiler warning (on Forte) storage/myisam/mi_test2.c: Fixed compiler warning (on Forte) storage/myisam/mi_test3.c: Fixed compiler warning (on Forte) storage/myisam/mi_update.c: Fixed compiler warning (on Forte) storage/myisam/mi_write.c: Fixed compiler warning (on Forte) storage/myisam/myisamdef.h: Fixed that file_read/file_write returns type size_t Changed some functions to use uchar * as argument/return value instead of char* This fixed some compiler warnings on Forte storage/myisam/myisamlog.c: Fixed compiler warning (on Forte) storage/myisam/myisampack.c: Fixed compiler warning (on Forte) storage/myisam/rt_test.c: Fixed compiler warning (on Forte) storage/myisam/sort.c: Fixed compiler warning (on Forte) by adding casts or changing variables to uchar* storage/myisam/sp_test.c: Fixed compiler warning (on Forte) by adding casts or changing variables to uchar* storage/myisammrg/ha_myisammrg.cc: index_read() -> index_read_map() storage/myisammrg/ha_myisammrg.h: index_read() -> index_read_map() storage/myisammrg/myrg_create.c: Fixed compiler warning (on Forte) by adding casts or changing variable types storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp: Tdummy -> align (as in other part of cluster code) storage/ndb/src/kernel/vm/DynArr256.cpp: Removed not used variable storage/ndb/src/ndbapi/Ndb.cpp: Removed not used variable strings/strtod.c: Include ieeefp.h to avoid compiler warning tests/bug25714.c: Fixed compiler warning tests/mysql_client_test.c: Remove not used variable Fixed indentation Removed never reached code Fixed compiler warning (on Forte) by adding casts or changing variable types vio/viosocket.c: Fixed compiler warning (on Forte) by adding casts or changing variable types
This commit is contained in:
@ -270,8 +270,9 @@ int ha_heap::delete_row(const uchar * buf)
|
||||
return res;
|
||||
}
|
||||
|
||||
int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
int ha_heap::index_read_map(uchar *buf, const uchar *key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
@ -280,7 +281,8 @@ int ha_heap::index_read(uchar * buf, const uchar * key, key_part_map keypart_map
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map)
|
||||
int ha_heap::index_read_last_map(uchar *buf, const uchar *key,
|
||||
key_part_map keypart_map)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
@ -290,9 +292,9 @@ int ha_heap::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_read_idx(uchar * buf, uint index, const uchar * key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
int ha_heap::index_read_idx_map(uchar *buf, uint index, const uchar *key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error = heap_rkey(file, buf, index, key, keypart_map, find_flag);
|
||||
|
@ -79,11 +79,12 @@ public:
|
||||
ulonglong nb_desired_values,
|
||||
ulonglong *first_value,
|
||||
ulonglong *nb_reserved_values);
|
||||
int index_read(uchar * buf, const uchar * key, key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag);
|
||||
int index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map);
|
||||
int index_read_idx(uchar * buf, uint index, const uchar * key,
|
||||
key_part_map keypart_map, enum ha_rkey_function find_flag);
|
||||
int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag);
|
||||
int index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map);
|
||||
int index_read_idx_map(uchar * buf, uint index, const uchar * key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag);
|
||||
int index_next(uchar * buf);
|
||||
int index_prev(uchar * buf);
|
||||
int index_first(uchar * buf);
|
||||
|
@ -32,7 +32,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int i,j,error,deleted;
|
||||
HP_INFO *file;
|
||||
char record[128],key[32];
|
||||
uchar record[128],key[32];
|
||||
const char *filename;
|
||||
HP_KEYDEF keyinfo[10];
|
||||
HA_KEYSEG keyseg[4];
|
||||
@ -65,12 +65,12 @@ int main(int argc, char **argv)
|
||||
!(file= heap_open(filename, 2)))
|
||||
goto err;
|
||||
printf("- Writing records:s\n");
|
||||
strmov(record," ..... key ");
|
||||
strmov((char*) record," ..... key ");
|
||||
|
||||
for (i=49 ; i>=1 ; i-=2 )
|
||||
{
|
||||
j=i%25 +1;
|
||||
sprintf(key,"%6d",j);
|
||||
sprintf((char*) key,"%6d",j);
|
||||
bmove(record+1,key,6);
|
||||
error=heap_write(file,record);
|
||||
if (heap_check_heap(file,0))
|
||||
@ -92,18 +92,18 @@ int main(int argc, char **argv)
|
||||
for (i=1 ; i<=10 ; i++)
|
||||
{
|
||||
if (i == remove_ant) { VOID(heap_close(file)) ; return (0) ; }
|
||||
sprintf(key,"%6d",(j=(int) ((rand() & 32767)/32767.*25)));
|
||||
sprintf((char*) key,"%6d",(j=(int) ((rand() & 32767)/32767.*25)));
|
||||
if ((error = heap_rkey(file,record,0,key,6,HA_READ_KEY_EXACT)))
|
||||
{
|
||||
if (verbose || (flags[j] == 1 ||
|
||||
(error && my_errno != HA_ERR_KEY_NOT_FOUND)))
|
||||
printf("key: %s rkey: %3d my_errno: %3d\n",key,error,my_errno);
|
||||
printf("key: %s rkey: %3d my_errno: %3d\n",(char*) key,error,my_errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
error=heap_delete(file,record);
|
||||
if (error || verbose)
|
||||
printf("key: %s delete: %d my_errno: %d\n",key,error,my_errno);
|
||||
printf("key: %s delete: %d my_errno: %d\n",(char*) key,error,my_errno);
|
||||
flags[j]=0;
|
||||
if (! error)
|
||||
deleted++;
|
||||
@ -118,7 +118,7 @@ int main(int argc, char **argv)
|
||||
printf("- Reading records with key\n");
|
||||
for (i=1 ; i<=25 ; i++)
|
||||
{
|
||||
sprintf(key,"%6d",i);
|
||||
sprintf((char*) key,"%6d",i);
|
||||
bmove(record+1,key,6);
|
||||
my_errno=0;
|
||||
error=heap_rkey(file,record,0,key,6,HA_READ_KEY_EXACT);
|
||||
@ -127,7 +127,7 @@ int main(int argc, char **argv)
|
||||
(error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND)))
|
||||
{
|
||||
printf("key: %s rkey: %3d my_errno: %3d record: %s\n",
|
||||
key,error,my_errno,record+1);
|
||||
(char*) key,error,my_errno,record+1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ int main(int argc, char **argv)
|
||||
if (verbose || (error != 0 && error != HA_ERR_RECORD_DELETED))
|
||||
{
|
||||
printf("pos: %2d ni_rrnd: %3d my_errno: %3d record: %s\n",
|
||||
i-1,error,my_errno,record+1);
|
||||
i-1,error,my_errno,(char*) record+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ static int reclength=39;
|
||||
|
||||
|
||||
static int calc_check(uchar *buf,uint length);
|
||||
static void make_record(char *record, uint n1, uint n2, uint n3,
|
||||
static void make_record(uchar *record, uint n1, uint n2, uint n3,
|
||||
const char *mark, uint count);
|
||||
|
||||
/* Main program */
|
||||
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
|
||||
int error;
|
||||
ulong pos;
|
||||
unsigned long key_check;
|
||||
char record[128],record2[128],record3[128],key[10];
|
||||
uchar record[128],record2[128],record3[128],key[10];
|
||||
const char *filename,*filename2;
|
||||
HP_INFO *file,*file2;
|
||||
HP_SHARE *tmp_share;
|
||||
@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
||||
signal(SIGINT,endprog);
|
||||
|
||||
printf("- Writing records:s\n");
|
||||
strmov(record," ..... key");
|
||||
strmov((char*) record," ..... key");
|
||||
|
||||
for (i=0 ; i < recant ; i++)
|
||||
{
|
||||
@ -179,10 +179,10 @@ int main(int argc, char *argv[])
|
||||
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
|
||||
if (j != 0)
|
||||
{
|
||||
sprintf(key,"%6d",j);
|
||||
sprintf((char*) key,"%6d",j);
|
||||
if (heap_rkey(file,record,0,key,6, HA_READ_KEY_EXACT))
|
||||
{
|
||||
printf("can't find key1: \"%s\"\n",key);
|
||||
printf("can't find key1: \"%s\"\n",(char*) key);
|
||||
goto err;
|
||||
}
|
||||
#ifdef NOT_USED
|
||||
@ -192,13 +192,13 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
if (heap_delete(file,record))
|
||||
{
|
||||
printf("error: %d; can't delete record: \"%s\"\n", my_errno,record);
|
||||
printf("error: %d; can't delete record: \"%s\"\n", my_errno,(char*) record);
|
||||
goto err;
|
||||
}
|
||||
opt_delete++;
|
||||
key1[atoi(record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
|
||||
key_check-=atoi(record);
|
||||
key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
|
||||
key_check-=atoi((char*) record);
|
||||
if (testflag == 2 && heap_check_heap(file,0))
|
||||
{
|
||||
puts("Heap keys crashed");
|
||||
@ -239,10 +239,10 @@ int main(int argc, char *argv[])
|
||||
for (j=rnd(1000)+1 ; j>0 && key1[j] == 0 ; j--) ;
|
||||
if (!key1[j])
|
||||
continue;
|
||||
sprintf(key,"%6d",j);
|
||||
sprintf((char*) key,"%6d",j);
|
||||
if (heap_rkey(file,record,0,key,6, HA_READ_KEY_EXACT))
|
||||
{
|
||||
printf("can't find key1: \"%s\"\n",key);
|
||||
printf("can't find key1: \"%s\"\n",(char*) key);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -251,19 +251,20 @@ int main(int argc, char *argv[])
|
||||
if (my_errno != HA_ERR_FOUND_DUPP_KEY || key3[n3] == 0)
|
||||
{
|
||||
printf("error: %d; can't update:\nFrom: \"%s\"\nTo: \"%s\"\n",
|
||||
my_errno,record,record2);
|
||||
my_errno,(char*) record, (char*) record2);
|
||||
goto err;
|
||||
}
|
||||
if (verbose)
|
||||
printf("Double key when tried to update:\nFrom: \"%s\"\nTo: \"%s\"\n",record,record2);
|
||||
printf("Double key when tried to update:\nFrom: \"%s\"\nTo: \"%s\"\n",
|
||||
(char*) record, (char*) record2);
|
||||
}
|
||||
else
|
||||
{
|
||||
key1[atoi(record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
|
||||
key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
|
||||
key1[n1]++; key3[n3]=1;
|
||||
update++;
|
||||
key_check=key_check-atoi(record)+n1;
|
||||
key_check=key_check-atoi((char*) record)+n1;
|
||||
}
|
||||
if (testflag == 3 && heap_check_heap(file,0))
|
||||
{
|
||||
@ -281,7 +282,7 @@ int main(int argc, char *argv[])
|
||||
for (i=999, dupp_keys=found_key=0 ; i>0 ; i--)
|
||||
{
|
||||
if (key1[i] > dupp_keys) { dupp_keys=key1[i]; found_key=i; }
|
||||
sprintf(key,"%6d",found_key);
|
||||
sprintf((char*) key,"%6d",found_key);
|
||||
}
|
||||
|
||||
if (dupp_keys > 3)
|
||||
@ -294,9 +295,9 @@ int main(int argc, char *argv[])
|
||||
goto err;
|
||||
if (heap_rnext(file,record3)) goto err;
|
||||
if (heap_delete(file,record3)) goto err;
|
||||
key_check-=atoi(record3);
|
||||
key1[atoi(record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
|
||||
key_check-=atoi((char*) record3);
|
||||
key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
|
||||
opt_delete++;
|
||||
ant=2;
|
||||
while ((error=heap_rnext(file,record3)) == 0 ||
|
||||
@ -321,16 +322,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (heap_rlast(file,record3,0)) goto err;
|
||||
if (heap_delete(file,record3)) goto err;
|
||||
key_check-=atoi(record3);
|
||||
key1[atoi(record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
|
||||
key_check-=atoi((char*) record3);
|
||||
key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
|
||||
opt_delete++;
|
||||
if (heap_rprev(file,record3) || heap_rprev(file,record3))
|
||||
goto err;
|
||||
if (heap_delete(file,record3)) goto err;
|
||||
key_check-=atoi(record3);
|
||||
key1[atoi(record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
|
||||
key_check-=atoi((char*) record3);
|
||||
key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
|
||||
opt_delete++;
|
||||
ant=3;
|
||||
while ((error=heap_rprev(file,record3)) == 0 ||
|
||||
@ -365,10 +366,10 @@ int main(int argc, char *argv[])
|
||||
if (error)
|
||||
goto err;
|
||||
if (heap_delete(file,record3)) goto err;
|
||||
key_check-=atoi(record3);
|
||||
key_check-=atoi((char*) record3);
|
||||
opt_delete++;
|
||||
key1[atoi(record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi(record+keyinfo[2].seg[0].start)]=0;
|
||||
key1[atoi((char*) record+keyinfo[0].seg[0].start)]--;
|
||||
key3[atoi((char*) record+keyinfo[2].seg[0].start)]=0;
|
||||
ant=0;
|
||||
while ((error=heap_scan(file,record3)) == 0 ||
|
||||
error == HA_ERR_RECORD_DELETED)
|
||||
@ -510,7 +511,7 @@ int main(int argc, char *argv[])
|
||||
for (i=999, dupp_keys=found_key=0 ; i>0 ; i--)
|
||||
{
|
||||
if (key1[i] > dupp_keys) { dupp_keys=key1[i]; found_key=i; }
|
||||
sprintf(key,"%6d",found_key);
|
||||
sprintf((char*) key,"%6d",found_key);
|
||||
}
|
||||
printf("- Read through all keys with first-next-last-prev\n");
|
||||
ant=0;
|
||||
@ -577,7 +578,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (heap_write(file2,record))
|
||||
goto err;
|
||||
key_check-=atoi(record);
|
||||
key_check-=atoi((char*) record);
|
||||
write_count++;
|
||||
if (heap_delete(file,record))
|
||||
goto err;
|
||||
@ -684,11 +685,11 @@ static int calc_check(uchar *buf, uint length)
|
||||
return check;
|
||||
}
|
||||
|
||||
static void make_record(char *record, uint n1, uint n2, uint n3,
|
||||
static void make_record(uchar *record, uint n1, uint n2, uint n3,
|
||||
const char *mark, uint count)
|
||||
{
|
||||
bfill(record,reclength,' ');
|
||||
sprintf(record,"%6d:%4d:%8d:%3.3s: %4d",
|
||||
sprintf((char*) record,"%6d:%4d:%8d:%3.3s: %4d",
|
||||
n1,n2,n3,mark,count);
|
||||
record[37]='A'; /* Store A in null key */
|
||||
record[38]=1; /* set as null */
|
||||
|
Reference in New Issue
Block a user