Changeset 619 for trunk/server/memcached.c
- Timestamp:
- 10/03/07 20:45:31 (2 years ago)
- Files:
-
- 1 modified
-
trunk/server/memcached.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/memcached.c
r615 r619 1259 1259 } 1260 1260 1261 static void process_arithmetic_command(conn *c, token_t *tokens, const size_t ntokens, const intincr) {1262 char temp[ 32];1261 static void process_arithmetic_command(conn *c, token_t *tokens, const size_t ntokens, const bool incr) { 1262 char temp[sizeof("18446744073709551615")]; 1263 1263 item *it; 1264 unsigned int delta;1264 int64_t delta; 1265 1265 char *key; 1266 1266 size_t nkey; … … 1289 1289 } 1290 1290 1291 delta = strto ul(tokens[2].value, NULL, 10);1291 delta = strtoll(tokens[2].value, NULL, 10); 1292 1292 1293 1293 if(errno == ERANGE) { … … 1316 1316 * returns a response string to send back to the client. 1317 1317 */ 1318 char *do_add_delta(item *it, const int incr, const unsigned int delta, char *buf) {1318 char *do_add_delta(item *it, const bool incr, const int64_t delta, char *buf) { 1319 1319 char *ptr; 1320 uint32_t value;1320 int64_t value; 1321 1321 int res; 1322 1322 … … 1324 1324 while ((*ptr != '\0') && (*ptr < '0' && *ptr > '9')) ptr++; // BUG: can't be true 1325 1325 1326 value = strtoul (ptr, NULL, 10);1326 value = strtoull(ptr, NULL, 10); 1327 1327 1328 1328 if(errno == ERANGE) { … … 1330 1330 } 1331 1331 1332 if (incr != 0)1332 if (incr) 1333 1333 value += delta; 1334 1334 else { … … 1336 1336 else value -= delta; 1337 1337 } 1338 s nprintf(buf, 32, "%u", value);1338 sprintf(buf, "%llu", value); 1339 1339 res = strlen(buf); 1340 1340 if (res + 2 > it->nbytes) { /* need to realloc */
