diff options
author | Tim Rowley <[email protected]> | 2016-07-19 12:51:46 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-08-04 13:52:12 -0500 |
commit | f01827a469fa34f0ffb65e2e1401c4e362b0c5f4 (patch) | |
tree | faa38ddb1b57f92103e3a4ea04c414bf7c0ab97d /src/gallium/drivers/swr/rasterizer | |
parent | 49741e1cd23c726f1956fe2b2e78a85ba8482385 (diff) |
swr: [rasterizer core] allow hexadecimal for integer knobs
Signed-off-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/knobs_init.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/knobs_init.h b/src/gallium/drivers/swr/rasterizer/core/knobs_init.h index adf738c1bed..ba2df2292f0 100644 --- a/src/gallium/drivers/swr/rasterizer/core/knobs_init.h +++ b/src/gallium/drivers/swr/rasterizer/core/knobs_init.h @@ -38,7 +38,9 @@ template <typename T> static inline void ConvertEnvToKnob(const char* pOverride, T& knobValue) { uint32_t value = 0; - if (sscanf(pOverride, "%u", &value)) + char* pStopped = nullptr; + value = strtoul(pOverride, &pStopped, 0); + if (pStopped != pOverride) { knobValue = static_cast<T>(value); } @@ -64,10 +66,11 @@ static inline void ConvertEnvToKnob(const char* pOverride, bool& knobValue) // Try converting to a number and casting to bool uint32_t value = 0; - if (sscanf(pOverride, "%u", &value)) + char* pStopped = nullptr; + value = strtoul(pOverride, &pStopped, 0); + if (pStopped != pOverride) { knobValue = value != 0; - return; } } |