28
28
#define my_b_EOF INT_MIN
30
#define my_b_read(info,Buffer,Count) \
31
((info)->read_pos + (Count) <= (info)->read_end ?\
32
(memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \
33
((info)->read_pos+=(Count)),0) :\
34
(*(info)->read_function)((info),Buffer,Count))
36
#define my_b_write(info,Buffer,Count) \
37
((info)->write_pos + (Count) <=(info)->write_end ?\
38
(memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
39
((info)->write_pos+=(Count)),0) : \
40
(*(info)->write_function)((info),(Buffer),(Count)))
42
#define my_b_get(info) \
43
((info)->read_pos != (info)->read_end ? ((info)->read_pos++, (int) (unsigned char) (info)->read_pos[-1]) : (info)->get())
45
#define my_b_tell(info) ((info)->tell())
47
#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - *(info)->current_pos)
50
typedef int (*IO_CACHE_CALLBACK)(io_cache_st*);
52
30
class io_cache_st /* Used when cacheing files */
33
typedef int (*IO_CACHE_CALLBACK)(io_cache_st*);
55
35
/* Offset in file corresponding to the first byte of unsigned char* buffer. */
56
36
my_off_t pos_in_file;
203
183
my_off_t tell() const
205
return pos_in_file + (*current_pos - request_pos);
185
return pos_in_file + *current_pos - request_pos;
188
int read(void* Buffer0, size_t Count)
190
unsigned char* Buffer= reinterpret_cast<unsigned char*>(Buffer0);
191
if (read_pos + Count > read_end)
192
return read_function(this, Buffer, Count);
193
memcpy(Buffer, read_pos, Count);
198
int write(const void* Buffer0, size_t Count)
200
const unsigned char* Buffer= reinterpret_cast<const unsigned char*>(Buffer0);
201
if (write_pos + Count > write_end)
202
return write_function(this, Buffer, Count);
203
memcpy(write_pos, Buffer, Count);
209
typedef io_cache_st IO_CACHE; /* Used when cacheing files */
211
209
} /* namespace internal */
212
210
} /* namespace drizzled */