MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_strtoll10

Function my_strtoll10

strings/my_strtoll10.c:74–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73
74longlong my_strtoll10(const char *nptr, char **endptr, int *error)
75{
76 const char *s, *end, *start, *n_end, *true_end;
77 char *dummy;
78 uchar c;
79 unsigned long i, j, k;
80 ulonglong li;
81 int negative;
82 ulong cutoff, cutoff2, cutoff3;
83
84 s= nptr;
85 /* If fixed length string */
86 if (endptr)
87 {
88 end= *endptr;
89 while (s != end && (*s == ' ' || *s == '\t'))
90 s++;
91 if (s == end)
92 goto no_conv;
93 }
94 else
95 {
96 endptr= &dummy; /* Easier end test */
97 while (*s == ' ' || *s == '\t')
98 s++;
99 if (!*s)
100 goto no_conv;
101 /* This number must be big to guard against a lot of pre-zeros */
102 end= s+65535; /* Can't be longer than this */
103 }
104
105 /* Check for a sign. */
106 negative= 0;
107 if (*s == '-')
108 {
109 *error= -1; /* Mark as negative number */
110 negative= 1;
111 if (++s == end)
112 goto no_conv;
113 cutoff= MAX_NEGATIVE_NUMBER / LFACTOR2;
114 cutoff2= (MAX_NEGATIVE_NUMBER % LFACTOR2) / 100;
115 cutoff3= MAX_NEGATIVE_NUMBER % 100;
116 }
117 else
118 {
119 *error= 0;
120 if (*s == '+')
121 {
122 if (++s == end)
123 goto no_conv;
124 }
125 cutoff= ULONGLONG_MAX / LFACTOR2;
126 cutoff2= ULONGLONG_MAX % LFACTOR2 / 100;
127 cutoff3= ULONGLONG_MAX % 100;
128 }
129
130 /* Handle case where we have a lot of pre-zero */
131 if (*s == '0')

Callers 8

internal_str2decFunction · 0.85
my_strtoll10_8bitFunction · 0.85
extract_date_timeFunction · 0.85
val_intMethod · 0.85
get_file_options_ulllistFunction · 0.85
parseMethod · 0.85
Item_intMethod · 0.85
parse_error_offsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected