Commit bd3daa1b authored by Ben Boeckel's avatar Ben Boeckel Committed by Code Review

Merge topic 'warnings-20141003' into master

a5d30fbc vtkWin32OpenGLRenderWindow: wrap assignments in while() in parens
1932e6c2 vtkWin32OpenGLRenderWindow: use size_t for integer storage of pointers
fd5e0ef1 vtkWin32OpenGLRenderWindow: avoid narrowing warnings
0ba047df windows: put parentheses around mixed && and || operators
581598f8 windows: use the proper format specifier for DWORD
parents c7348412 a5d30fbc
...@@ -26,6 +26,14 @@ ...@@ -26,6 +26,14 @@
# define _MAX_PATH 4096 # define _MAX_PATH 4096
#endif #endif
#ifndef PRIdword
#if _LP64
#define PRIdword "u"
#else
#define PRIdword "lu"
#endif
#endif
vtkStandardNewMacro(vtkWin32ProcessOutputWindow); vtkStandardNewMacro(vtkWin32ProcessOutputWindow);
extern "C" int vtkEncodedArrayWin32OutputWindowProcessWrite(const char* fname); extern "C" int vtkEncodedArrayWin32OutputWindowProcessWrite(const char* fname);
...@@ -87,7 +95,7 @@ int vtkWin32ProcessOutputWindow::Initialize() ...@@ -87,7 +95,7 @@ int vtkWin32ProcessOutputWindow::Initialize()
// Construct the executable name from the process id, pointer to // Construct the executable name from the process id, pointer to
// this output window instance, and a count. This should be unique. // this output window instance, and a count. This should be unique.
sprintf(exeName, "vtkWin32OWP_%u_%p_%u.exe", sprintf(exeName, "vtkWin32OWP_%"PRIdword"_%p_%u.exe",
GetCurrentProcessId(), this, this->Count++); GetCurrentProcessId(), this, this->Count++);
// Allocate a buffer to hold the executable path. // Allocate a buffer to hold the executable path.
...@@ -152,7 +160,7 @@ void vtkWin32ProcessOutputWindow::Write(const char* data, size_t length) ...@@ -152,7 +160,7 @@ void vtkWin32ProcessOutputWindow::Write(const char* data, size_t length)
if(data && length) if(data && length)
{ {
// Initialize the output pipe the first time. // Initialize the output pipe the first time.
if(this->Broken || !this->OutputPipe && !this->Initialize()) if(this->Broken || (!this->OutputPipe && !this->Initialize()))
{ {
this->Broken = 1; this->Broken = 1;
return; return;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "vtkOpenGLRenderWindow.h" #include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLError.h" #include "vtkOpenGLError.h"
#include "vtkRendererCollection.h" #include "vtkRendererCollection.h"
#include "vtkTypeTraits.h"
#include "vtkWin32RenderWindowInteractor.h" #include "vtkWin32RenderWindowInteractor.h"
#include <math.h> #include <math.h>
...@@ -678,19 +679,21 @@ void vtkWin32OpenGLRenderWindow::SetupPixelFormat(HDC hDC, DWORD dwFlags, ...@@ -678,19 +679,21 @@ void vtkWin32OpenGLRenderWindow::SetupPixelFormat(HDC hDC, DWORD dwFlags,
return; return;
} }
BYTE bpp_byte = static_cast<BYTE>(bpp);
BYTE zbpp_byte = static_cast<BYTE>(zbpp);
PIXELFORMATDESCRIPTOR pfd = { PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */ sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */ 1, /* version */
dwFlags , /* support double-buffering */ dwFlags , /* support double-buffering */
PFD_TYPE_RGBA, /* color type */ PFD_TYPE_RGBA, /* color type */
bpp, /* preferred color depth */ bpp_byte, /* preferred color depth */
0, 0, 0, 0, 0, 0, /* color bits (ignored) */ 0, 0, 0, 0, 0, 0, /* color bits (ignored) */
this->AlphaBitPlanes ? bpp/4 : 0, /* no alpha buffer */ static_cast<BYTE>(this->AlphaBitPlanes ? bpp/4 : 0), /* no alpha buffer */
0, /* alpha bits (ignored) */ 0, /* alpha bits (ignored) */
0, /* no accumulation buffer */ 0, /* no accumulation buffer */
0, 0, 0, 0, /* accum bits (ignored) */ 0, 0, 0, 0, /* accum bits (ignored) */
zbpp, /* depth buffer */ zbpp_byte, /* depth buffer */
this->StencilCapable, /* stencil buffer */ static_cast<BYTE>(this->StencilCapable), /* stencil buffer */
0, /* no auxiliary buffers */ 0, /* no auxiliary buffers */
PFD_MAIN_PLANE, /* main layer */ PFD_MAIN_PLANE, /* main layer */
0, /* reserved */ 0, /* reserved */
...@@ -1346,19 +1349,19 @@ void vtkWin32OpenGLRenderWindow::SetWindowId(HWND arg) ...@@ -1346,19 +1349,19 @@ void vtkWin32OpenGLRenderWindow::SetWindowId(HWND arg)
// Set this RenderWindow's X window id to a pre-existing window. // Set this RenderWindow's X window id to a pre-existing window.
void vtkWin32OpenGLRenderWindow::SetWindowInfo(char *info) void vtkWin32OpenGLRenderWindow::SetWindowInfo(char *info)
{ {
int tmp; size_t tmp;
sscanf(info, "%i", &tmp); sscanf(info, vtkTypeTraits<size_t>::ParseFormat(), &tmp);
this->WindowId = (HWND)tmp; this->WindowId = reinterpret_cast<HWND>(tmp);
vtkDebugMacro(<< "Setting WindowId to " << this->WindowId << "\n"); vtkDebugMacro(<< "Setting WindowId to " << this->WindowId << "\n");
} }
void vtkWin32OpenGLRenderWindow::SetNextWindowInfo(char *info) void vtkWin32OpenGLRenderWindow::SetNextWindowInfo(char *info)
{ {
int tmp; size_t tmp;
sscanf(info, "%i", &tmp); sscanf(info, vtkTypeTraits<size_t>::ParseFormat(), &tmp);
this->SetNextWindowId((HWND)tmp); this->SetNextWindowId(reinterpret_cast<HWND>(tmp));
} }
void vtkWin32OpenGLRenderWindow::SetDisplayId(void * arg) void vtkWin32OpenGLRenderWindow::SetDisplayId(void * arg)
...@@ -1380,10 +1383,10 @@ void vtkWin32OpenGLRenderWindow::SetDeviceContext(HDC arg) ...@@ -1380,10 +1383,10 @@ void vtkWin32OpenGLRenderWindow::SetDeviceContext(HDC arg)
// Sets the HWND id of the window that WILL BE created. // Sets the HWND id of the window that WILL BE created.
void vtkWin32OpenGLRenderWindow::SetParentInfo(char *info) void vtkWin32OpenGLRenderWindow::SetParentInfo(char *info)
{ {
int tmp; size_t tmp;
sscanf(info, "%i", &tmp); sscanf(info, vtkTypeTraits<size_t>::ParseFormat(), &tmp);
this->ParentId = (HWND)tmp; this->ParentId = reinterpret_cast<HWND>(tmp);
vtkDebugMacro(<< "Setting ParentId to " << this->ParentId << "\n"); vtkDebugMacro(<< "Setting ParentId to " << this->ParentId << "\n");
} }
...@@ -1529,7 +1532,7 @@ void vtkWin32OpenGLRenderWindow::CreateOffScreenDC(HBITMAP hbmp, HDC aHdc) ...@@ -1529,7 +1532,7 @@ void vtkWin32OpenGLRenderWindow::CreateOffScreenDC(HBITMAP hbmp, HDC aHdc)
vtkRenderer *ren; vtkRenderer *ren;
vtkCollectionSimpleIterator rsit; vtkCollectionSimpleIterator rsit;
this->Renderers->InitTraversal(rsit); this->Renderers->InitTraversal(rsit);
while (ren = this->Renderers->GetNextRenderer(rsit)) while ((ren = this->Renderers->GetNextRenderer(rsit)))
{ {
ren->SetRenderWindow(NULL); ren->SetRenderWindow(NULL);
ren->SetRenderWindow(this); ren->SetRenderWindow(this);
...@@ -1632,7 +1635,7 @@ void vtkWin32OpenGLRenderWindow::ResumeScreenRendering(void) ...@@ -1632,7 +1635,7 @@ void vtkWin32OpenGLRenderWindow::ResumeScreenRendering(void)
vtkRenderer *ren; vtkRenderer *ren;
vtkCollectionSimpleIterator rsit; vtkCollectionSimpleIterator rsit;
this->Renderers->InitTraversal(rsit); this->Renderers->InitTraversal(rsit);
while (ren = this->Renderers->GetNextRenderer(rsit)) while ((ren = this->Renderers->GetNextRenderer(rsit)))
{ {
ren->SetRenderWindow(NULL); ren->SetRenderWindow(NULL);
ren->SetRenderWindow(this); ren->SetRenderWindow(this);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment