Skip to content

Commit

Permalink
Fixes for CodeQL requirements
Browse files Browse the repository at this point in the history
Made function implementations exactly match their definitions
Changed function parameter names to prevent any possible shadowing
of static variables

Signed-off-by: Martijn Reicher <[email protected]>
  • Loading branch information
reicheratwork committed Jul 6, 2023
1 parent d44075c commit 6554fb0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/tools/idlc/include/libidlc/descriptor_type_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
IDLC_EXPORT idl_retcode_t
print_type_meta_ser (
FILE *fp,
const idl_pstate_t *pstate,
const idl_pstate_t *state,
const idl_node_t *node);

IDLC_EXPORT idl_retcode_t
generate_type_meta_ser (
const idl_pstate_t *pstate,
const idl_pstate_t *state,
const idl_node_t *node,
idl_typeinfo_typemap_t *result);

Expand Down
4 changes: 2 additions & 2 deletions src/tools/idlc/include/libidlc/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ IDLC_EXPORT const idlc_option_t**
generator_options(void);

IDLC_EXPORT int
print_type(char *str, size_t len, const void *ptr, void *user_data);
print_type(char *str, size_t size, const void *ptr, void *user_data);

IDLC_EXPORT int
print_scoped_name(char *str, size_t len, const void *ptr, void *user_data);
print_scoped_name(char *str, size_t size, const void *ptr, void *user_data);

#if defined(__cplusplus)
}
Expand Down
8 changes: 4 additions & 4 deletions src/tools/idlc/src/descriptor_type_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ generate_type_meta_ser_impl (
idl_retcode_t
print_type_meta_ser (
FILE *fp,
const idl_pstate_t *pstate,
const idl_pstate_t *state,
const idl_node_t *node)
{
struct DDS_XTypes_TypeInformation type_information;
Expand All @@ -1810,7 +1810,7 @@ print_type_meta_ser (
if (IDL_PRINTA(&type_name, print_type, node) < 0)
return IDL_RETCODE_NO_MEMORY;

if ((rc = generate_type_meta_ser_impl (pstate, node, &type_information, &os_typeinfo, &os_typemap)))
if ((rc = generate_type_meta_ser_impl (state, node, &type_information, &os_typeinfo, &os_typemap)))
return rc;

if ((rc = print_typeinformation_comment (fp, &type_information)) != IDL_RETCODE_OK)
Expand All @@ -1827,7 +1827,7 @@ print_type_meta_ser (

idl_retcode_t
generate_type_meta_ser (
const idl_pstate_t *pstate,
const idl_pstate_t *state,
const idl_node_t *node,
idl_typeinfo_typemap_t *result)
{
Expand All @@ -1836,7 +1836,7 @@ generate_type_meta_ser (
dds_ostream_t os_typemap;
idl_retcode_t rc;

if ((rc = generate_type_meta_ser_impl (pstate, node, &type_information, &os_typeinfo, &os_typemap)))
if ((rc = generate_type_meta_ser_impl (state, node, &type_information, &os_typeinfo, &os_typemap)))
return rc;

result->typeinfo = NULL;
Expand Down
6 changes: 2 additions & 4 deletions src/tools/idlc/src/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ static int print_decl_type(
return (int)len;
}

int print_type(
char *str, size_t size, const void *ptr, void *user_data)
int print_type(char *str, size_t size, const void *ptr, void *user_data)
{
if (idl_is_base_type(ptr))
return print_base_type(str, size, ptr, user_data);
Expand All @@ -208,8 +207,7 @@ int print_type(
return print_decl_type(str, size, ptr, "_");
}

int print_scoped_name(
char *str, size_t size, const void *ptr, void *user_data)
int print_scoped_name(char *str, size_t size, const void *ptr, void *user_data)
{
if (idl_is_base_type(ptr))
return print_base_type(str, size, ptr, user_data);
Expand Down

0 comments on commit 6554fb0

Please sign in to comment.