Permalink
Browse files

fs, bugfix: crash in debug mode.

  • Loading branch information...
xicilion committed Aug 12, 2018
1 parent faf8198 commit 9bb0435fa02c8e6b5ffb3bdb4dd4fd43252b2c78
Showing with 15 additions and 18 deletions.
  1. +9 −12 fibjs/src/fs/fs.cpp
  2. +6 −6 fibjs/src/zip/ZipFile.cpp
View
@@ -146,7 +146,7 @@ result_t fs_base::openFile(exlib::string fname, exlib::string flags,
s_cachelock.unlock();
if (_node && (_now.diff(_node->m_date) > 3000)) {
hr = cc_openFile(zip_file, "r", zip_stream);
hr = openFile(zip_file, "r", zip_stream, ac);
if (hr < 0)
return hr;
@@ -165,7 +165,7 @@ result_t fs_base::openFile(exlib::string fname, exlib::string flags,
if (_node == NULL) {
if (zip_stream == NULL) {
hr = cc_openFile(zip_file, "r", zip_stream);
hr = openFile(zip_file, "r", zip_stream, ac);
if (hr < 0)
return hr;
@@ -252,10 +252,7 @@ result_t fs_base::openFile(exlib::string fname, exlib::string flags,
obj_ptr<File> pFile = new File();
result_t hr;
Isolate* isolate = ac->isolate();
if (isolate == NULL)
isolate = Isolate::current();
Isolate* isolate = Runtime::check() ? Isolate::current() : ac->isolate();
if (isolate && !isolate->m_bFileAccess)
return CHECK_ERROR(CALL_E_INVALID_CALL);
@@ -317,7 +314,7 @@ result_t fs_base::openTextStream(exlib::string fname, exlib::string flags,
return CHECK_ERROR(CALL_E_NOSYNC);
obj_ptr<SeekableStream_base> pFile;
result_t hr = cc_openFile(fname, flags, pFile);
result_t hr = openFile(fname, flags, pFile, ac);
if (hr < 0)
return hr;
@@ -334,7 +331,7 @@ result_t fs_base::readTextFile(exlib::string fname, exlib::string& retVal,
obj_ptr<Buffer_base> buf;
result_t hr;
hr = cc_openFile(fname, "r", f);
hr = openFile(fname, "r", f, ac);
if (hr < 0)
return hr;
@@ -362,7 +359,7 @@ result_t fs_base::readFile(exlib::string fname, exlib::string encoding,
obj_ptr<Buffer_base> buf;
result_t hr;
hr = cc_openFile(fname, "r", f);
hr = openFile(fname, "r", f, ac);
if (hr < 0)
return hr;
@@ -416,7 +413,7 @@ result_t fs_base::writeTextFile(exlib::string fname, exlib::string txt,
obj_ptr<SeekableStream_base> f;
result_t hr;
hr = cc_openFile(fname, "w", f);
hr = openFile(fname, "w", f, ac);
if (hr < 0)
return hr;
@@ -436,7 +433,7 @@ result_t fs_base::writeFile(exlib::string fname, Buffer_base* data, AsyncEvent*
obj_ptr<SeekableStream_base> f;
result_t hr;
hr = cc_openFile(fname, "w", f);
hr = openFile(fname, "w", f, ac);
if (hr < 0)
return hr;
@@ -453,7 +450,7 @@ result_t fs_base::appendFile(exlib::string fname, Buffer_base* data, AsyncEvent*
obj_ptr<SeekableStream_base> f;
result_t hr;
hr = cc_openFile(fname, "a", f);
hr = openFile(fname, "a", f, ac);
if (hr < 0)
return hr;
View
@@ -190,7 +190,7 @@ result_t zip_base::open(exlib::string path, exlib::string mod, int32_t compress_
bool exists;
if ((mod == "w"))
hr = fs_base::cc_openFile(path, "w", file);
hr = fs_base::openFile(path, "w", file, ac);
else if ((mod == "a") || (mod == "a+")) {
hr = fs_base::cc_exists(path, exists);
if (hr < 0)
@@ -199,11 +199,11 @@ result_t zip_base::open(exlib::string path, exlib::string mod, int32_t compress_
if (!exists)
return CHECK_ERROR(Runtime::setError("zip file not exists!"));
hr = fs_base::cc_openFile(path, "r+", file);
hr = fs_base::openFile(path, "r+", file, ac);
}
else
hr = fs_base::cc_openFile(path, "r", file);
hr = fs_base::openFile(path, "r", file, ac);
if (hr < 0)
return hr;
@@ -479,7 +479,7 @@ result_t ZipFile::extract(exlib::string member, exlib::string path, exlib::strin
if (err != UNZ_OK)
return CHECK_ERROR(Runtime::setError(zip_error(err)));
hr = fs_base::cc_openFile(path, "w", file);
hr = fs_base::openFile(path, "w", file, ac);
if (hr < 0)
return hr;
@@ -579,7 +579,7 @@ result_t ZipFile::extractAll(exlib::string path, exlib::string password, AsyncEv
fpath1 += "?";
} while (exists);
hr = fs_base::cc_openFile(fpath, "w", file);
hr = fs_base::openFile(fpath, "w", file, ac);
if (hr < 0)
return hr;
@@ -741,7 +741,7 @@ result_t ZipFile::write(exlib::string filename, exlib::string inZipName, exlib::
result_t hr;
obj_ptr<SeekableStream_base> file;
hr = fs_base::cc_openFile(filename, "r", file);
hr = fs_base::openFile(filename, "r", file, ac);
if (hr < 0)
return hr;

0 comments on commit 9bb0435

Please sign in to comment.