summaryrefslogtreecommitdiffstats
path: root/crypto/ui/ui_lib.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-08-30 13:31:18 -0400
committerRich Salz <rsalz@openssl.org>2016-09-22 08:36:26 -0400
commitf3b3d7f0033080f86ede5a53e8af2fb313091b5a (patch)
treec3761c9e3503980b7a2933211424165adad3fa8d /crypto/ui/ui_lib.c
parent39c136cc53d7b6fafdd1a0b52c035fd24358e01c (diff)
Add -Wswitch-enum
Change code so when switching on an enumeration, have case's for all enumeration values. Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'crypto/ui/ui_lib.c')
-rw-r--r--crypto/ui/ui_lib.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c
index 004aeb02b6..273bfb6095 100644
--- a/crypto/ui/ui_lib.c
+++ b/crypto/ui/ui_lib.c
@@ -60,7 +60,11 @@ static void free_string(UI_STRING *uis)
OPENSSL_free((char *)uis->_.boolean_data.ok_chars);
OPENSSL_free((char *)uis->_.boolean_data.cancel_chars);
break;
- default:
+ case UIT_NONE:
+ case UIT_PROMPT:
+ case UIT_VERIFY:
+ case UIT_ERROR:
+ case UIT_INFO:
break;
}
}
@@ -689,9 +693,13 @@ const char *UI_get0_action_string(UI_STRING *uis)
case UIT_PROMPT:
case UIT_BOOLEAN:
return uis->_.boolean_data.action_desc;
- default:
- return NULL;
+ case UIT_NONE:
+ case UIT_VERIFY:
+ case UIT_INFO:
+ case UIT_ERROR:
+ break;
}
+ return NULL;
}
const char *UI_get0_result_string(UI_STRING *uis)
@@ -700,9 +708,13 @@ const char *UI_get0_result_string(UI_STRING *uis)
case UIT_PROMPT:
case UIT_VERIFY:
return uis->result_buf;
- default:
- return NULL;
+ case UIT_NONE:
+ case UIT_BOOLEAN:
+ case UIT_INFO:
+ case UIT_ERROR:
+ break;
}
+ return NULL;
}
const char *UI_get0_test_string(UI_STRING *uis)
@@ -710,9 +722,14 @@ const char *UI_get0_test_string(UI_STRING *uis)
switch (uis->type) {
case UIT_VERIFY:
return uis->_.string_data.test_buf;
- default:
- return NULL;
+ case UIT_NONE:
+ case UIT_BOOLEAN:
+ case UIT_INFO:
+ case UIT_ERROR:
+ case UIT_PROMPT:
+ break;
}
+ return NULL;
}
int UI_get_result_minsize(UI_STRING *uis)
@@ -721,9 +738,13 @@ int UI_get_result_minsize(UI_STRING *uis)
case UIT_PROMPT:
case UIT_VERIFY:
return uis->_.string_data.result_minsize;
- default:
- return -1;
+ case UIT_NONE:
+ case UIT_INFO:
+ case UIT_ERROR:
+ case UIT_BOOLEAN:
+ break;
}
+ return -1;
}
int UI_get_result_maxsize(UI_STRING *uis)
@@ -732,9 +753,13 @@ int UI_get_result_maxsize(UI_STRING *uis)
case UIT_PROMPT:
case UIT_VERIFY:
return uis->_.string_data.result_maxsize;
- default:
- return -1;
+ case UIT_NONE:
+ case UIT_INFO:
+ case UIT_ERROR:
+ case UIT_BOOLEAN:
+ break;
}
+ return -1;
}
int UI_set_result(UI *ui, UI_STRING *uis, const char *result)
@@ -800,7 +825,9 @@ int UI_set_result(UI *ui, UI_STRING *uis, const char *result)
}
}
}
- default:
+ case UIT_NONE:
+ case UIT_INFO:
+ case UIT_ERROR:
break;
}
return 0;