Skip to content
This repository was archived by the owner on Dec 3, 2020. It is now read-only.

Commit f231f13

Browse files
committedJul 29, 2014
Fix compile on Windows
1 parent 73db351 commit f231f13

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed
 

‎src/FileDialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ bool FileDialog::close()
8181
win->remove();
8282
win = NULL;
8383
}
84-
delete state->menu->dialog;
8584
state->menu->dialog = NULL;
85+
delete this;
8686
return true;
8787
}
8888

‎src/ImageDialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ bool ImageDialog::close()
4848
win->remove();
4949
win = NULL;
5050
}
51-
delete state->menu->dialog;
5251
state->menu->dialog = NULL;
52+
delete this;
5353
return true;
5454
}
5555

‎src/TextureDialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ bool TextureDialog::canClose()
109109
bool TextureDialog::close()
110110
{
111111
win->remove();
112-
delete state->menu->dialog;
113112
state->menu->dialog = NULL;
113+
delete this;
114114
return true;
115115
}
116116

@@ -151,7 +151,7 @@ bool TextureDialog::OnEvent(const SEvent &event)
151151
state->settings->getBool("installed")) + image->name;
152152
state->device->getVideoDriver()->writeImageToFile(image->get(),
153153
path.c_str());
154-
state->device->getGUIEnvironment()->addMessageBox(L"Saved Image to:",
154+
state->device->getGUIEnvironment()->addMessageBox(L"Saved Image to: ",
155155
narrow_to_wide(path).c_str());
156156
break;
157157
}

‎src/util/SimpleFileCombiner.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ std::list<std::string> SimpleFileCombiner::read(const char* file, std::string di
104104
std::cerr << "(SFC) Reading " << name.c_str() << ": " << start << " (" << size << ")" << std::endl;
105105

106106
// Read and save data
107+
std::string data(size, '\0');
107108
ifs.seekg(start, std::ios::beg);
108-
char data[size];
109-
ifs.read(static_cast<char*>(static_cast<void*>(&data)), size);
109+
ifs.read(static_cast<char*>(static_cast<void*>(&data[0])), size);
110110
std::ofstream output((dir + "/" + name).c_str(), std::ios::binary|std::ios::out);
111-
output.write(data, size);
111+
output.write(static_cast<char*>(static_cast<void*>(&data[0])), size);
112112
output.close();
113113
}
114114
return result;

‎src/util/filesys.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ std::string getSaveLoadDirectory(std::string save_dir_setting, bool editor_is_in
1414
#endif
1515

1616
if (dir.length() != 0) {
17-
size_t pos = dir.find_last_of("/");
17+
size_t pos = str_replace(dir, '\\', '/').find_last_of("/");
1818
if(pos != dir.length() - 1) {
1919
dir += "/";
2020
}
@@ -80,7 +80,7 @@ bool CreateDir(std::string path)
8080

8181
std::string filenameWithExt(std::string path)
8282
{
83-
size_t pos = path.find_last_of(DIR_DELIM);
83+
size_t pos = str_replace(path, '\\', '/').find_last_of("/");
8484
if (pos >= path.size() || pos < 0)
8585
return path;
8686

@@ -99,9 +99,9 @@ std::string filenameWithoutExt(std::string path)
9999

100100
std::string pathWithoutFilename(std::string path)
101101
{
102-
size_t pos = path.find_last_of(DIR_DELIM);
102+
size_t pos = str_replace(path, '\\', '/').find_last_of("/");
103103
if (pos >= path.size() || pos < 0)
104104
return "";
105105

106-
return path.substr(0, pos);
106+
return str_replace(str_replace(path.substr(0, pos), '\\', (char)DIR_DELIM), '/', (char)DIR_DELIM);
107107
}

0 commit comments

Comments
 (0)
This repository has been archived.