From: Tim Rowley Date: Tue, 19 Jul 2016 18:51:46 +0000 (-0600) Subject: swr: [rasterizer core] allow hexadecimal for integer knobs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f01827a469fa34f0ffb65e2e1401c4e362b0c5f4;p=mesa.git swr: [rasterizer core] allow hexadecimal for integer knobs Signed-off-by: Tim Rowley --- 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 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(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; } }