BIG deep clean

This commit is contained in:
2020-06-10 13:14:16 +03:00
parent f579718e0b
commit c59579d5d5
222 changed files with 2392 additions and 11600 deletions

View File

@@ -16,6 +16,7 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piincludes_p.h"
#include "pifile.h"
#include "pidir.h"
@@ -153,15 +154,6 @@ bool PIFile::openTemporary(PIIODevice::DeviceMode mode) {
}
//PIFile::PIFile(const PIFile & other) {
// PRIVATE->fd = 0;
// fdi = -1;
// setPrecision(other.prec_);
// setPath(other.path());
// mode_ = other.mode_;
//}
bool PIFile::openDevice() {
close();
PIString p = path();
@@ -632,20 +624,6 @@ PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
ret.size = filesize.QuadPart;
ret.time_access = FILETIME2PIDateTime(fi.ftLastAccessTime);
ret.time_modification = FILETIME2PIDateTime(fi.ftLastWriteTime);
/*PIByteArray sec;
DWORD sec_n(0);
//SECURITY_DESCRIPTOR sec;
GetFileSecurity(path.data(), DACL_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION, (SECURITY_DESCRIPTOR*)sec.data(), 0, &sec_n);
sec.resize(sec_n);
GetFileSecurity(path.data(), DACL_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION, (SECURITY_DESCRIPTOR*)sec.data(), sec.size(), &sec_n);
errorClear();
SID sid; BOOL def;
GetSecurityDescriptorGroup((PSECURITY_DESCRIPTOR)sec.data(), &sid, &def);
char * s(0);
ConvertSidToStringSid((PSID)&sid, s);
piCout << s;
LocalFree(s);
//ret.id_user = ;*/
}
CloseHandle(hFile);
#else
@@ -708,7 +686,6 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
if (!info.perm_user.write) attr |= FILE_ATTRIBUTE_READONLY;
if (SetFileAttributes((LPCTSTR)(fp.data()), attr) == 0) {
piCout << "[PIFile] applyFileInfo: \"SetFileAttributes\" error:" << errorString();
//return false;
}
HANDLE hFile = 0;
if ((attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) {
@@ -724,7 +701,6 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
}
CloseHandle(hFile);
#else
//#ifndef ESP_PLATFORM
int mode(0);
if (info.perm_user.read) mode |= S_IRUSR;
if (info.perm_user.write) mode |= S_IWUSR;
@@ -737,11 +713,9 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
if (info.perm_other.exec) mode |= S_IXOTH;
if (chmod(fp.data(), mode) != 0) {
piCout << "[PIFile] applyFileInfo: \"chmod\" error:" << errorString();
//return false;
}
if (chown(fp.data(), info.id_user, info.id_group) != 0) {
piCout << "[PIFile] applyFileInfo: \"chown\" error:" << errorString();
//return false;
}
struct timeval tm[2];
PISystemTime st = info.time_access.toSystemTime();
@@ -752,9 +726,7 @@ bool PIFile::applyFileInfo(const PIString & path, const PIFile::FileInfo & info)
tm[1].tv_usec = st.nanoseconds / 1000;
if (utimes(fp.data(), tm) != 0) {
piCout << "[PIFile] applyFileInfo: \"utimes\" error:" << errorString();
//return false;
}
//#endif
#endif
return true;
}