MCPcopy Create free account
hub / github.com/chen3feng/toft / AsInt

Method AsInt

base/string/format/print_arg.cpp:410–424  ·  view source on GitHub ↗

This function is rarely used, so don't add another function pointer to reduce performance of most common case.

Source from the content-addressed store, hash-verified

408// This function is rarely used, so don't add another function pointer to
409// reduce performance of most common case.
410int FormatPrintArg::AsInt() const
411{
412 PrintSpecification spec;
413 spec.specifier = 'd';
414 char buffer[32];
415 { // Put t into a separate scope ensure '\0' is append after written.
416 BufferFormatPrintTarget t(buffer, sizeof(buffer));
417 if (Write(&t, spec) <= 0)
418 return -1;
419 }
420 int n;
421 if (!StringToNumber(buffer, &n))
422 return -1;
423 return n;
424}
425
426} // namespace toft

Callers 1

DoFillSpeciationFromArgFunction · 0.80

Calls 1

StringToNumberFunction · 0.50

Tested by

no test coverage detected