mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 21:17:54 +00:00
[client] added checking for invalid arguments to custom string options
This commit is contained in:
parent
4746c89227
commit
2c59b5f557
2 changed files with 11 additions and 2 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
B1-98-g278d851c7c+1
|
B1-99-g4746c89227+1
|
|
@ -449,6 +449,9 @@ static void doLicense()
|
||||||
|
|
||||||
static bool optRendererParse(struct Option * opt, const char * str)
|
static bool optRendererParse(struct Option * opt, const char * str)
|
||||||
{
|
{
|
||||||
|
if (!str)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (strcasecmp(str, "auto") == 0)
|
if (strcasecmp(str, "auto") == 0)
|
||||||
{
|
{
|
||||||
params.forceRenderer = false;
|
params.forceRenderer = false;
|
||||||
|
@ -490,6 +493,9 @@ static char * optRendererToString(struct Option * opt)
|
||||||
|
|
||||||
static bool optPosParse(struct Option * opt, const char * str)
|
static bool optPosParse(struct Option * opt, const char * str)
|
||||||
{
|
{
|
||||||
|
if (!str)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (strcmp(str, "center") == 0)
|
if (strcmp(str, "center") == 0)
|
||||||
{
|
{
|
||||||
params.center = true;
|
params.center = true;
|
||||||
|
@ -527,6 +533,9 @@ static char * optPosToString(struct Option * opt)
|
||||||
|
|
||||||
static bool optSizeParse(struct Option * opt, const char * str)
|
static bool optSizeParse(struct Option * opt, const char * str)
|
||||||
{
|
{
|
||||||
|
if (!str)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (sscanf(str, "%dx%d", ¶ms.w, ¶ms.h) == 2)
|
if (sscanf(str, "%dx%d", ¶ms.w, ¶ms.h) == 2)
|
||||||
{
|
{
|
||||||
if (params.w < 1 || params.h < 1)
|
if (params.w < 1 || params.h < 1)
|
||||||
|
@ -558,4 +567,4 @@ static char * optScancodeToString(struct Option * opt)
|
||||||
char * str;
|
char * str;
|
||||||
alloc_sprintf(&str, "%d = %s", opt->value.x_int, SDL_GetScancodeName(opt->value.x_int));
|
alloc_sprintf(&str, "%d = %s", opt->value.x_int, SDL_GetScancodeName(opt->value.x_int));
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue