Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: macos build #3912

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/server/bitops_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1011,20 +1011,20 @@ nonstd::expected<CommonAttributes, std::string> ParseCommonAttr(CmdArgParser* pa
// Returns the CommandList if the parsing completed succefully or std::string
// to indicate an error
nonstd::expected<CommandList, std::string> ParseToCommandList(CmdArgList args, bool read_only) {
enum class Cmds { OVERFLOW, GET, SET, INCRBY };
enum class Cmds { OVERFLOW_OPT, GET_OPT, SET_OPT, INCRBY_OPT };
CommandList result;

using nonstd::make_unexpected;

CmdArgParser parser(args);
while (parser.HasNext()) {
auto cmd = parser.MapNext("OVERFLOW", Cmds::OVERFLOW, "GET", Cmds::GET, "SET", Cmds::SET,
"INCRBY", Cmds::INCRBY);
auto cmd = parser.MapNext("OVERFLOW", Cmds::OVERFLOW_OPT, "GET", Cmds::GET_OPT, "SET",
Cmds::SET_OPT, "INCRBY", Cmds::INCRBY_OPT);
if (parser.Error()) {
return make_unexpected(kSyntaxErr);
}

if (cmd == Cmds::OVERFLOW) {
if (cmd == Cmds::OVERFLOW_OPT) {
if (read_only) {
make_unexpected("BITFIELD_RO only supports the GET subcommand");
}
Expand All @@ -1045,7 +1045,7 @@ nonstd::expected<CommandList, std::string> ParseToCommandList(CmdArgList args, b
}

auto attr = maybe_attr.value();
if (cmd == Cmds::GET) {
if (cmd == Cmds::GET_OPT) {
result.push_back(Command(Get(attr)));
continue;
}
Expand All @@ -1058,12 +1058,12 @@ nonstd::expected<CommandList, std::string> ParseToCommandList(CmdArgList args, b
if (parser.Error()) {
return make_unexpected(kSyntaxErr);
}
if (cmd == Cmds::SET) {
if (cmd == Cmds::SET_OPT) {
result.push_back(Command(Set(attr, value)));
continue;
}

if (cmd == Cmds::INCRBY) {
if (cmd == Cmds::INCRBY_OPT) {
result.push_back(Command(IncrBy(attr, value)));
continue;
}
Expand Down
Loading