~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/decimal.cc

Merged Nathan from lp:~nlws/drizzle/fix-string-c-ptr-overrun

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
*/
99
99
 
100
100
#include <drizzled/global.h>
 
101
 
 
102
#include "m_string.h"
 
103
#include "m_ctype.h"
 
104
#include "decimal.h"
 
105
 
 
106
#include <plugin/myisam/myisampack.h>
 
107
#include <drizzled/util/test.h>
 
108
 
101
109
#include <alloca.h>
102
 
#include <m_string.h>
103
 
#include <m_ctype.h>
104
 
#include <storage/myisam/myisampack.h>
105
 
#include <mystrings/decimal.h>
106
 
 
107
 
#include <drizzled/util/test.h>
108
110
/*
109
111
  Internally decimal numbers are stored base 10^9 (see DIG_BASE below)
110
112
  So one variable of type decimal_digit_t is limited:
748
750
  beg= ROUND_UP(beg + 1) - 1;
749
751
  end= ROUND_UP(end) - 1;
750
752
  assert(new_point >= 0);
751
 
  
 
753
 
752
754
  /* We don't want negative new_point below */
753
755
  if (new_point != 0)
754
756
    new_point= ROUND_UP(new_point) - 1;
962
964
 
963
965
  rc = decimal2string(from, strbuf, &len, 0, 0, 0);
964
966
  end= strbuf + len;
965
 
  
 
967
 
966
968
  *to= my_strtod(strbuf, &end, &error);
967
 
             
 
969
 
968
970
  return (rc != E_DEC_OK) ? rc : (error ? E_DEC_OVERFLOW : E_DEC_OK);
969
971
}
970
972