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

Commit

Permalink
Fix compile on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jul 29, 2014
1 parent 73db351 commit f231f13
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/FileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ bool FileDialog::close()
win->remove();
win = NULL;
}
delete state->menu->dialog;
state->menu->dialog = NULL;
delete this;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ImageDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ bool ImageDialog::close()
win->remove();
win = NULL;
}
delete state->menu->dialog;
state->menu->dialog = NULL;
delete this;
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/TextureDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ bool TextureDialog::canClose()
bool TextureDialog::close()
{
win->remove();
delete state->menu->dialog;
state->menu->dialog = NULL;
delete this;
return true;
}

Expand Down Expand Up @@ -151,7 +151,7 @@ bool TextureDialog::OnEvent(const SEvent &event)
state->settings->getBool("installed")) + image->name;
state->device->getVideoDriver()->writeImageToFile(image->get(),
path.c_str());
state->device->getGUIEnvironment()->addMessageBox(L"Saved Image to:",
state->device->getGUIEnvironment()->addMessageBox(L"Saved Image to: ",
narrow_to_wide(path).c_str());
break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/util/SimpleFileCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ std::list<std::string> SimpleFileCombiner::read(const char* file, std::string di
std::cerr << "(SFC) Reading " << name.c_str() << ": " << start << " (" << size << ")" << std::endl;

// Read and save data
std::string data(size, '\0');
ifs.seekg(start, std::ios::beg);
char data[size];
ifs.read(static_cast<char*>(static_cast<void*>(&data)), size);
ifs.read(static_cast<char*>(static_cast<void*>(&data[0])), size);
std::ofstream output((dir + "/" + name).c_str(), std::ios::binary|std::ios::out);
output.write(data, size);
output.write(static_cast<char*>(static_cast<void*>(&data[0])), size);
output.close();
}
return result;
Expand Down
8 changes: 4 additions & 4 deletions src/util/filesys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ std::string getSaveLoadDirectory(std::string save_dir_setting, bool editor_is_in
#endif

if (dir.length() != 0) {
size_t pos = dir.find_last_of("/");
size_t pos = str_replace(dir, '\\', '/').find_last_of("/");
if(pos != dir.length() - 1) {
dir += "/";
}
Expand Down Expand Up @@ -80,7 +80,7 @@ bool CreateDir(std::string path)

std::string filenameWithExt(std::string path)
{
size_t pos = path.find_last_of(DIR_DELIM);
size_t pos = str_replace(path, '\\', '/').find_last_of("/");
if (pos >= path.size() || pos < 0)
return path;

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

std::string pathWithoutFilename(std::string path)
{
size_t pos = path.find_last_of(DIR_DELIM);
size_t pos = str_replace(path, '\\', '/').find_last_of("/");
if (pos >= path.size() || pos < 0)
return "";

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

0 comments on commit f231f13

Please sign in to comment.