- Fixed several memory errors
This commit is contained in:
@@ -193,7 +193,7 @@ bool file::open(const string& p, uint8_t mode) {
|
||||
}
|
||||
|
||||
// Attempt to open the file
|
||||
_handle = fopen(p, fmode_translate(mode));
|
||||
_handle = fopen(p.cstr(), fmode_translate(mode));
|
||||
|
||||
// Validate the file
|
||||
if (_handle == nullptr) {
|
||||
@@ -233,7 +233,7 @@ bool file::open(const path& p, uint8_t mode) {
|
||||
}
|
||||
|
||||
// Attempt to open the file
|
||||
_handle = fopen(p.str(), fmode_translate(mode));
|
||||
_handle = fopen(p.cstr(), fmode_translate(mode));
|
||||
|
||||
// Validate the file
|
||||
if (_handle == nullptr) {
|
||||
@@ -313,7 +313,7 @@ bool file::erase() {
|
||||
}
|
||||
|
||||
// Erase the file
|
||||
remove(path.str());
|
||||
remove(path.cstr());
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -335,7 +335,7 @@ bool file::rename(const cstring& str) {
|
||||
}
|
||||
|
||||
// Attempt to open the new file
|
||||
FILE* fnew = fopen(fpath.str(), "wx");
|
||||
FILE* fnew = fopen(fpath.cstr(), "wx");
|
||||
|
||||
// Check for open failure
|
||||
if (fnew == nullptr) {
|
||||
@@ -395,7 +395,7 @@ bool file::rename(const cstring& str) {
|
||||
fclose(_handle);
|
||||
|
||||
// Reopen the new file
|
||||
_handle = freopen(fpath.str(), fmode_translate(_mode), fnew);
|
||||
_handle = freopen(fpath.cstr(), fmode_translate(_mode), fnew);
|
||||
|
||||
// Check for open failure
|
||||
if (_handle == nullptr) {
|
||||
@@ -404,7 +404,7 @@ bool file::rename(const cstring& str) {
|
||||
}
|
||||
|
||||
// Erase the old file
|
||||
remove(_path.str());
|
||||
remove(_path.cstr());
|
||||
|
||||
// Set the new path
|
||||
_path = fpath;
|
||||
@@ -429,7 +429,7 @@ bool file::rename(const string& str) {
|
||||
}
|
||||
|
||||
// Attempt to open the new file
|
||||
FILE* fnew = fopen(fpath.str(), "wx");
|
||||
FILE* fnew = fopen(fpath.cstr(), "wx");
|
||||
|
||||
// Check for open failure
|
||||
if (fnew == nullptr) {
|
||||
@@ -488,7 +488,7 @@ bool file::rename(const string& str) {
|
||||
fclose(_handle);
|
||||
|
||||
// Reopen the new file
|
||||
_handle = freopen(_path.str(), fmode_translate(_mode), fnew);
|
||||
_handle = freopen(_path.cstr(), fmode_translate(_mode), fnew);
|
||||
|
||||
// Check for open failure
|
||||
if (_handle == nullptr) {
|
||||
@@ -518,7 +518,7 @@ bool file::rename(const path& p) {
|
||||
}
|
||||
|
||||
// Attempt to open the new file
|
||||
FILE* fnew = fopen(fpath.str(), "wx");
|
||||
FILE* fnew = fopen(fpath.cstr(), "wx");
|
||||
|
||||
// Check for open failure
|
||||
if (fnew == nullptr) {
|
||||
@@ -577,7 +577,7 @@ bool file::rename(const path& p) {
|
||||
fclose(_handle);
|
||||
|
||||
// Reopen the new file
|
||||
_handle = freopen(_path.str(), fmode_translate(_mode), fnew);
|
||||
_handle = freopen(_path.cstr(), fmode_translate(_mode), fnew);
|
||||
|
||||
// Check for open failure
|
||||
if (_handle == nullptr) {
|
||||
@@ -608,7 +608,7 @@ file file::copy(const cstring& str) {
|
||||
}
|
||||
|
||||
// Attempt to open the new file
|
||||
FILE* fnew = fopen(fpath.str(), "wx");
|
||||
FILE* fnew = fopen(fpath.cstr(), "wx");
|
||||
|
||||
// Check for open failure
|
||||
if (fnew == nullptr) {
|
||||
@@ -698,7 +698,7 @@ file file::copy(const string& str) {
|
||||
}
|
||||
|
||||
// Attempt to open the new file
|
||||
FILE* fnew = fopen(fpath.str(), "wx");
|
||||
FILE* fnew = fopen(fpath.cstr(), "wx");
|
||||
|
||||
// Check for open failure
|
||||
if (fnew == nullptr) {
|
||||
@@ -789,7 +789,7 @@ file file::copy(const path& p) {
|
||||
}
|
||||
|
||||
// Attempt to open the new file
|
||||
FILE* fnew = fopen(fpath.str(), "wx");
|
||||
FILE* fnew = fopen(fpath.cstr(), "wx");
|
||||
|
||||
// Check for open failure
|
||||
if (fnew == nullptr) {
|
||||
@@ -989,7 +989,7 @@ wstring file::getwline() {
|
||||
|
||||
// Check if there is a file
|
||||
if (_handle == nullptr) {
|
||||
return 0;
|
||||
return _wstring{ L"" };
|
||||
}
|
||||
|
||||
// Read the next line;
|
||||
|
||||
@@ -46,7 +46,7 @@ path path::current() {
|
||||
}
|
||||
|
||||
path path::current(const path& path) {
|
||||
if (chdir(path._str)) {
|
||||
if (chdir(path._str.cstr())) {
|
||||
return fennec::path("");
|
||||
}
|
||||
return current();
|
||||
|
||||
Reference in New Issue
Block a user