~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_iocache.cc

Merged Trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
#include <errno.h>
59
59
#include <drizzled/util/test.h>
60
60
#include <stdlib.h>
 
61
#include <algorithm>
 
62
 
 
63
using namespace std;
61
64
 
62
65
#define lock_append_buffer(info) \
63
66
 pthread_mutex_lock(&(info)->append_buffer_lock)
1017
1020
  */
1018
1021
  while (write_length)
1019
1022
  {
1020
 
    size_t copy_length= cmin(write_length, write_cache->buffer_length);
 
1023
    size_t copy_length= min(write_length, write_cache->buffer_length);
1021
1024
    int  rc;
1022
1025
 
1023
1026
    rc= lock_io_cache(write_cache, write_cache->pos_in_file);
1175
1178
      TODO: figure out if the assert below is needed or correct.
1176
1179
    */
1177
1180
    assert(pos_in_file == info->end_of_file);
1178
 
    copy_len=cmin(Count, len_in_buff);
 
1181
    copy_len=min(Count, len_in_buff);
1179
1182
    memcpy(Buffer, info->append_read_pos, copy_len);
1180
1183
    info->append_read_pos += copy_len;
1181
1184
    Count -= copy_len;
1277
1280
      }
1278
1281
    }
1279
1282
        /* Copy found bytes to buffer */
1280
 
    length=cmin(Count,read_length);
 
1283
    length=min(Count,read_length);
1281
1284
    memcpy(Buffer,info->read_pos,(size_t) length);
1282
1285
    Buffer+=length;
1283
1286
    Count-=length;
1310
1313
      if ((read_length=my_read(info->file,info->request_pos,
1311
1314
                               read_length, info->myflags)) == (size_t) -1)
1312
1315
        return info->error= -1;
1313
 
      use_length=cmin(Count,read_length);
 
1316
      use_length=min(Count,read_length);
1314
1317
      memcpy(Buffer,info->request_pos,(size_t) use_length);
1315
1318
      info->read_pos=info->request_pos+Count;
1316
1319
      info->read_end=info->request_pos+read_length;