general: Address a few more compiler warnings

This commit is contained in:
Sam Edwards 2018-05-31 19:05:25 -06:00
parent 94c7fa30e2
commit 159b43e563
10 changed files with 11 additions and 15 deletions

View File

@ -259,7 +259,7 @@ inline static void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, cha
*len = 0;
while (kappa > 0) {
uint32_t d;
uint32_t d = 0;
switch (kappa) {
case 10: d = p1 / 1000000000; p1 %= 1000000000; break;
case 9: d = p1 / 100000000; p1 %= 100000000; break;

View File

@ -191,7 +191,7 @@ string handle_socket_error() {
return string(strerror(errno));
#else
int err = WSAGetLastError();
char *errmsg;
const char *errmsg;
switch (err) {
case 10022:
errmsg = "An invalid argument was supplied";

View File

@ -34,8 +34,6 @@ set_string_value(const string &key, const string &name, const string &value,
TextEncoder encoder;
wstring wvalue = encoder.decode_text(value);
bool okflag = true;
// Now convert the string to Windows' idea of the correct wide-char
// encoding, so we can store it in the registry. This might well be the
// same string we just decoded from, but it might not.

View File

@ -269,7 +269,7 @@ public:
virtual int get_driver_shader_version_major();
virtual int get_driver_shader_version_minor();
static void debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam);
static void APIENTRY debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam);
virtual void reset();

View File

@ -269,6 +269,7 @@ init_libpnmimagetypes() {
// And register with the PandaSystem.
PandaSystem *ps = PandaSystem::get_global_ptr();
(void)ps; // Suppress unused variable warning
#ifdef HAVE_JPEG
ps->add_system("libjpeg");

View File

@ -1412,9 +1412,9 @@ assemble_row(TextAssembler::TextRow &row,
bool underscore = false;
PN_stdfloat underscore_start = 0.0f;
const TextProperties *underscore_properties = nullptr;
const ComputedProperties *prev_cprops = nullptr;
#ifdef HAVE_HARFBUZZ
const ComputedProperties *prev_cprops = nullptr;
hb_buffer_t *harfbuff = nullptr;
#endif

View File

@ -123,7 +123,6 @@ get_properties(FrameBufferProperties &properties, HDC hdc, int pfnum) {
pfd.cBlueBits, pfd.cAlphaBits);
}
int mode = 0;
if (pfd.dwFlags & PFD_DOUBLEBUFFER) {
properties.set_back_buffers(1);
}
@ -193,7 +192,6 @@ get_properties_advanced(FrameBufferProperties &properties,
properties.clear();
properties.set_all_specified();
int frame_buffer_mode = 0;
if (ivalue_list[acceleration_i] == WGL_NO_ACCELERATION_ARB) {
properties.set_force_software(true);
} else {

View File

@ -358,7 +358,7 @@ setup_colormap(const PIXELFORMATDESCRIPTOR &pixelformat) {
#ifdef NOTIFY_DEBUG
// typedef enum {Software, MCD, ICD} OGLDriverType;
static char *OGLDrvStrings[3] = {"Software","MCD","ICD"};
static const char *OGLDrvStrings[3] = {"Software","MCD","ICD"};
/**
* Reports information about the selected pixel format descriptor, along with

View File

@ -261,7 +261,7 @@ WinGraphicsPipe() {
windisplay_cat.debug() << "Using EnumDisplaySettings to fetch display information.\n";
}
pvector<DisplayMode> display_modes;
DEVMODE dm = {0};
DEVMODE dm{};
dm.dmSize = sizeof(dm);
for (int i = 0; EnumDisplaySettings(NULL, i, &dm) != 0; ++i) {
DisplayMode mode;
@ -293,7 +293,7 @@ WinGraphicsPipe() {
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if (GetVersionEx(&version_info)) {
if (windisplay_cat.is_info()) {
sprintf(string, "OS version: %d.%d.%d.%d\n", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwPlatformId, version_info.dwBuildNumber);
sprintf(string, "OS version: %lu.%lu.%lu.%lu\n", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwPlatformId, version_info.dwBuildNumber);
windisplay_cat.info() << string;
windisplay_cat.info() << " " << version_info.szCSDVersion << "\n";
}

View File

@ -69,9 +69,9 @@ static const char * const errorbox_title = "Panda3D Error";
// These static variables contain pointers to the touch input functions, which
// are dynamically extracted from USER32.DLL
typedef WINUSERAPI BOOL (WINAPI *PFN_REGISTERTOUCHWINDOW)(IN HWND hWnd, IN ULONG ulFlags);
typedef WINUSERAPI BOOL (WINAPI *PFN_GETTOUCHINPUTINFO)(IN HTOUCHINPUT hTouchInput, IN UINT cInputs, OUT PTOUCHINPUT pInputs, IN int cbSize);
typedef WINUSERAPI BOOL (WINAPI *PFN_CLOSETOUCHINPUTHANDLE)(IN HTOUCHINPUT hTouchInput);
typedef BOOL (WINAPI *PFN_REGISTERTOUCHWINDOW)(IN HWND hWnd, IN ULONG ulFlags);
typedef BOOL (WINAPI *PFN_GETTOUCHINPUTINFO)(IN HTOUCHINPUT hTouchInput, IN UINT cInputs, OUT PTOUCHINPUT pInputs, IN int cbSize);
typedef BOOL (WINAPI *PFN_CLOSETOUCHINPUTHANDLE)(IN HTOUCHINPUT hTouchInput);
static PFN_REGISTERTOUCHWINDOW pRegisterTouchWindow = 0;
static PFN_GETTOUCHINPUTINFO pGetTouchInputInfo = 0;
@ -1292,7 +1292,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
<< msg << ", " << wparam << ", " << lparam << ")\n";
}
WindowProperties properties;
int button = -1;
switch (msg) {
case WM_MOUSEMOVE: