PIIODevice remove init
picloud dispatcher fix
This commit is contained in:
@@ -112,7 +112,7 @@
|
||||
REGISTER_DEVICE(PIFile)
|
||||
|
||||
PRIVATE_DEFINITION_START(PIFile)
|
||||
FILE * fd;
|
||||
FILE * fd = nullptr;
|
||||
PRIVATE_DEFINITION_END(PIFile)
|
||||
|
||||
|
||||
@@ -146,8 +146,7 @@ PIString PIFile::FileInfo::dir() const {
|
||||
if (path.isEmpty()) return PIString();
|
||||
int ind = path.findLast(PIDir::separator);
|
||||
PIString ret;
|
||||
if (ind >= 0)
|
||||
ret = path.mid(0, ind);
|
||||
if (ind >= 0) ret = path.mid(0, ind);
|
||||
if (ret.isEmpty()) ret = ".";
|
||||
return ret + PIDir::separator;
|
||||
}
|
||||
@@ -156,14 +155,11 @@ PIString PIFile::FileInfo::dir() const {
|
||||
|
||||
|
||||
PIFile::PIFile(): PIIODevice() {
|
||||
_init();
|
||||
}
|
||||
|
||||
|
||||
PIFile::PIFile(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) {
|
||||
_init();
|
||||
if (!path.isEmpty())
|
||||
open();
|
||||
if (!path.isEmpty()) open();
|
||||
}
|
||||
|
||||
|
||||
@@ -176,8 +172,9 @@ bool PIFile::openTemporary(PIIODevice::DeviceMode mode) {
|
||||
if (!rc) return false;
|
||||
tp = rc;
|
||||
#endif
|
||||
while (isExists(tp))
|
||||
while (isExists(tp)) {
|
||||
tp += PIString::fromNumber(randomi() % 10);
|
||||
}
|
||||
return open(tp, mode);
|
||||
}
|
||||
|
||||
@@ -350,13 +347,6 @@ PIString PIFile::strType(const PIIODevice::DeviceMode type) {
|
||||
}
|
||||
|
||||
|
||||
void PIFile::_init() {
|
||||
PRIVATE->fd = 0;
|
||||
fdi = -1;
|
||||
_size = -1;
|
||||
}
|
||||
|
||||
|
||||
void PIFile::flush() {
|
||||
if (isOpened()) fflush(PRIVATE->fd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user