~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/decimal.c

  • Committer: Andy Lester
  • Date: 2008-08-10 01:24:02 UTC
  • mto: (266.1.31 use-replace-funcs)
  • mto: This revision was merged to the branch mainline in revision 295.
  • Revision ID: andy@petdance.com-20080810012402-poten4vrxv1y7rki
make things more const-correct

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
  to->sign= 0;
232
232
  if ((intpart= to->intg= (precision - frac)))
233
233
  {
234
 
    int firstdigits= intpart % DIG_PER_DEC1;
 
234
    const int firstdigits= intpart % DIG_PER_DEC1;
235
235
    if (firstdigits)
236
236
      *buf++= powers10[firstdigits] - 1; /* get 9 99 999 ... */
237
237
    for(intpart/= DIG_PER_DEC1; intpart; intpart--)
240
240
 
241
241
  if ((to->frac= frac))
242
242
  {
243
 
    int lastdigits= frac % DIG_PER_DEC1;
 
243
    const int lastdigits= frac % DIG_PER_DEC1;
244
244
    for(frac/= DIG_PER_DEC1; frac; frac--)
245
245
      *buf++= DIG_MAX;
246
246
    if (lastdigits)
785
785
int
786
786
internal_str2dec(const char *from, decimal_t *to, char **end, bool fixed)
787
787
{
788
 
  const char *s= from, *s1, *endp, *end_of_string= *end;
 
788
  const char *s= from, *s1;
 
789
  char *end_of_string = *end;
 
790
  char *endp;
789
791
  int i, intg, frac, error, intg1, frac1;
790
792
  dec1 x,*buf;
791
793
  sanity(to);
818
820
    endp= s;
819
821
  }
820
822
 
821
 
  *end= (char*) endp;
 
823
  *end= endp;
822
824
 
823
825
  if (frac+intg == 0)
824
826
    goto fatal_error;
896
898
  if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E'))
897
899
  {
898
900
    int str_error;
899
 
    int64_t exponent= my_strtoll10(endp+1, (char**) &end_of_string,
 
901
    const int64_t exponent= my_strtoll10(endp+1, (char**) &end_of_string,
900
902
                                    &str_error);
901
903
 
902
904
    if (end_of_string != endp +1)               /* If at least one digit */