strtoq.c (9845) | strtoq.c (17141) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 105 unchanged lines hidden (view full) --- 114 if (isdigit(c)) 115 c -= '0'; 116 else if (isalpha(c)) 117 c -= isupper(c) ? 'A' - 10 : 'a' - 10; 118 else 119 break; 120 if (c >= base) 121 break; | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 105 unchanged lines hidden (view full) --- 114 if (isdigit(c)) 115 c -= '0'; 116 else if (isalpha(c)) 117 c -= isupper(c) ? 'A' - 10 : 'a' - 10; 118 else 119 break; 120 if (c >= base) 121 break; |
122 if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) | 122 if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) |
123 any = -1; 124 else { 125 any = 1; 126 acc *= qbase; 127 acc += c; 128 } 129 } 130 if (any < 0) { 131 acc = neg ? QUAD_MIN : QUAD_MAX; 132 errno = ERANGE; 133 } else if (neg) 134 acc = -acc; 135 if (endptr != 0) 136 *endptr = (char *)(any ? s - 1 : nptr); 137 return (acc); 138} | 123 any = -1; 124 else { 125 any = 1; 126 acc *= qbase; 127 acc += c; 128 } 129 } 130 if (any < 0) { 131 acc = neg ? QUAD_MIN : QUAD_MAX; 132 errno = ERANGE; 133 } else if (neg) 134 acc = -acc; 135 if (endptr != 0) 136 *endptr = (char *)(any ? s - 1 : nptr); 137 return (acc); 138} |