summaryrefslogtreecommitdiff
path: root/mysys/mf_iocache2.c
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-11-28 03:47:15 +0200
committerunknown <monty@hundin.mysql.fi>2001-11-28 03:47:15 +0200
commit38da1f9853ec773e6c32cdf931b1fafef2736995 (patch)
tree1591378c44e709fb0ac9df322ad1e001c517ae50 /mysys/mf_iocache2.c
parentda9b7e0c87b8fe7349256c3068aed09d02fb3a47 (diff)
downloadmariadb-git-38da1f9853ec773e6c32cdf931b1fafef2736995.tar.gz
Fix for IO_CACHE.
Portability fixes. BUILD/compile-alpha-debug: Update to newer version libmysqld/lib_vio.c: dbug_assert -> DBUG_ASSERT mysql-test/r/symlink.result: Update for new tests mysql-test/t/symlink.test: Update for new test format mysys/mf_iocache2.c: Fixed bug when reading in old buffer sql-bench/test-transactions.sh: Update with delete tests sql/mysqld.cc: Updates for amiga sql/sql_string.cc: Fix typo sql/stacktrace.c: Portability fix
Diffstat (limited to 'mysys/mf_iocache2.c')
-rw-r--r--mysys/mf_iocache2.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index d85215a2f4b..59ad3675f5f 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -32,17 +32,16 @@
void my_b_seek(IO_CACHE *info,my_off_t pos)
{
+ my_off_t offset = (pos - info->pos_in_file);
DBUG_ENTER("my_b_seek");
DBUG_PRINT("enter",("pos: %lu", (ulong) pos));
if (info->type == READ_CACHE)
{
- byte* try_pos=info->read_pos + (pos - info->pos_in_file);
- if (try_pos >= info->buffer &&
- try_pos <= info->read_end)
+ if ((ulonglong) offset < (ulonglong) (info->read_end - info->buffer))
{
- /* The position is in the current buffer; Reuse it */
- info->read_pos = try_pos;
+ /* The read is in the current buffer; Reuse it */
+ info->read_pos = info->buffer + offset;
DBUG_VOID_RETURN;
}
else
@@ -53,17 +52,14 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
}
else if (info->type == WRITE_CACHE)
{
- byte* try_pos;
/* If write is in current buffer, reuse it */
- try_pos = info->write_pos + (pos - info->pos_in_file);
- if (try_pos >= info->write_buffer &&
- try_pos <= info->write_end)
+ if ((ulonglong) offset <
+ (ulonglong) (info->write_end - info->write_buffer))
{
- info->write_pos = try_pos;
+ info->write_pos = info->write_buffer + offset;
DBUG_VOID_RETURN;
}
- else
- flush_io_cache(info);
+ flush_io_cache(info);
}
info->pos_in_file=pos;
info->seek_not_done=1;