summaryrefslogtreecommitdiff
path: root/storage/csv
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-06-11 12:07:59 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-06-11 12:07:59 +0200
commita22c8c5be5ceadd23eed707ae2f1308ced2de977 (patch)
tree796cc97d1d103e18e0672d9b57dee4c54857073c /storage/csv
parent510835a0727fc1ebe98e2808cae91c8ab014d27e (diff)
parent585cf08fe6a8d6e237732daa94a969f93e5c84ec (diff)
downloadmariadb-git-a22c8c5be5ceadd23eed707ae2f1308ced2de977.tar.gz
Merge MySQL 5.1.35 into MySQL 5.4
Diffstat (limited to 'storage/csv')
-rw-r--r--storage/csv/ha_tina.cc33
-rw-r--r--storage/csv/ha_tina.h16
-rw-r--r--storage/csv/transparent_file.cc16
-rw-r--r--storage/csv/transparent_file.h12
4 files changed, 39 insertions, 38 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index e40c2db77db..63eb572105c 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -398,12 +398,12 @@ static int free_share(TINA_SHARE *share)
'\r''\n' -- DOS\Windows line ending
*/
-off_t find_eoln_buff(Transparent_file *data_buff, off_t begin,
- off_t end, int *eoln_len)
+my_off_t find_eoln_buff(Transparent_file *data_buff, my_off_t begin,
+ my_off_t end, int *eoln_len)
{
*eoln_len= 0;
- for (off_t x= begin; x < end; x++)
+ for (my_off_t x= begin; x < end; x++)
{
/* Unix (includes Mac OS X) */
if (data_buff->get_value(x) == '\n')
@@ -554,7 +554,7 @@ int ha_tina::chain_append()
/* We set up for the next position */
if ((off_t)(chain_ptr - chain) == (chain_size -1))
{
- off_t location= chain_ptr - chain;
+ my_off_t location= chain_ptr - chain;
chain_size += DEFAULT_CHAIN_LENGTH;
if (chain_alloced)
{
@@ -587,7 +587,7 @@ int ha_tina::chain_append()
*/
int ha_tina::find_current_row(uchar *buf)
{
- off_t end_offset, curr_offset= current_position;
+ my_off_t end_offset, curr_offset= current_position;
int eoln_len;
my_bitmap_map *org_bitmap;
int error;
@@ -837,7 +837,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
during locking. This is needed to enable concurrent inserts.
*/
thr_lock_data_init(&share->lock, &lock, (void*) this);
- ref_length=sizeof(off_t);
+ ref_length= sizeof(my_off_t);
share->lock.get_status= tina_get_status;
share->lock.update_status= tina_update_status;
@@ -1155,7 +1155,7 @@ int ha_tina::rnd_pos(uchar * buf, uchar *pos)
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
FALSE);
ha_statistic_increment(&SSV::ha_read_rnd_count);
- current_position= (off_t)my_get_ptr(pos,ref_length);
+ current_position= my_get_ptr(pos,ref_length);
rc= find_current_row(buf);
MYSQL_READ_ROW_DONE(rc);
DBUG_RETURN(rc);
@@ -1197,7 +1197,7 @@ int ha_tina::extra(enum ha_extra_function operation)
to the given "hole", stored in the buffer. "Valid" here means,
not listed in the chain of deleted records ("holes").
*/
-bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole)
+bool ha_tina::get_write_pos(my_off_t *end_pos, tina_set *closest_hole)
{
if (closest_hole == chain_ptr) /* no more chains */
*end_pos= file_buff->end();
@@ -1217,7 +1217,7 @@ bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole)
int ha_tina::rnd_end()
{
char updated_fname[FN_REFLEN];
- off_t file_buffer_start= 0;
+ my_off_t file_buffer_start= 0;
DBUG_ENTER("ha_tina::rnd_end");
free_root(&blobroot, MYF(0));
@@ -1240,17 +1240,17 @@ int ha_tina::rnd_end()
my_qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set),
(qsort_cmp)sort_set);
- off_t write_begin= 0, write_end;
+ my_off_t write_begin= 0, write_end;
/* create the file to write updated table if it wasn't yet created */
if (open_update_temp_file_if_needed())
DBUG_RETURN(-1);
/* write the file with updated info */
- while ((file_buffer_start != -1)) // while not end of file
+ while ((file_buffer_start != (my_off_t)-1)) // while not end of file
{
bool in_hole= get_write_pos(&write_end, ptr);
- off_t write_length= write_end - write_begin;
+ my_off_t write_length= write_end - write_begin;
/* if there is something to write, write it */
if (write_length)
@@ -1258,14 +1258,15 @@ int ha_tina::rnd_end()
if (my_write(update_temp_file,
(uchar*) (file_buff->ptr() +
(write_begin - file_buff->start())),
- write_length, MYF_RW))
+ (size_t)write_length, MYF_RW))
goto error;
temp_file_length+= write_length;
}
if (in_hole)
{
/* skip hole */
- while (file_buff->end() <= ptr->end && file_buffer_start != -1)
+ while (file_buff->end() <= ptr->end &&
+ file_buffer_start != (my_off_t)-1)
file_buffer_start= file_buff->read_next();
write_begin= ptr->end;
ptr++;
@@ -1365,7 +1366,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
File repair_file;
int rc;
ha_rows rows_repaired= 0;
- off_t write_begin= 0, write_end;
+ my_off_t write_begin= 0, write_end;
DBUG_ENTER("ha_tina::repair");
/* empty file */
@@ -1440,7 +1441,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
write_end= min(file_buff->end(), current_position);
if ((write_end - write_begin) &&
(my_write(repair_file, (uchar*)file_buff->ptr(),
- write_end - write_begin, MYF_RW)))
+ (size_t) (write_end - write_begin), MYF_RW)))
DBUG_RETURN(-1);
write_begin= write_end;
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index 5b4381396fc..02e0700a825 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -40,7 +40,7 @@ typedef struct st_tina_share {
inserts, updates and deletes. The var is initialized along with the
share initialization.
*/
- off_t saved_data_file_length;
+ my_off_t saved_data_file_length;
pthread_mutex_t mutex;
THR_LOCK lock;
bool update_file_opened;
@@ -53,18 +53,18 @@ typedef struct st_tina_share {
} TINA_SHARE;
struct tina_set {
- off_t begin;
- off_t end;
+ my_off_t begin;
+ my_off_t end;
};
class ha_tina: public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
TINA_SHARE *share; /* Shared lock info */
- off_t current_position; /* Current position in the file during a file scan */
- off_t next_position; /* Next position in the file scan */
- off_t local_saved_data_file_length; /* save position for reads */
- off_t temp_file_length;
+ my_off_t current_position; /* Current position in the file during a file scan */
+ my_off_t next_position; /* Next position in the file scan */
+ my_off_t local_saved_data_file_length; /* save position for reads */
+ my_off_t temp_file_length;
uchar byte_buffer[IO_SIZE];
Transparent_file *file_buff;
File data_file; /* File handler for readers */
@@ -85,7 +85,7 @@ class ha_tina: public handler
MEM_ROOT blobroot;
private:
- bool get_write_pos(off_t *end_pos, tina_set *closest_hole);
+ bool get_write_pos(my_off_t *end_pos, tina_set *closest_hole);
int open_update_temp_file_if_needed();
int init_tina_writer();
int init_data_file();
diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc
index a200fa6ac36..841c3efc476 100644
--- a/storage/csv/transparent_file.cc
+++ b/storage/csv/transparent_file.cc
@@ -45,17 +45,17 @@ uchar *Transparent_file::ptr()
return buff;
}
-off_t Transparent_file::start()
+my_off_t Transparent_file::start()
{
return lower_bound;
}
-off_t Transparent_file::end()
+my_off_t Transparent_file::end()
{
return upper_bound;
}
-off_t Transparent_file::read_next()
+my_off_t Transparent_file::read_next()
{
size_t bytes_read;
@@ -64,11 +64,11 @@ off_t Transparent_file::read_next()
always points to upper_bound byte
*/
if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR)
- return (off_t) -1;
+ return (my_off_t) -1;
/* end of file */
if (!bytes_read)
- return (off_t) -1;
+ return (my_off_t) -1;
lower_bound= upper_bound;
upper_bound+= bytes_read;
@@ -77,12 +77,12 @@ off_t Transparent_file::read_next()
}
-char Transparent_file::get_value(off_t offset)
+char Transparent_file::get_value(my_off_t offset)
{
size_t bytes_read;
/* check boundaries */
- if ((lower_bound <= offset) && (offset < upper_bound))
+ if ((lower_bound <= offset) && (((my_off_t) offset) < upper_bound))
return buff[offset - lower_bound];
VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
@@ -95,7 +95,7 @@ char Transparent_file::get_value(off_t offset)
upper_bound= lower_bound + bytes_read;
/* end of file */
- if (upper_bound == offset)
+ if (upper_bound == (my_off_t) offset)
return 0;
return buff[0];
diff --git a/storage/csv/transparent_file.h b/storage/csv/transparent_file.h
index 4c0f4cce7e7..0168e271e7d 100644
--- a/storage/csv/transparent_file.h
+++ b/storage/csv/transparent_file.h
@@ -23,8 +23,8 @@ class Transparent_file
File filedes;
uchar *buff; /* in-memory window to the file or mmaped area */
/* current window sizes */
- off_t lower_bound;
- off_t upper_bound;
+ my_off_t lower_bound;
+ my_off_t upper_bound;
uint buff_size;
public:
@@ -34,8 +34,8 @@ public:
void init_buff(File filedes_arg);
uchar *ptr();
- off_t start();
- off_t end();
- char get_value (off_t offset);
- off_t read_next();
+ my_off_t start();
+ my_off_t end();
+ char get_value (my_off_t offset);
+ my_off_t read_next();
};