| 526 | } |
| 527 | |
| 528 | static int processItem(redisReader *r) { |
| 529 | redisReadTask *cur = r->task[r->ridx]; |
| 530 | char *p; |
| 531 | |
| 532 | /* check if we need to read type */ |
| 533 | if (cur->type < 0) { |
| 534 | if ((p = readBytes(r,1)) != NULL) { |
| 535 | switch (p[0]) { |
| 536 | case '-': |
| 537 | cur->type = REDIS_REPLY_ERROR; |
| 538 | break; |
| 539 | case '+': |
| 540 | cur->type = REDIS_REPLY_STATUS; |
| 541 | break; |
| 542 | case ':': |
| 543 | cur->type = REDIS_REPLY_INTEGER; |
| 544 | break; |
| 545 | case ',': |
| 546 | cur->type = REDIS_REPLY_DOUBLE; |
| 547 | break; |
| 548 | case '_': |
| 549 | cur->type = REDIS_REPLY_NIL; |
| 550 | break; |
| 551 | case '$': |
| 552 | cur->type = REDIS_REPLY_STRING; |
| 553 | break; |
| 554 | case '*': |
| 555 | cur->type = REDIS_REPLY_ARRAY; |
| 556 | break; |
| 557 | case '%': |
| 558 | cur->type = REDIS_REPLY_MAP; |
| 559 | break; |
| 560 | case '~': |
| 561 | cur->type = REDIS_REPLY_SET; |
| 562 | break; |
| 563 | case '#': |
| 564 | cur->type = REDIS_REPLY_BOOL; |
| 565 | break; |
| 566 | case '=': |
| 567 | cur->type = REDIS_REPLY_VERB; |
| 568 | break; |
| 569 | case '>': |
| 570 | cur->type = REDIS_REPLY_PUSH; |
| 571 | break; |
| 572 | default: |
| 573 | __redisReaderSetErrorProtocolByte(r,*p); |
| 574 | return REDIS_ERR; |
| 575 | } |
| 576 | } else { |
| 577 | /* could not consume 1 byte */ |
| 578 | return REDIS_ERR; |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | /* process typed item */ |
| 583 | switch(cur->type) { |
| 584 | case REDIS_REPLY_ERROR: |
| 585 | case REDIS_REPLY_STATUS: |
no test coverage detected