~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/my_strtoll10.c

  • Committer: Monty Taylor
  • Date: 2008-07-31 19:56:51 UTC
  • mto: (202.3.5 gettextize)
  • mto: This revision was merged to the branch mainline in revision 243.
  • Revision ID: monty@inaugust.com-20080731195651-8rolsypajn99uc2p
Some cleanups/decoupling in mystring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include <m_string.h>
17
 
#include <mysys/my_sys.h>            /* Needed for MY_ERRNO_ERANGE */
 
17
#include <errno.h>
18
18
 
19
19
#undef  ULONGLONG_MAX
20
20
#define ULONGLONG_MAX           (~(uint64_t) 0)
76
76
{
77
77
  const char *s, *end, *start, *n_end, *true_end;
78
78
  char *dummy;
79
 
  uchar c;
 
79
  unsigned char c;
80
80
  unsigned long i, j, k;
81
81
  uint64_t li;
82
82
  int negative;
83
 
  ulong cutoff, cutoff2, cutoff3;
 
83
  unsigned long cutoff, cutoff2, cutoff3;
84
84
 
85
85
  s= nptr;
86
86
  /* If fixed length string */
201
201
  return (int64_t) li;
202
202
 
203
203
overflow:                                       /* *endptr is set here */
204
 
  *error= MY_ERRNO_ERANGE;
 
204
  *error= ERANGE;
205
205
  return negative ? INT64_MIN: (int64_t) ULONGLONG_MAX;
206
206
 
207
207
end_i:
209
209
  return (negative ? ((int64_t) -(long) i) : (int64_t) i);
210
210
 
211
211
end_i_and_j:
212
 
  li= (uint64_t) i * lfactor[(uint) (s-start)] + j;
 
212
  li= (uint64_t) i * lfactor[(unsigned int) (s-start)] + j;
213
213
  *endptr= (char*) s;
214
214
  return (negative ? -((int64_t) li) : (int64_t) li);
215
215
 
231
231
 
232
232
no_conv:
233
233
  /* There was no number to convert.  */
234
 
  *error= MY_ERRNO_EDOM;
 
234
  *error= EDOM;
235
235
  *endptr= (char *) nptr;
236
236
  return 0;
237
237
}