summaryrefslogtreecommitdiff
path: root/sql/mf_iocache.cc
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-11-18 02:15:06 +0200
committerunknown <monty@donna.mysql.com>2000-11-18 02:15:06 +0200
commit0ffa94682eb3ec86bd3c45fdee68f5ecda5e6ab7 (patch)
treee47c14103d1588f6a27c229783e07d73438c96d0 /sql/mf_iocache.cc
parent19fc413aa25290016069efbc9e25e2e79b3ea7c9 (diff)
downloadmariadb-git-0ffa94682eb3ec86bd3c45fdee68f5ecda5e6ab7.tar.gz
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
Diffstat (limited to 'sql/mf_iocache.cc')
-rw-r--r--sql/mf_iocache.cc21
1 files changed, 13 insertions, 8 deletions
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 <errno.h>
static void my_aiowait(my_aio_result *result);
#endif
+#include <assert.h>
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)));