Updated settings

* Generator script now WINPR_ASSERT if invalid arguments are
  supplied
* Updated settings with new generated getter/setter
This commit is contained in:
akallabeth 2021-09-03 08:26:55 +02:00 committed by akallabeth
parent 83104fda9c
commit af8d1e5690
2 changed files with 22 additions and 40 deletions

View File

@ -1,5 +1,6 @@
/* Generated by */
#include <winpr/assert.h>
#include <freerdp/settings.h>
#include <freerdp/log.h>
@ -22,8 +23,7 @@ static BOOL update_string(char** current, const char* next, size_t next_len, BOO
BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -542,8 +542,7 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -1232,8 +1231,7 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
UINT16 freerdp_settings_get_uint16(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -1251,8 +1249,7 @@ UINT16 freerdp_settings_get_uint16(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_uint16(rdpSettings* settings, size_t id, UINT16 val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -1273,8 +1270,7 @@ BOOL freerdp_settings_set_uint16(rdpSettings* settings, size_t id, UINT16 val)
INT16 freerdp_settings_get_int16(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -1286,8 +1282,7 @@ INT16 freerdp_settings_get_int16(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_int16(rdpSettings* settings, size_t id, INT16 val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -1300,8 +1295,7 @@ BOOL freerdp_settings_set_int16(rdpSettings* settings, size_t id, INT16 val)
UINT32 freerdp_settings_get_uint32(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -1655,8 +1649,7 @@ UINT32 freerdp_settings_get_uint32(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_uint32(rdpSettings* settings, size_t id, UINT32 val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2125,8 +2118,7 @@ BOOL freerdp_settings_set_uint32(rdpSettings* settings, size_t id, UINT32 val)
INT32 freerdp_settings_get_int32(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2144,8 +2136,7 @@ INT32 freerdp_settings_get_int32(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_int32(rdpSettings* settings, size_t id, INT32 val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2166,8 +2157,7 @@ BOOL freerdp_settings_set_int32(rdpSettings* settings, size_t id, INT32 val)
UINT64 freerdp_settings_get_uint64(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2182,8 +2172,7 @@ UINT64 freerdp_settings_get_uint64(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_uint64(rdpSettings* settings, size_t id, UINT64 val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2200,8 +2189,7 @@ BOOL freerdp_settings_set_uint64(rdpSettings* settings, size_t id, UINT64 val)
INT64 freerdp_settings_get_int64(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2213,8 +2201,7 @@ INT64 freerdp_settings_get_int64(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_int64(rdpSettings* settings, size_t id, INT64 val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2227,8 +2214,7 @@ BOOL freerdp_settings_set_int64(rdpSettings* settings, size_t id, INT64 val)
const char* freerdp_settings_get_string(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2445,8 +2431,7 @@ const char* freerdp_settings_get_string(const rdpSettings* settings, size_t id)
BOOL freerdp_settings_set_string_(rdpSettings* settings, size_t id, const char* val, size_t len,
BOOL cleanup)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2676,8 +2661,7 @@ BOOL freerdp_settings_set_string(rdpSettings* settings, size_t id, const char* v
void* freerdp_settings_get_pointer_writable(const rdpSettings* settings, size_t id)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{
@ -2767,8 +2751,7 @@ void* freerdp_settings_get_pointer_writable(const rdpSettings* settings, size_t
BOOL freerdp_settings_set_pointer(rdpSettings* settings, size_t id, const void* val)
{
if (!settings)
return FALSE;
WINPR_ASSERT(settings);
switch (id)
{

View File

@ -285,8 +285,7 @@ def write_getter(f, entry_dict, entry_type, entry_name):
else:
f.write(' freerdp_settings_get_' + entry_name.lower() + '(const rdpSettings* settings, size_t id)\n')
f.write('{\n')
f.write('\tif (!settings)\n')
f.write('\t\treturn FALSE;\n\n')
f.write('\tWINPR_ASSERT(settings);\n\n')
f.write('\tswitch (id)\n')
f.write('\t{\n')
if values:
@ -329,8 +328,7 @@ def write_setter(f, entry_dict, entry_type, entry_name):
else:
f.write(')\n')
f.write('{\n')
f.write('\tif (!settings)\n')
f.write('\t\treturn FALSE;\n\n')
f.write('\tWINPR_ASSERT(settings);\n\n')
f.write('\tswitch (id)\n')
f.write('\t{\n')
if values:
@ -400,6 +398,7 @@ try:
with open(name + '/../libfreerdp/common/settings_getters.c', 'w+') as f:
f.write('/* Generated by ' + '' + ' */\n\n')
f.write('#include <winpr/assert.h>\n')
f.write('#include <freerdp/settings.h>\n')
f.write('#include <freerdp/log.h>\n\n')
f.write('#include "../core/settings.h"\n\n')