~laurynas-biveinis/percona-server/bug810272

Viewing all changes in revision 197.

  • Committer: Laurynas Biveinis
  • Date: 2011-11-18 08:57:06 UTC
  • Revision ID: laurynas.biveinis@percona.com-20111118085706-jlupkcpw7cjclcph
Fix bug 810272 (bogus snprintf return value checking and compilation
warning).

The warning is 
sql/query_response_time.cc:147: error: comparison of unsigned
expression < 0 is always false
and it indicates that the if clause is dead code, because of the wrong
assumption that snprintf returns a negative value on buffer truncate
(and the old code stores that value in an unsigned type anyway).

The fix:
- Drops buffer overflow check and returns the truncated buffer instead.
- Replaces snprintf with my_snprintf.
- Removes pre- and post-snprintf buffer writes.
- Removes now-unused arguments of print_time, updates callers and
  makes it static.
- Removes STRING_OVERFLOW, QRT_STRING_OVERFLOW, changes
  QRT_POSITIVE_POWER_FILLER to "", simplifies QRT_TIME_STRING_LENGTH
  and QRT_TOTAL_STRING_LENGTH.
- Re-records the testcases.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: