You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/08/03 02:08:05 UTC

[GitHub] [incubator-kvrocks] Ranxy opened a new issue, #766: The atoi exception was not caught

Ranxy opened a new issue, #766:
URL: https://github.com/apache/incubator-kvrocks/issues/766

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-kvrocks/issues) and found no similar issues.
   
   
   ### Motivation
   
   There is some code in the project as follows
   ```cpp
   try {
           slot_ = atoi(args[2].c_str());
           dst_node_id_ = args[3];
         } catch (std::exception &e) {
           return Status(Status::RedisParseErr, errValueNotInterger);
         }
   ```
   However `atoi` does not throw exceptions, so perhaps we should use `std::stoi` to replace these.
   
   
   
   ### Solution
   
   Replace `atoi` to `std::stoi`
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk commented on issue #766: The atoi exception was not caught

Posted by GitBox <gi...@apache.org>.
git-hulk commented on issue #766:
URL: https://github.com/apache/incubator-kvrocks/issues/766#issuecomment-1203402702

   Good catch, I think we can use `Util::OctalStringToNum` to replace the `atoi` which also can check the min/max boundary.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk closed issue #766: The atoi exception was not caught

Posted by GitBox <gi...@apache.org>.
git-hulk closed issue #766: The atoi exception was not caught
URL: https://github.com/apache/incubator-kvrocks/issues/766


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org