[SERVER-6038] Get rid of stringToNum in mongo/bson/util/misc.h Created: 07/Jun/12  Updated: 11/Jul/16  Resolved: 17/Jan/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.3.2

Type: Bug Priority: Major - P3
Reporter: Andy Schwerin Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-5633 'mongo' on Solaris aborts on startup Closed
Operating System: ALL
Participants:

 Description   

It has only three consumers, it throws an integer on error, which may be causing SERVER-5633, and the cstdlib function strtoul can be used to implement a saner version of the desired operation. I think we just want to use strotoul to write a function with the following signature:

/**

  • Parse a base-10 unsigned from "str", put the result into "result".
    *
  • Returns true if all the characters of "str" are consumed to produce a valid "result".
    */
    bool parseBase10(const StringData& str, unsigned *result);

Generated at Thu Feb 08 03:10:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.