Bug 110827

Summary: bad source code
Product: [Fedora] Fedora Reporter: d.binderman
Component: gokAssignee: Jonathan Blandford <jrb>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1CC: ddumas
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-03-29 19:05:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2003-11-24 17:14:54 UTC
Description of problem:
I just tried to compile package gok-0_7_1-4 from Fedora.

The compiler said

1.

gok-page-actions.c(117): remark #592: variable "bReturnCode" is used 
before its
value is set

The source code is

        gboolean bReturnCode;

		/* more code here */

		return bReturnCode;

This is in need of repair.

2.

gok-keyslotter.c(86): warning #187: use of "=" where "==" may have 
been intendedgok-keyslotter.c(87): warning #187: use of "=" 
where "==" may have been intended

The source code is 

                                if (((keytype = KEYTYPE_WORDCOMPLETE) 
&& (gok_keyboard_get_wordcomplete_keys_added (pKeyboard) == TRUE)) ||
                                    ((keytype = 
KEYTYPE_COMMANDPREDICT) && 
(gok_keyboard_get_commandpredict_keys_added (pKeyboard) == TRUE)) )

Better source code might be

	if (((keytype == KEYTYPE_WORDCOMPLETE) 
		&& (gok_keyboard_get_wordcomplete_keys_added 
(pKeyboard) == TRUE)) 
	|| ((keytype == KEYTYPE_COMMANDPREDICT) 
		&& (gok_keyboard_get_commandpredict_keys_added 
(pKeyboard) == TRUE)) )

Note changing = for ==.

3.

gok-keyslotter.c(150): warning #187: use of "=" where "==" may have 
been intended
gok-keyslotter.c(151): warning #187: use of "=" where "==" may have 
been intended

The source code is

                if ( ((keytype = KEYTYPE_WORDCOMPLETE) &&( 
gok_keyboard_get_supports_wordcomplete (pKeyboard) == TRUE)) ||
                     ((keytype = KEYTYPE_COMMANDPREDICT) &&( 
gok_keyboard_get_supports_commandprediction (pKeyboard) == TRUE) ))

Better might be

	if ( ((keytype == KEYTYPE_WORDCOMPLETE) 
		&&( gok_keyboard_get_supports_wordcomplete 
(pKeyboard) == TRUE)) 
	|| ((keytype == KEYTYPE_COMMANDPREDICT) 
		&&( gok_keyboard_get_supports_commandprediction 
(pKeyboard) == TRUE) ))

Note changing = for ==.


Version-Release number of selected component (if applicable):
gok-0_7_1-4 

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 David Bolter 2004-03-29 17:16:14 UTC
I've just applied your suggestions to gok in cvs.  Please close at will.