mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 18:46:16 +00:00
various files - fix some alerts raised by lgtm code analysis
This patch fixes several issues reported by the lgtm code analysis tool: https://lgtm.com/projects/g/asterisk/asterisk Not all reported issues were addressed in this patch. This patch mostly fixes confirmed reported errors, potential problematic code points, and a few other "low hanging" warnings or recommendations found in core supported modules. These include, but are not limited to the following: * innapropriate stack allocation in loops * buffer overflows * variable declaration "hiding" another variable declaration * comparisons results that are always the same * ambiguously signed bit-field members * missing header guards Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
This commit is contained in:
committed by
George Joseph
parent
990a91b44a
commit
bdd785d31c
@@ -199,7 +199,7 @@ static off_t g726_tell(struct ast_filestream *fs)
|
||||
return ftello(fs->f) << 1;
|
||||
}
|
||||
|
||||
static struct ast_format_def f[] = {
|
||||
static struct ast_format_def f_def[] = {
|
||||
{
|
||||
.name = "g726-40",
|
||||
.exts = "g726-40",
|
||||
@@ -259,9 +259,9 @@ static int unload_module(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; f[i].desc_size ; i++) {
|
||||
if (ast_format_def_unregister(f[i].name))
|
||||
ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f[i].name);
|
||||
for (i = 0; f_def[i].desc_size ; i++) {
|
||||
if (ast_format_def_unregister(f_def[i].name))
|
||||
ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f_def[i].name);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -270,10 +270,10 @@ static int load_module(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; f[i].desc_size ; i++) {
|
||||
f[i].format = ast_format_g726;
|
||||
if (ast_format_def_register(&f[i])) { /* errors are fatal */
|
||||
ast_log(LOG_WARNING, "Failed to register format %s.\n", f[i].name);
|
||||
for (i = 0; f_def[i].desc_size ; i++) {
|
||||
f_def[i].format = ast_format_g726;
|
||||
if (ast_format_def_register(&f_def[i])) { /* errors are fatal */
|
||||
ast_log(LOG_WARNING, "Failed to register format %s.\n", f_def[i].name);
|
||||
unload_module();
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user