Skip to content

Commit 0e730c1

Browse files
committed
Plugins (gforce): Fix GCC 'may be used uninitialized' warnings.
1 parent 29e9ed4 commit 0e730c1

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

libvisual-plugins/plugins/actor/gforce/Common/GeneralTools/XStrList.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,12 @@ long XStrList::Add( const UtilStr& inStr ) {
9595

9696

9797
long XStrList::FetchBestMatch( const UtilStr& inStr ) {
98-
long best, bestScore, score, i;
99-
UtilStr* str;
100-
101-
best = 0;
98+
long bestScore = 0;
99+
long best = 0;
100+
UtilStr* str;
102101

103-
for ( i = 1; mStrings.Fetch( i, (void**) &str ); i++ ) {
104-
score = str -> LCSMatchScore( inStr );
102+
for ( long i = 1; mStrings.Fetch( i, (void**) &str ); i++ ) {
103+
long score = str -> LCSMatchScore( inStr );
105104
if ( score > bestScore || i == 1 ) {
106105
best = i;
107106
bestScore = score;

libvisual-plugins/plugins/actor/gforce/Common/UI/LineXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
halfW = ( tw ) >> 1;
138138

139139
if ( tw < 12 ) {
140-
const char* c_shape;
140+
const char* c_shape = nullptr;
141141
__circ( tw, c_shape )
142142
for ( j = 0; j < tw; j++ ) {
143143
c_x = c_shape[ j ];

libvisual-plugins/plugins/actor/gforce/Common/io/CEgIStream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ short int CEgIStream::GetShort() {
5050

5151

5252
unsigned char CEgIStream::GetByte() {
53-
unsigned char c;
53+
unsigned char c = 0;
5454

5555
if ( mIsTied ) {
5656
if ( mPos != 0 ) {
@@ -74,7 +74,7 @@ unsigned char CEgIStream::GetByte() {
7474

7575

7676
unsigned char CEgIStream::PeekByte() {
77-
unsigned char c;
77+
unsigned char c = 0;
7878

7979
if ( mIsTied ) {
8080
if ( mPos != 0 )

libvisual-plugins/plugins/actor/gforce/GForceCommon/GF_Palette.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ void GF_Palette::Assign( const ArgList& inArgs ) {
4040

4141

4242
void GF_Palette::Evaluate( PixPalEntry outPalette[ 256 ] ) {
43-
int i;
44-
float H, S, V, inc = 1.0 / 255.0;
43+
float H = 0.0;
44+
float S = 0.0;
45+
float V = 0.0;
46+
float inc = 1.0 / 255.0;
4547

4648
*mIntensity = 0;
4749

@@ -50,7 +52,7 @@ void GF_Palette::Evaluate( PixPalEntry outPalette[ 256 ] ) {
5052
if ( ! mS_I_Dep ) S = mS.Evaluate();
5153
if ( ! mV_I_Dep ) V = mV.Evaluate();
5254

53-
for ( i = 0; i < 256; i++, *mIntensity += inc ) {
55+
for ( int i = 0; i < 256; i++, *mIntensity += inc ) {
5456

5557
// Don't reevaluate vars that are indep of i
5658
if ( mH_I_Dep ) H = mH.Evaluate();

0 commit comments

Comments
 (0)