~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/default_modify.cc

  • Committer: Elan Ruusamäe
  • Date: 2008-12-02 20:06:31 UTC
  • mfrom: (637 drizzle)
  • mto: (641.3.10 devel)
  • mto: This revision was merged to the branch mainline in revision 649.
  • Revision ID: glen@haarber.alkohol.ee-20081202200631-f6h3vbnjaojvk3uq
- merge from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
  struct stat file_stat;
66
66
  char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer;
67
67
  size_t opt_len= 0, optval_len= 0, sect_len;
68
 
  uint32_t nr_newlines= 0, buffer_size;
 
68
  uint32_t nr_newlines= 0;
 
69
  size_t buffer_size;
69
70
  bool in_section= false, opt_applied= 0;
70
 
  uint32_t reserve_extended;
 
71
  size_t reserve_extended;
71
72
  uint32_t new_opt_len;
72
73
  int reserve_occupied= 0;
73
74
 
92
93
                     NEWLINE_LEN +              /* Space for newline */
93
94
                     RESERVE);                  /* Some additional space */
94
95
 
95
 
  buffer_size= (file_stat.st_size +
96
 
                1);                             /* The ending zero */
 
96
  buffer_size= (size_t)cmax((uint64_t)file_stat.st_size + 1, (uint64_t)SIZE_MAX);
97
97
 
98
98
  /*
99
99
    Reserve space to read the contents of the file and some more
100
100
    for the option we want to add.
101
101
  */
102
 
  if (!(file_buffer= (char*) my_malloc(buffer_size + reserve_extended,
103
 
                                       MYF(MY_WME))))
 
102
  if (!(file_buffer= (char*) malloc(cmax(buffer_size + reserve_extended,
 
103
                                         SIZE_MAX))))
104
104
    goto malloc_err;
105
105
 
106
106
  sect_len= strlen(section_name);