-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2169,3 +2169,9 @@ Bool gf_parse_frac(const char *value, GF_Fraction *frac) | |
frac->den = (u32) r.den; | ||
return res; | ||
} | ||
|
||
Bool gf_strict_atoi(const char* str, int* ans) { | ||
char * end_ptr; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
touatily
Author
Contributor
|
||
*ans = strtol(str, &end_ptr, 10); | ||
return !isspace(*str) && end_ptr != str && *end_ptr == '\0'; | ||
} |
1 comment
on commit 48e6376
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function would be a perfect fit for unit tests :) CC @jeanlf @aureliendavid @touatily @soheibthriber
Don't you you want to initialize this to NULL? It may be assigned only when a number is present, and a comparison then occur on the next line.