uninitialized variable fixed + immediate value parser fixed.

This commit is contained in:
Jean-François DEL NERO
2023-02-03 13:00:54 +01:00
parent 55683d39c9
commit 3ae649352d
2 changed files with 14 additions and 4 deletions
+6 -4
View File
@@ -143,7 +143,7 @@ static int is_variable(char * command)
{
if(strlen(command)>1)
{
if(command[0] == '$' && command[1] && ( command[1] != ' ' || command[1] != '\t' ))
if(command[0] == '$' && command[1] && (command[1] != ' ' && command[1] != '\t') )
return 1;
else
return 0;
@@ -287,6 +287,8 @@ static env_var_value str_to_int(char * str)
{
env_var_value value;
value = 0;
if(str)
{
if( strlen(str) > 2 )
@@ -671,7 +673,7 @@ int execute_file_script( script_ctx * ctx, char * filename )
err = SCRIPT_INTERNAL_ERROR;
ctx->script_file = fopen(filename,"r");
ctx->script_file = fopen(filename,"rb");
if(ctx->script_file)
{
strncpy(ctx->script_file_path,filename,DEFAULT_BUFLEN);
@@ -1420,7 +1422,7 @@ int hxcfe_execScriptRam( HXCFE* hxcfe, unsigned char * script_buffer, int buffer
if(!hxcfe->scriptctx)
return SCRIPT_INTERNAL_ERROR;
return execute_ram_script( hxcfe->scriptctx, script_buffer, buffersize );
}
@@ -1431,7 +1433,7 @@ int hxcfe_deinitScript( HXCFE* hxcfe )
if(!hxcfe->scriptctx)
return SCRIPT_INTERNAL_ERROR;
deinit_script(hxcfe->scriptctx);
hxcfe->scriptctx = NULL;
+8
View File
@@ -45,6 +45,10 @@
#define _script_ctx_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _script_printf_func_
typedef int (* SCRIPT_PRINTF_FUNC)(void * ctx, int MSGTYPE, char * string, ... );
#define _script_printf_func_
@@ -105,3 +109,7 @@ int execute_line_script( script_ctx * ctx, char * line );
int execute_ram_script( script_ctx * ctx, unsigned char * script_buffer, int buffersize );
void setOutputFunc_script( script_ctx * ctx, SCRIPT_PRINTF_FUNC ext_printf );
script_ctx * deinit_script(script_ctx * ctx);
#ifdef __cplusplus
}
#endif