mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Use make_intrusive/make_shared for smart pointer construction.
This commit is contained in:
@@ -203,13 +203,13 @@ InputStreamP Package::openIn(const String& file) {
|
||||
InputStreamP stream;
|
||||
if (it != files.end() && it->second.wasWritten()) {
|
||||
// written to this file, open the temp file
|
||||
stream = shared(new BufferedFileInputStream(it->second.tempName));
|
||||
stream = make_shared<BufferedFileInputStream>(it->second.tempName);
|
||||
} else if (wxFileExists(filename+_("/")+file)) {
|
||||
// a file in directory package
|
||||
stream = shared(new BufferedFileInputStream(filename+_("/")+file));
|
||||
stream = make_shared<BufferedFileInputStream>(filename+_("/")+file);
|
||||
} else if (wxFileExists(filename) && it != files.end() && it->second.zipEntry) {
|
||||
// a file in a zip archive
|
||||
stream = static_pointer_cast<wxZipInputStream>(shared(new ZipFileInputStream(filename, it->second.zipEntry)));
|
||||
stream = static_pointer_cast<wxZipInputStream>(make_shared<ZipFileInputStream>(filename, it->second.zipEntry));
|
||||
} else {
|
||||
// shouldn't happen, packaged changed by someone else since opening it
|
||||
throw FileNotFoundError(file, filename);
|
||||
@@ -222,7 +222,7 @@ InputStreamP Package::openIn(const String& file) {
|
||||
}
|
||||
|
||||
OutputStreamP Package::openOut(const String& file) {
|
||||
return shared(new wxFileOutputStream(nameOut(file)));
|
||||
return make_shared<wxFileOutputStream>(nameOut(file));
|
||||
}
|
||||
|
||||
String Package::nameOut(const String& file) {
|
||||
@@ -296,7 +296,7 @@ InputStreamP Package::openAbsoluteFile(const String& name) {
|
||||
size_t pos = name.find_first_of(_('\1'));
|
||||
if (pos == String::npos) {
|
||||
// temp or dir file
|
||||
shared_ptr<wxFileInputStream> f = shared(new wxFileInputStream(name));
|
||||
shared_ptr<wxFileInputStream> f = make_shared<wxFileInputStream>(name);
|
||||
if (!f->IsOk()) throw FileNotFoundError(_("<unknown>"), name);
|
||||
return f;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user