[LyX/master] Fix unitialized member warning by coverity

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue May 9 11:53:15 UTC 2023


Le 09/05/2023 à 12:44, Jean-Marc Lasgouttes a écrit :
> commit e620920fe2488ba50ff0b992c2529fdb69f2691a
> Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> Date:   Tue May 9 13:49:17 2023 +0200
> 
>      Fix unitialized member warning by coverity

Kornel, is that OK?

JMarc

>      
>      The members open_braces and close_wildcards of MatchStringAdv are not
>      initialized in case of early return and coverity complains about that.
> ---
>   src/lyxfind.cpp |    6 ++----
>   1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
> index 2ddedcb..6ccde78 100644
> --- a/src/lyxfind.cpp
> +++ b/src/lyxfind.cpp
> @@ -1123,10 +1123,10 @@ private:
>   	// par_as_string after removal of lead_as_string
>   	string par_as_string_nolead;
>   	// unmatched open braces in the search string/regexp
> -	int open_braces;
> +	int open_braces = 0;
>   	// number of (.*?) subexpressions added at end of search regexp for closing
>   	// environments, math mode, styles, etc...
> -	int close_wildcards;
> +	int close_wildcards = 0;
>   public:
>   	// Are we searching with regular expressions ?
>   	bool use_regexp = false;
> @@ -3665,8 +3665,6 @@ MatchStringAdv::MatchStringAdv(lyx::Buffer & buf, FindAndReplaceOptions & opt)
>   	}
>   	// When using regexp, braces are hacked already by escape_for_regex()
>   	par_as_string = convertLF2Space(ds, opt.ignoreformat);
> -	open_braces = 0;
> -	close_wildcards = 0;
>   
>   	size_t lead_size = 0;
>   	// correct the language settings



More information about the lyx-devel mailing list