mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03:00
Fix warning: use of non-static data member initialization
This fixes the following warnings:
desktop_version/src/Music.cpp: At global scope:
desktop_version/src/Music.cpp:240:23: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions]
240 | Uint8 *wav_buffer = NULL;
| ^
desktop_version/src/Music.cpp:414:32: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions]
414 | Uint8* decoded_buf_playing = NULL;
| ^
desktop_version/src/Music.cpp:415:32: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions]
415 | Uint8* decoded_buf_reserve = NULL;
| ^
desktop_version/src/Music.cpp:416:21: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions]
416 | Uint8* read_buf = NULL;
| ^
These warnings are because the non-static data members (i.e. data
members that will be different for each instance of a class) are being
initialized at the same time as they're being declared, which means
that's what their value will be when the class instance is initialized.
However, this is only a C++11 feature, and we don't use C++11. Luckily,
we don't need to do this, and this is in fact redundant because we
already zero out the class instance in its constructor using
SDL_zerop(). Therefore, we should remove these initializers to fix
compliance with C++03.
This commit is contained in:
@@ -237,7 +237,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
Uint8 *wav_buffer = NULL;
|
||||
Uint8 *wav_buffer;
|
||||
Uint32 wav_length;
|
||||
FAudioWaveFormatEx format;
|
||||
bool valid;
|
||||
@@ -411,9 +411,9 @@ end:
|
||||
FAudioVoiceCallback callbacks;
|
||||
FAudioWaveFormatEx format;
|
||||
|
||||
Uint8* decoded_buf_playing = NULL;
|
||||
Uint8* decoded_buf_reserve = NULL;
|
||||
Uint8* read_buf = NULL;
|
||||
Uint8* decoded_buf_playing;
|
||||
Uint8* decoded_buf_reserve;
|
||||
Uint8* read_buf;
|
||||
bool shouldloop;
|
||||
bool valid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user