Bug 110827 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gok
Version: 1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-24 17:14 UTC by d.binderman
Modified: 2013-04-02 04:18 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-03-29 19:05:51 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.