[tools] fixed settings getter generator
use proper default error return values by type
This commit is contained in:
parent
22c47b7def
commit
204c43a22c
@ -460,7 +460,7 @@ def write_getter_case(f, val):
|
|||||||
f.write('\t\tcase FreeRDP_' + val + ':\n')
|
f.write('\t\tcase FreeRDP_' + val + ':\n')
|
||||||
f.write('\t\t\treturn settings->' + val + ';\n\n')
|
f.write('\t\t\treturn settings->' + val + ';\n\n')
|
||||||
|
|
||||||
def write_getter_body(f, values):
|
def write_getter_body(f, values, ret):
|
||||||
f.write('{\n')
|
f.write('{\n')
|
||||||
f.write('\tWINPR_ASSERT(settings);\n\n')
|
f.write('\tWINPR_ASSERT(settings);\n\n')
|
||||||
f.write('\tswitch (id)\n')
|
f.write('\tswitch (id)\n')
|
||||||
@ -470,7 +470,7 @@ def write_getter_body(f, values):
|
|||||||
write_getter_case(f, val)
|
write_getter_case(f, val)
|
||||||
f.write('\t\tdefault:\n')
|
f.write('\t\tdefault:\n')
|
||||||
f.write('\t\t\tWLog_ERR(TAG, "[%s] Invalid key index %" PRIuz " [%s|%s]", __FUNCTION__, id, freerdp_settings_get_name_for_key(id), freerdp_settings_get_type_name_for_key(id));\n')
|
f.write('\t\t\tWLog_ERR(TAG, "[%s] Invalid key index %" PRIuz " [%s|%s]", __FUNCTION__, id, freerdp_settings_get_name_for_key(id), freerdp_settings_get_type_name_for_key(id));\n')
|
||||||
f.write('\t\t\treturn FALSE;\n')
|
f.write('\t\t\treturn ' + ret + ';\n')
|
||||||
f.write('\t}\n')
|
f.write('\t}\n')
|
||||||
f.write('}\n\n')
|
f.write('}\n\n')
|
||||||
|
|
||||||
@ -490,11 +490,18 @@ def write_getter(f, entry_dict, entry_type, entry_name):
|
|||||||
f.write(' freerdp_settings_get_pointer_writable(rdpSettings* settings, size_t id)\n')
|
f.write(' freerdp_settings_get_pointer_writable(rdpSettings* settings, size_t id)\n')
|
||||||
else:
|
else:
|
||||||
f.write(' freerdp_settings_get_' + entry_name.lower() + '(const rdpSettings* settings, size_t id)\n')
|
f.write(' freerdp_settings_get_' + entry_name.lower() + '(const rdpSettings* settings, size_t id)\n')
|
||||||
write_getter_body(f, values)
|
if isString or isPointer:
|
||||||
|
ret = 'NULL';
|
||||||
|
elif 'bool' in entry_name:
|
||||||
|
ret = 'FALSE';
|
||||||
|
else:
|
||||||
|
ret = '0';
|
||||||
|
|
||||||
|
write_getter_body(f, values, ret)
|
||||||
|
|
||||||
if isString:
|
if isString:
|
||||||
f.write('char* freerdp_settings_get_' + entry_name.lower() + '_writable(rdpSettings* settings, size_t id)\n')
|
f.write('char* freerdp_settings_get_' + entry_name.lower() + '_writable(rdpSettings* settings, size_t id)\n')
|
||||||
write_getter_body(f, values)
|
write_getter_body(f, values, ret)
|
||||||
|
|
||||||
def write_setter_case(f, val, isString, isPointer):
|
def write_setter_case(f, val, isString, isPointer):
|
||||||
f.write('\t\tcase FreeRDP_' + val + ':\n')
|
f.write('\t\tcase FreeRDP_' + val + ':\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user