Skip to content

Commit 80631f4

Browse files
complete code
1 parent 0acd2b7 commit 80631f4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/brpc/redis_command.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,19 @@ size_t RedisCommandParser::ParsedArgsSize() {
370370
return _args.size();
371371
}
372372

373+
int find_crlf(const char* pfc, size_t length) {
374+
for (size_t i = 0; i < length - 1; ++i) {
375+
if (pfc[i] == '\r' && pfc[i + 1] == '\n') {
376+
return i;
377+
}
378+
}
379+
return -1;
380+
}
381+
373382
ParseError RedisCommandParser::Consume(butil::IOBuf& buf,
374383
std::vector<butil::StringPiece>* args,
375384
butil::Arena* arena) {
376-
const char* pfc = (const char*)buf.fetch1();
385+
const auto pfc = static_cast<const char *>(buf.fetch1());
377386
if (pfc == NULL) {
378387
return PARSE_ERROR_NOT_ENOUGH_DATA;
379388
}

0 commit comments

Comments
 (0)