MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / get_int_from_command

Function get_int_from_command

src/common.c:475–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473}
474
475uint64_t get_int_from_command(char **current_cmd)
476{
477 uint64_t tmp=0;
478 /*@
479 @ loop invariant valid_read_string(*current_cmd);
480 @ loop assigns *current_cmd, tmp;
481 @ loop variant strlen(*current_cmd);
482 @*/
483 while(*current_cmd[0] >='0' && *current_cmd[0] <= '9')
484 {
485#ifdef __FRAMAC__
486 const unsigned int v=*current_cmd[0] - '0';
487 /*@ assert 0 <= v <= 9; */
488 if(tmp >= UINT64_MAX / 10)
489 return tmp;
490 /** assert tmp < UINT64_MAX / 10; */
491 tmp *= 10;
492 /** assert tmp <= UINT64_MAX - 10; */
493 tmp += v;
494#else
495 tmp = tmp * 10 + (*current_cmd[0] - '0');
496#endif
497 (*current_cmd)++;
498 }
499 return tmp;
500}

Callers 5

ask_number_cliFunction · 0.85
menu_photorec_cliFunction · 0.85
ifFunction · 0.85
change_geometry_cliFunction · 0.85
adv_string_to_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected