From 0ffa94682eb3ec86bd3c45fdee68f5ecda5e6ab7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 Nov 2000 02:15:06 +0200 Subject: Portability fixes Docs/manual.texi: Updated links and added more examples client/mysql.cc: Added --timeout + merge of Jani:s changes isam/_dynrec.c: Fixed bug when making big rows 1 byte smaller scripts/mysqlhotcopy.sh: Added regexp handling of filenames sql-bench/test-insert.sh: More order by tests sql/mf_iocache.cc: Cleanup sql/mysqld.cc: Moved my_delete() to before master thread died sql/sql_parse.cc: Fixed wrong comparison --- sql/mf_iocache.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'sql/mf_iocache.cc') diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc index c1e6b37a848..f723e35ca93 100644 --- a/sql/mf_iocache.cc +++ b/sql/mf_iocache.cc @@ -37,6 +37,7 @@ #include static void my_aiowait(my_aio_result *result); #endif +#include extern "C" { @@ -233,24 +234,28 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, - /* Read buffered. Returns 1 if can't read requested characters */ - /* Returns 0 if record read */ + /* + Read buffered. Returns 1 if can't read requested characters + This function is only called from the my_b_read() macro + when there isn't enough characters in the buffer to + satisfy the request. + Returns 0 we succeeded in reading all data + */ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count) { uint length,diff_length,left_length; my_off_t max_length, pos_in_file; - if((left_length=(uint) (info->rc_end-info->rc_pos))) + if ((left_length=(uint) (info->rc_end-info->rc_pos))) { - if(Count < left_length) - left_length = Count; - memcpy(Buffer,info->rc_pos, - (size_t) (left_length)); + dbug_assert(Count >= left_length); /* User is not using my_b_read() */ + memcpy(Buffer,info->rc_pos, (size_t) (left_length)); Buffer+=left_length; Count-=left_length; } - pos_in_file=info->pos_in_file+ left_length; + /* pos_in_file always point on where info->buffer was read */ + pos_in_file=info->pos_in_file+(uint) (info->rc_end - info->buffer); if (info->seek_not_done) { /* File touched, do seek */ VOID(my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))); -- cgit v1.2.1