diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index f703785d..23556598 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -810,7 +810,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){ if(fileDialog->ShowModal()==wxID_OK){ modelPathList.clear(); - string file = ""; + string file; #ifdef WIN32 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath()); file = tmp_buf; @@ -846,7 +846,7 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){ if(fileDialog->ShowModal()==wxID_OK){ //string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str()); - string file = ""; + string file; #ifdef WIN32 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath()); file = tmp_buf; @@ -880,7 +880,7 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){ if(fileDialog->ShowModal()==wxID_OK){ //string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str()); - string file = ""; + string file; #ifdef WIN32 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath()); file = tmp_buf; @@ -914,7 +914,7 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){ if(fileDialog->ShowModal()==wxID_OK){ //string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str()); - string file = ""; + string file; #ifdef WIN32 const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath()); file = tmp_buf; diff --git a/source/glest_game/network/network_protocol.cpp b/source/glest_game/network/network_protocol.cpp index cb4ed517..38fe32d5 100644 --- a/source/glest_game/network/network_protocol.cpp +++ b/source/glest_game/network/network_protocol.cpp @@ -386,6 +386,7 @@ unsigned int pack(unsigned char *buf, const char *format, ...) { if (isdigit(*format)) { // track max str len maxstrlen = maxstrlen * 10 + (*format-'0'); } + break; } if (!isdigit(*format)) maxstrlen = 0; @@ -426,9 +427,6 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) { int64 *q; // 64-bit uint64 *Q; - float *f; // floats - double *d; - long double *g; unsigned long long int fhold; char *s; @@ -520,27 +518,33 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) { break; case 'f': // float - f = va_arg(ap, float*); + { + float *f = va_arg(ap, float*); fhold = unpacku16(buf); *f = unpack754_16(fhold); buf += 2; size += 2; + } break; case 'd': // float-32 - d = va_arg(ap, double*); + { + double *d = va_arg(ap, double*); fhold = unpacku32(buf); *d = unpack754_32(fhold); buf += 4; size += 4; + } break; case 'g': // float-64 - g = va_arg(ap, long double*); + { + long double *g = va_arg(ap, long double*); fhold = unpacku64(buf); *g = unpack754_64(fhold); buf += 8; size += 8; + } break; case 's': // string @@ -564,6 +568,7 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) { if (isdigit(*format)) { // track max str len maxstrlen = maxstrlen * 10 + (*format-'0'); } + break; } if (!isdigit(*format)) maxstrlen = 0; diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index f5fb6b3d..9b40a569 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -985,8 +985,7 @@ void MainWindow::onMenuEditInfo(wxCommandEvent &event) { simpleDialog.addValue("Author", program->getMap()->getAuthor()); if (!simpleDialog.show("Info",true)) return; - bool ischanged = false; - ischanged = program->setMapTitle(simpleDialog.getValue("Title")); + bool ischanged = program->setMapTitle(simpleDialog.getValue("Title")); ischanged = (program->setMapDesc(simpleDialog.getValue("Description")) || ischanged); ischanged = (program->setMapAuthor(simpleDialog.getValue("Author")) || ischanged); if (ischanged)