- some minor cppcheck code cleanup

This commit is contained in:
Mark Vejvoda 2012-11-05 05:40:47 +00:00
parent f0da05fd6b
commit 8c182b9712
3 changed files with 16 additions and 12 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)