~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/csv/transparent_file.cc

Renamed strings to mystrings, for include/lib naming consistency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
  along with this program; if not, write to the Free Software
14
14
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
 
16
#ifdef USE_PRAGMA_IMPLEMENTATION
 
17
#pragma implementation        // gcc: Class implementation
 
18
#endif
16
19
 
17
 
#include <drizzled/common_includes.h>
 
20
#include "mysql_priv.h"
18
21
#include "transparent_file.h"
19
22
 
20
23
Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
21
24
22
 
  buff= (unsigned char *) my_malloc(buff_size*sizeof(unsigned char),  MYF(MY_WME)); 
 
25
  buff= (uchar *) my_malloc(buff_size*sizeof(uchar),  MYF(MY_WME)); 
23
26
}
24
27
 
25
28
Transparent_file::~Transparent_file()
26
29
27
 
  free((unsigned char*)buff); 
 
30
  my_free((uchar*)buff, MYF(MY_ALLOW_ZERO_PTR)); 
28
31
}
29
32
 
30
33
void Transparent_file::init_buff(File filedes_arg)
32
35
  filedes= filedes_arg;
33
36
  /* read the beginning of the file */
34
37
  lower_bound= 0;
35
 
  my_seek(filedes, 0, MY_SEEK_SET, MYF(0));
 
38
  VOID(my_seek(filedes, 0, MY_SEEK_SET, MYF(0)));
36
39
  if (filedes && buff)
37
40
    upper_bound= my_read(filedes, buff, buff_size, MYF(0));
38
41
}
39
42
 
40
 
unsigned char *Transparent_file::ptr()
 
43
uchar *Transparent_file::ptr()
41
44
42
45
  return buff; 
43
46
}
82
85
  if ((lower_bound <= offset) && (offset < upper_bound))
83
86
    return buff[offset - lower_bound];
84
87
 
85
 
  my_seek(filedes, offset, MY_SEEK_SET, MYF(0));
 
88
  VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0)));
86
89
  /* read appropriate portion of the file */
87
90
  if ((bytes_read= my_read(filedes, buff, buff_size,
88
91
                           MYF(0))) == MY_FILE_ERROR)