diff --git a/src/gtk/screenarea-cairo.cpp b/src/gtk/screenarea-cairo.cpp index f14b94cb..23d0add0 100644 --- a/src/gtk/screenarea-cairo.cpp +++ b/src/gtk/screenarea-cairo.cpp @@ -139,6 +139,7 @@ void ScreenAreaCairo::vUpdateSize() m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)]; + memset(m_puiPixels, 0, (m_iScaledWidth + 1) * m_iScaledHeight * sizeof(u32)); memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)); set_size_request(m_iScale * m_iWidth, m_iScale * m_iHeight); diff --git a/src/gtk/screenarea-opengl.cpp b/src/gtk/screenarea-opengl.cpp index b2b4bd2b..78bb9e2d 100644 --- a/src/gtk/screenarea-opengl.cpp +++ b/src/gtk/screenarea-opengl.cpp @@ -28,10 +28,10 @@ template T max( T x, T y ) { return x > y ? x : y; } ScreenAreaGl::ScreenAreaGl(int _iWidth, int _iHeight, int _iScale) : ScreenArea(_iWidth, _iHeight, _iScale), - m_puiPixels(NULL), - m_puiDelta(NULL), m_iScaledWidth(_iWidth), - m_iScaledHeight(_iHeight) + m_iScaledHeight(_iHeight), + m_puiPixels(NULL), + m_puiDelta(NULL) { Glib::RefPtr glconfig; @@ -135,6 +135,7 @@ void ScreenAreaGl::vUpdateSize() m_puiPixels = new u32[(m_iScaledWidth + 1) * m_iScaledHeight]; m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)]; + memset(m_puiPixels, 0, (m_iScaledWidth + 1) * m_iScaledHeight * sizeof(u32)); memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * sizeof(u32)); set_size_request(m_iScale * m_iWidth, m_iScale * m_iHeight); @@ -152,6 +153,8 @@ void ScreenAreaGl::vOnWidgetResize() bool ScreenAreaGl::on_configure_event(GdkEventConfigure * event) { vOnWidgetResize(); + + return true; } bool ScreenAreaGl::on_expose_event(GdkEventExpose * _pstEvent) diff --git a/src/gtk/screenarea-xvideo.cpp b/src/gtk/screenarea-xvideo.cpp index b9c145f3..1534b4e0 100644 --- a/src/gtk/screenarea-xvideo.cpp +++ b/src/gtk/screenarea-xvideo.cpp @@ -216,8 +216,8 @@ void ScreenAreaXv::vUpdateSize() XShmAttach(m_pDisplay, &m_oShm); m_puiPixels = new u32[iScaledWidth * iScaledHeight]; - m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * 4]; + memset(m_puiPixels, 0, iScaledWidth * iScaledHeight * sizeof(u32)); memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * 4); set_size_request(m_iScale * m_iWidth, m_iScale* m_iHeight); @@ -295,6 +295,8 @@ void ScreenAreaXv::vOnWidgetResize() bool ScreenAreaXv::on_configure_event(GdkEventConfigure * event) { vOnWidgetResize(); + + return true; } } // namespace VBA diff --git a/src/gtk/screenarea.cpp b/src/gtk/screenarea.cpp index ccd5c707..5bde71b4 100644 --- a/src/gtk/screenarea.cpp +++ b/src/gtk/screenarea.cpp @@ -24,10 +24,10 @@ namespace VBA { ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) : + m_iFilterScale(1), m_vFilter2x(NULL), m_vFilterIB(NULL), - m_bShowCursor(true), - m_iFilterScale(1) + m_bShowCursor(true) { g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1); diff --git a/src/gtk/sndPortAudio.cpp b/src/gtk/sndPortAudio.cpp index 4b4e46de..cfb94e7c 100644 --- a/src/gtk/sndPortAudio.cpp +++ b/src/gtk/sndPortAudio.cpp @@ -25,7 +25,7 @@ static u32 soundoffset; static volatile u32 soundpos; static u32 soundbufsize; -static int audioFree() +static unsigned int audioFree() { if (soundoffset > soundpos) return soundbufsize - soundoffset + soundpos; @@ -39,7 +39,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer, PaStreamCallbackFlags statusFlags, void *userData ) { - const int outBufferLength = framesPerBuffer * sizeof(u16) * 2; + const unsigned int outBufferLength = framesPerBuffer * sizeof(u16) * 2; u8 *out = (u8*)outputBuffer; if (!emulating || soundPaused) @@ -53,7 +53,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer, u8 *soundbuf = (u8 *)stereodata16; - for (int i = 0; i < outBufferLength; i++) + for (unsigned int i = 0; i < outBufferLength; i++) { if (soundpos >= soundbufsize) soundpos = 0; @@ -69,7 +69,7 @@ void systemWriteDataToSoundBuffer() { u32 copy1size = 0, copy2size = 0; - while (emulating && !speedup & !systemThrottle && (audioFree() < soundBufferLen)) + while (emulating && !speedup & !systemThrottle && (audioFree() < (unsigned int)soundBufferLen)) { #ifndef _WIN32 usleep(1000); @@ -78,7 +78,7 @@ void systemWriteDataToSoundBuffer() #endif } - if ((soundbufsize - soundoffset) < soundBufferLen) + if ((soundbufsize - soundoffset) < (unsigned int)soundBufferLen) { copy1size = (soundbufsize - soundoffset); copy2size = soundBufferLen - copy1size; @@ -101,7 +101,6 @@ void systemWriteDataToSoundBuffer() bool systemSoundInit() { int sampleRate; - int buffersize = 0; err = Pa_Initialize(); if (err != paNoError) goto error; @@ -117,6 +116,7 @@ bool systemSoundInit() sampleRate = 44100; soundBufferLen = 1470*2; break; + default: case 2: sampleRate = 22050; soundBufferLen = 736*2; diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index e0e09f5d..6644fbc1 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -154,7 +154,7 @@ void Window::vOnFileSave() void Window::vOnLoadGameMostRecent() { int iMostRecent = -1; - time_t uiTimeMax; + time_t uiTimeMax = 0; for (int i = 0; i < 10; i++) { @@ -190,7 +190,7 @@ void Window::vOnLoadGame(int _iSlot) void Window::vOnSaveGameOldest() { int iOldest = -1; - time_t uiTimeMin; + time_t uiTimeMin = 0; for (int i = 0; i < 10; i++) {