~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/str/pad.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
  String *res= args[0]->val_str(str);
73
73
  String *rpad= args[2]->val_str(&rpad_str);
74
74
 
75
 
  if (!res || args[1]->null_value || !rpad || 
 
75
  if (!res || args[1]->null_value || !rpad ||
76
76
      ((count < 0) && !args[1]->unsigned_flag))
77
77
    goto err;
78
78
  null_value=0;
131
131
  // Handle character set for args[0] and args[2].
132
132
  if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 2))
133
133
    return;
134
 
  
 
134
 
135
135
  if (args[1]->const_item())
136
136
  {
137
137
    uint64_t length= 0;
173
173
  String *res= args[0]->val_str(&tmp_value);
174
174
  String *pad= args[2]->val_str(&lpad_str);
175
175
 
176
 
  if (!res || args[1]->null_value || !pad ||  
 
176
  if (!res || args[1]->null_value || !pad ||
177
177
      ((count < 0) && !args[1]->unsigned_flag))
178
 
    goto err;  
 
178
    goto err;
179
179
  null_value=0;
180
180
  /* Assumes that the maximum length of a String is < INT32_MAX. */
181
181
  /* Set here so that rest of code sees out-of-bound value as such. */
189
189
    res->length(res->charpos((int) count));
190
190
    return res;
191
191
  }
192
 
  
 
192
 
193
193
  pad_char_length= pad->numchars();
194
194
  byte_count= count * collation.collation->mbmaxlen;
195
 
  
 
195
 
196
196
  if ((uint64_t) byte_count > current_session->variables.max_allowed_packet)
197
197
  {
198
198
    push_warning_printf(current_session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
205
205
  if (args[2]->null_value || !pad_char_length ||
206
206
      str->alloc((uint32_t) byte_count))
207
207
    goto err;
208
 
  
 
208
 
209
209
  str->length(0);
210
210
  str->set_charset(collation.collation);
211
211
  count-= res_char_length;