- some minor cppcheck code cleanup
This commit is contained in:
parent
f0da05fd6b
commit
8c182b9712
|
@ -810,7 +810,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
||||||
|
|
||||||
if(fileDialog->ShowModal()==wxID_OK){
|
if(fileDialog->ShowModal()==wxID_OK){
|
||||||
modelPathList.clear();
|
modelPathList.clear();
|
||||||
string file = "";
|
string file;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
|
@ -846,7 +846,7 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||||
|
|
||||||
if(fileDialog->ShowModal()==wxID_OK){
|
if(fileDialog->ShowModal()==wxID_OK){
|
||||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
string file = "";
|
string file;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
|
@ -880,7 +880,7 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||||
|
|
||||||
if(fileDialog->ShowModal()==wxID_OK){
|
if(fileDialog->ShowModal()==wxID_OK){
|
||||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
string file = "";
|
string file;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
|
@ -914,7 +914,7 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
||||||
|
|
||||||
if(fileDialog->ShowModal()==wxID_OK){
|
if(fileDialog->ShowModal()==wxID_OK){
|
||||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
string file = "";
|
string file;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
|
|
|
@ -386,6 +386,7 @@ unsigned int pack(unsigned char *buf, const char *format, ...) {
|
||||||
if (isdigit(*format)) { // track max str len
|
if (isdigit(*format)) { // track max str len
|
||||||
maxstrlen = maxstrlen * 10 + (*format-'0');
|
maxstrlen = maxstrlen * 10 + (*format-'0');
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isdigit(*format)) maxstrlen = 0;
|
if (!isdigit(*format)) maxstrlen = 0;
|
||||||
|
@ -426,9 +427,6 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) {
|
||||||
int64 *q; // 64-bit
|
int64 *q; // 64-bit
|
||||||
uint64 *Q;
|
uint64 *Q;
|
||||||
|
|
||||||
float *f; // floats
|
|
||||||
double *d;
|
|
||||||
long double *g;
|
|
||||||
unsigned long long int fhold;
|
unsigned long long int fhold;
|
||||||
|
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -520,27 +518,33 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f': // float
|
case 'f': // float
|
||||||
f = va_arg(ap, float*);
|
{
|
||||||
|
float *f = va_arg(ap, float*);
|
||||||
fhold = unpacku16(buf);
|
fhold = unpacku16(buf);
|
||||||
*f = unpack754_16(fhold);
|
*f = unpack754_16(fhold);
|
||||||
buf += 2;
|
buf += 2;
|
||||||
size += 2;
|
size += 2;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd': // float-32
|
case 'd': // float-32
|
||||||
d = va_arg(ap, double*);
|
{
|
||||||
|
double *d = va_arg(ap, double*);
|
||||||
fhold = unpacku32(buf);
|
fhold = unpacku32(buf);
|
||||||
*d = unpack754_32(fhold);
|
*d = unpack754_32(fhold);
|
||||||
buf += 4;
|
buf += 4;
|
||||||
size += 4;
|
size += 4;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g': // float-64
|
case 'g': // float-64
|
||||||
g = va_arg(ap, long double*);
|
{
|
||||||
|
long double *g = va_arg(ap, long double*);
|
||||||
fhold = unpacku64(buf);
|
fhold = unpacku64(buf);
|
||||||
*g = unpack754_64(fhold);
|
*g = unpack754_64(fhold);
|
||||||
buf += 8;
|
buf += 8;
|
||||||
size += 8;
|
size += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': // string
|
case 's': // string
|
||||||
|
@ -564,6 +568,7 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) {
|
||||||
if (isdigit(*format)) { // track max str len
|
if (isdigit(*format)) { // track max str len
|
||||||
maxstrlen = maxstrlen * 10 + (*format-'0');
|
maxstrlen = maxstrlen * 10 + (*format-'0');
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isdigit(*format)) maxstrlen = 0;
|
if (!isdigit(*format)) maxstrlen = 0;
|
||||||
|
|
|
@ -985,8 +985,7 @@ void MainWindow::onMenuEditInfo(wxCommandEvent &event) {
|
||||||
simpleDialog.addValue("Author", program->getMap()->getAuthor());
|
simpleDialog.addValue("Author", program->getMap()->getAuthor());
|
||||||
if (!simpleDialog.show("Info",true)) return;
|
if (!simpleDialog.show("Info",true)) return;
|
||||||
|
|
||||||
bool ischanged = false;
|
bool ischanged = program->setMapTitle(simpleDialog.getValue("Title"));
|
||||||
ischanged = program->setMapTitle(simpleDialog.getValue("Title"));
|
|
||||||
ischanged = (program->setMapDesc(simpleDialog.getValue("Description")) || ischanged);
|
ischanged = (program->setMapDesc(simpleDialog.getValue("Description")) || ischanged);
|
||||||
ischanged = (program->setMapAuthor(simpleDialog.getValue("Author")) || ischanged);
|
ischanged = (program->setMapAuthor(simpleDialog.getValue("Author")) || ischanged);
|
||||||
if (ischanged)
|
if (ischanged)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user