~ubuntu-branches/ubuntu/natty/luatex/natty

« back to all changes in this revision

Viewing changes to source/texk/kpathsea/strtol.c

  • Committer: Package Import Robot
  • Author(s): Norbert Preining
  • Date: 2010-12-13 23:22:59 UTC
  • mfrom: (0.2.1) (1.5.4) (4.3.12 experimental)
  • Revision ID: package-import@ubuntu.com-20101213232259-nqq2mq5z5x6qldw3
Tags: 0.65.0-1
* new upstream release
* ship two source packages as they are distributed by upstream, only
  renamed to match source package requirements. Fix debian/rules
  to install the manual pdf from the right place

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    {
133
133
      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
134
134
      if (*grouping <= 0 || *grouping == CHAR_MAX)
135
 
        grouping = NULL;
 
135
        grouping = NULL;
136
136
      else
137
 
        {
138
 
          /* Figure out the thousands separator character.  */
139
 
          if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
140
 
                      strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
141
 
            thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
142
 
          if (thousands == L'\0')
143
 
            grouping = NULL;
144
 
        }
 
137
        {
 
138
          /* Figure out the thousands separator character.  */
 
139
          if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
 
140
                      strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
 
141
            thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
 
142
          if (thousands == L'\0')
 
143
            grouping = NULL;
 
144
        }
145
145
    }
146
146
  else
147
147
    grouping = NULL;
179
179
  if (base == 0)
180
180
    if (*s == '0')
181
181
      {
182
 
        if (toupper (s[1]) == 'X')
183
 
          {
184
 
            s += 2;
185
 
            base = 16;
186
 
          }
187
 
        else
188
 
          base = 8;
 
182
        if (toupper (s[1]) == 'X')
 
183
          {
 
184
            s += 2;
 
185
            base = 16;
 
186
          }
 
187
        else
 
188
          base = 8;
189
189
      }
190
190
    else
191
191
      base = 10;
199
199
      /* Find the end of the digit string and check its grouping.  */
200
200
      end = s;
201
201
      for (c = *end; c != '\0'; c = *++end)
202
 
        if (c != thousands && !isdigit (c) &&
203
 
            (!isalpha (c) || toupper (c) - 'A' + 10 >= base))
204
 
          break;
 
202
        if (c != thousands && !isdigit (c) &&
 
203
            (!isalpha (c) || toupper (c) - 'A' + 10 >= base))
 
204
          break;
205
205
      if (*s == thousands)
206
 
        end = s;
 
206
        end = s;
207
207
      else
208
 
        end = correctly_grouped_prefix (s, end, thousands, grouping);
 
208
        end = correctly_grouped_prefix (s, end, thousands, grouping);
209
209
    }
210
210
  else
211
211
#endif
219
219
  for (c = *s; c != '\0'; c = *++s)
220
220
    {
221
221
      if (s == end)
222
 
        break;
 
222
        break;
223
223
      if (isdigit (c))
224
 
        c -= '0';
 
224
        c -= '0';
225
225
      else if (isalpha (c))
226
 
        c = toupper (c) - 'A' + 10;
 
226
        c = toupper (c) - 'A' + 10;
227
227
      else
228
 
        break;
 
228
        break;
229
229
      if (c >= base)
230
 
        break;
 
230
        break;
231
231
      /* Check for overflow.  */
232
232
      if (i > cutoff || (i == cutoff && c > cutlim))
233
 
        overflow = 1;
 
233
        overflow = 1;
234
234
      else
235
 
        {
236
 
          i *= (unsigned LONG int) base;
237
 
          i += c;
238
 
        }
 
235
        {
 
236
          i *= (unsigned LONG int) base;
 
237
          i += c;
 
238
        }
239
239
    }
240
240
 
241
241
  /* Check if anything actually happened.  */
251
251
  /* Check for a value that is within the range of
252
252
     `unsigned LONG int', but outside the range of `LONG int'.  */
253
253
  if (i > (negative ?
254
 
           -(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX))
 
254
           -(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX))
255
255
    overflow = 1;
256
256
#endif
257
257