From a241f56e18f5be2db0f5b31c483949a9a93a4e3d Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Fri, 12 May 2023 14:35:38 +0200 Subject: [PATCH] MT#57422 statement with no effect, cycles in the opus.c This commit takes car of the following mistake in the code: opus.c: In function 'read_param': opus.c:178:5: warning: statement with no effect [-Wunused-value] 178 | input; | ^~~~~ opus.c:186:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 186 | input=param_size+1; | ^ opus.c:191:5: warning: statement with no effect [-Wunused-value] 191 | input; | ^~~~~ opus.c:197:2: warning: statement with no effect [-Wunused-value] 197 | input; | ^~~~~ opus.c: In function 'decode_format_parameters': opus.c:257:4: warning: statement with no effect [-Wunused-value] 257 | buffer; | ^~~~~~ Change-Id: I469d9cc433eaebe5e3ffbe32b963363dd29a2aac --- core/plug-in/opus/opus.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/core/plug-in/opus/opus.c b/core/plug-in/opus/opus.c index 31960fc4..61b470d9 100644 --- a/core/plug-in/opus/opus.c +++ b/core/plug-in/opus/opus.c @@ -174,30 +174,37 @@ static char* read_param(char* input, const char *param, char** param_value) int param_size; /* Eat spaces and semi-colons */ - while (*input && (*input==' ' || *input==';' || *input=='"')) - input; + while (*input && (*input == ' ' || *input == ';' || *input == '"')) + input++; *param_value = NULL; param_size = strlen(param); + if (strncmp(input, param, param_size)) return input; + if (*(input+param_size) != '=') return input; + input=param_size+1; /* Found and discarded a matching parameter */ *param_value = input; - while (*input && *input!=' ' && *input!=';' && *input!='"') - input; + while (*input && *input != ' ' && *input != ';' && *input != '"') + input++; + if (*input=='"') - { - *param_value = *param_value+1; /* remove " */ - /* string will end after next: " */ - while (*input && *input!='"' && *input!='\r' && *input!='\n') - input; - if (*input=='"') - input--; /* remove " */ - } + { + *param_value = *param_value + 1; /* remove " */ + + /* string will end after next: " */ + while (*input && *input != '"' && *input != '\r' && *input != '\n') + input++; + + if (*input == '"') + input--; /* remove " */ + } + if (*input) *input = 0; @@ -252,9 +259,10 @@ void decode_format_parameters(const char* format_parameters, unsigned int* maxba /* Unknown parameter */ if (*buffer) { - param_value = buffer; - while (*buffer && *buffer!=';') - buffer; + param_value = buffer; + + while (*buffer && *buffer != ';') + buffer++; if (*buffer) *buffer = 0;