git-svn-id: svn://db.shs.com.ru/pip@355 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2017-04-14 12:34:45 +00:00
parent be1f348da6
commit d07c71e97d
18 changed files with 66 additions and 58 deletions

View File

@@ -29,6 +29,25 @@
#include "picout.h" #include "picout.h"
#include <list> #include <list>
#include <malloc.h>
#ifndef PIP_MEMALIGN_BYTES
# define PIP_MEMALIGN_BYTES (sizeof(void*)*4)
#endif
#ifdef WINDOWS
# ifdef CC_GCC
# define amalloc(s) __mingw_aligned_malloc(s, PIP_MEMALIGN_BYTES)
# define afree(p) __mingw_aligned_free(p)
# else
# ifdef CC_VC
# define amalloc(s) _aligned_malloc(s, PIP_MEMALIGN_BYTES)
# define afree(p) _aligned_free(p)
# endif
# endif
#else
# define amalloc(s) aligned_alloc(PIP_MEMALIGN_BYTES, s)
# define afree(p) free(p)
#endif
template<typename Type0, typename Type1> template<typename Type0, typename Type1>
class PIP_EXPORT PIPair { class PIP_EXPORT PIPair {
public: public:

View File

@@ -306,7 +306,7 @@ public:
PIDeque<T> & enlarge(llong pid_size) {llong ns = size_s() + pid_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;} PIDeque<T> & enlarge(llong pid_size) {llong ns = size_s() + pid_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
PIDeque<T> & removeOne(const T & v) {for (size_t i = 0; i < pid_size; ++i) if (pid_data[i + pid_start] == v) {remove(i); return *this;} return *this;} PIDeque<T> & removeOne(const T & v) {for (size_t i = 0; i < pid_size; ++i) if (pid_data[i + pid_start] == v) {remove(i); return *this;} return *this;}
PIDeque<T> & removeAll(const T & v) {for (llong i = 0; i < pid_size; ++i) if (pid_data[i + pid_start] == v) {remove(i); --i;} return *this;} PIDeque<T> & removeAll(const T & v) {for (ssize_t i = 0; i < ssize_t(pid_size); ++i) if (pid_data[i + pid_start] == v) {remove(i); --i;} return *this;}
PIDeque<T> & push_back(const T & v) {alloc(pid_size + 1, true); PIINTROSPECTION_CONTAINER_USED(sizeof(T)); elementNew(pid_data + pid_start + pid_size - 1, v); return *this;} PIDeque<T> & push_back(const T & v) {alloc(pid_size + 1, true); PIINTROSPECTION_CONTAINER_USED(sizeof(T)); elementNew(pid_data + pid_start + pid_size - 1, v); return *this;}
PIDeque<T> & append(const T & v) {return push_back(v);} PIDeque<T> & append(const T & v) {return push_back(v);}
@@ -416,7 +416,7 @@ private:
} }
}*/ }*/
//printf("(%p) check move st=%d sz=%d rs=%d\n", this, pid_start, pid_size, pid_rsize); //printf("(%p) check move st=%d sz=%d rs=%d\n", this, pid_start, pid_size, pid_rsize);
if (pid_start < pid_size + pid_size || pid_start > pid_rsize - pid_size - pid_size) { if (pid_start < ssize_t(pid_size + pid_size) || pid_start > (ssize_t(pid_rsize) - ssize_t(pid_size) - ssize_t(pid_size))) {
ssize_t ns = (pid_rsize - pid_size) / 2; ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) { if (pid_start != ns) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns); //printf("(%p) move %d -> %d\n", this, pid_start, ns);

View File

@@ -274,7 +274,7 @@ public:
PIVector<T> & enlarge(llong piv_size) {llong ns = size_s() + piv_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;} PIVector<T> & enlarge(llong piv_size) {llong ns = size_s() + piv_size; if (ns <= 0) clear(); else resize(size_t(ns)); return *this;}
PIVector<T> & removeOne(const T & v) {for (size_t i = 0; i < piv_size; ++i) if (piv_data[i] == v) {remove(i); return *this;} return *this;} PIVector<T> & removeOne(const T & v) {for (size_t i = 0; i < piv_size; ++i) if (piv_data[i] == v) {remove(i); return *this;} return *this;}
PIVector<T> & removeAll(const T & v) {for (llong i = 0; i < piv_size; ++i) if (piv_data[i] == v) {remove(i); --i;} return *this;} PIVector<T> & removeAll(const T & v) {for (ssize_t i = 0; i < ssize_t(piv_size); ++i) if (piv_data[i] == v) {remove(i); --i;} return *this;}
PIVector<T> & push_back(const T & v) {alloc(piv_size + 1); elementNew(piv_data + piv_size - 1, v); return *this;} PIVector<T> & push_back(const T & v) {alloc(piv_size + 1); elementNew(piv_data + piv_size - 1, v); return *this;}
PIVector<T> & append(const T & v) {return push_back(v);} PIVector<T> & append(const T & v) {return push_back(v);}

View File

@@ -97,7 +97,6 @@
#ifdef WINDOWS #ifdef WINDOWS
# include <windef.h> # include <windef.h>
# include <winbase.h> # include <winbase.h>
# include <malloc.h>
# ifdef CC_VC # ifdef CC_VC
# define SHUT_RDWR 2 # define SHUT_RDWR 2
# pragma comment(lib, "Ws2_32.lib") # pragma comment(lib, "Ws2_32.lib")
@@ -113,24 +112,6 @@
inline int random() {return rand();} inline int random() {return rand();}
#endif #endif
#ifndef PIP_MEMALIGN_BYTES
# define PIP_MEMALIGN_BYTES (sizeof(void*)*4)
#endif
#ifdef WINDOWS
# ifdef CC_GCC
# define amalloc(s) __mingw_aligned_malloc(s, PIP_MEMALIGN_BYTES)
# define afree(p) __mingw_aligned_free(p)
# else
# ifdef CC_VC
# define amalloc(s) _aligned_malloc(s, PIP_MEMALIGN_BYTES)
# define afree(p) _aligned_free(p)
# endif
# endif
#else
# define amalloc(s) aligned_alloc(PIP_MEMALIGN_BYTES, s)
# define afree(p) free(p)
#endif
#ifdef ANDROID #ifdef ANDROID
# define tcdrain(fd) ioctl(fd, TCSBRK, 1) # define tcdrain(fd) ioctl(fd, TCSBRK, 1)
//inline int wctomb(char * c, wchar_t w) {*c = ((char * )&w)[0]; return 1;} //inline int wctomb(char * c, wchar_t w) {*c = ((char * )&w)[0]; return 1;}
@@ -165,9 +146,9 @@
# pragma GCC diagnostic ignored "-Waggressive-loop-optimizations" # pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
# endif # endif
# pragma GCC diagnostic ignored "-Wformat" # pragma GCC diagnostic ignored "-Wformat"
# pragma GCC diagnostic ignored "-Wformat-extra-args" //# pragma GCC diagnostic ignored "-Wformat-extra-args"
# pragma GCC diagnostic ignored "-Wstrict-aliasing" # pragma GCC diagnostic ignored "-Wstrict-aliasing"
# pragma GCC diagnostic ignored "-Wsign-compare" //# pragma GCC diagnostic ignored "-Wsign-compare"
# endif # endif
# ifdef ANDROID # ifdef ANDROID
# pragma GCC diagnostic ignored "-Wunused-parameter" # pragma GCC diagnostic ignored "-Wunused-parameter"
@@ -414,10 +395,15 @@ template<typename T> inline T piLetobe(const T & v) {T tv(v); piLetobe(&tv, size
// specialization // specialization
template<> inline ushort piLetobe(const ushort & v) {return (v << 8) | (v >> 8);} template<> inline ushort piLetobe(const ushort & v) {return (v << 8) | (v >> 8);}
template<> inline uint piLetobe(const uint & v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);} template<> inline uint piLetobe(const uint & v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);}
template<> inline float piLetobe(const float & f) { template<> inline float piLetobe(const float & v) {
uint v = *((uint *)&f); union _pletobe_f {
v = (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000); _pletobe_f(const float &f_) {f = f_;}
return *((float *)&v); float f;
uint v;
};
_pletobe_f a(v);
a.v = (a.v >> 24) | ((a.v >> 8) & 0xFF00) | ((a.v << 8) & 0xFF0000) | ((a.v << 24) & 0xFF000000);
return a.f;
} }
DEPRECATED inline ushort letobe_s(const ushort & v) {return (v << 8) | (v >> 8);} DEPRECATED inline ushort letobe_s(const ushort & v) {return (v << 8) | (v >> 8);}

View File

@@ -48,6 +48,9 @@
# include <unicode/uclean.h> # include <unicode/uclean.h>
# include <unicode/ucnv.h> # include <unicode/ucnv.h>
#endif #endif
#ifdef CC_GCC
# include <unistd.h>
#endif
/* /*
#ifdef WINDOWS #ifdef WINDOWS
# include <conio.h> # include <conio.h>

View File

@@ -2,7 +2,7 @@
bool PIPropertyStorage::isPropertyExists(const PIString & _name) const { bool PIPropertyStorage::isPropertyExists(const PIString & _name) const {
for (int i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == _name) if (props[i].name == _name)
return true; return true;
return false; return false;
@@ -10,7 +10,7 @@ bool PIPropertyStorage::isPropertyExists(const PIString & _name) const {
void PIPropertyStorage::addProperty(const PIPropertyStorage::Property & p) { void PIPropertyStorage::addProperty(const PIPropertyStorage::Property & p) {
for (int i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == p.name) { if (props[i].name == p.name) {
props[i] = p; props[i] = p;
return; return;
@@ -20,7 +20,7 @@ void PIPropertyStorage::addProperty(const PIPropertyStorage::Property & p) {
void PIPropertyStorage::removeProperty(const PIString & _name) { void PIPropertyStorage::removeProperty(const PIString & _name) {
for (int i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == _name) { if (props[i].name == _name) {
props.remove(i); props.remove(i);
return; return;
@@ -29,7 +29,7 @@ void PIPropertyStorage::removeProperty(const PIString & _name) {
void PIPropertyStorage::removePropertiesByFlag(int flag) { void PIPropertyStorage::removePropertiesByFlag(int flag) {
for (int i = 0; i < props.size(); ++i) for (int i = 0; i < props.size_s(); ++i)
if ((props[i].flags & flag) == flag) { if ((props[i].flags & flag) == flag) {
props.remove(i); props.remove(i);
--i; --i;
@@ -43,7 +43,7 @@ void PIPropertyStorage::updateProperties(const PIVector<PIPropertyStorage::Prope
if (((p.flags & flag_ignore) != flag_ignore) || (flag_ignore == 0)) if (((p.flags & flag_ignore) != flag_ignore) || (flag_ignore == 0))
values[p.name] = p.value; values[p.name] = p.value;
props = properties_; props = properties_;
for (int i = 0; i < props.size(); ++i) { for (uint i = 0; i < props.size(); ++i) {
Property & p(props[i]); Property & p(props[i]);
if (values.contains(p.name)) { if (values.contains(p.name)) {
PIVariant pv = values[p.name]; PIVariant pv = values[p.name];
@@ -71,7 +71,7 @@ PIVariant PIPropertyStorage::propertyValueByName(const PIString & name) const {
void PIPropertyStorage::setPropertyValue(const PIString & name, const PIVariant & value) { void PIPropertyStorage::setPropertyValue(const PIString & name, const PIVariant & value) {
for (int i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == name) { if (props[i].name == name) {
props[i].value = value; props[i].value = value;
return; return;
@@ -80,7 +80,7 @@ void PIPropertyStorage::setPropertyValue(const PIString & name, const PIVariant
void PIPropertyStorage::setPropertyComment(const PIString & name, const PIString & comment) { void PIPropertyStorage::setPropertyComment(const PIString & name, const PIString & comment) {
for (int i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == name) { if (props[i].name == name) {
props[i].comment = comment; props[i].comment = comment;
return; return;
@@ -89,7 +89,7 @@ void PIPropertyStorage::setPropertyComment(const PIString & name, const PIString
void PIPropertyStorage::setPropertyFlags(const PIString & name, int flags) { void PIPropertyStorage::setPropertyFlags(const PIString & name, int flags) {
for (int i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == name) { if (props[i].name == name) {
props[i].flags = flags; props[i].flags = flags;
return; return;

View File

@@ -193,7 +193,7 @@ public:
bool isEnd() const {if (isClosed()) return true; return file.isEnd();} bool isEnd() const {if (isClosed()) return true; return file.isEnd();}
//! Returns if BinLog file is empty //! Returns if BinLog file is empty
bool isEmpty() const {return (file.size() <= PIBINARYLOG_SIGNATURE_SIZE + 1);} bool isEmpty() const {return (file.size() <= llong(PIBINARYLOG_SIGNATURE_SIZE + 1));}
//! Returns BinLog pause status //! Returns BinLog pause status
bool isPause() const {return is_pause;} bool isPause() const {return is_pause;}

View File

@@ -235,7 +235,7 @@ PIVector<PIFile::FileInfo> PIDir::entries() {
PIFile::FileInfo fi; PIFile::FileInfo fi;
DWORD ll = GetLogicalDriveStrings(1023, letters); DWORD ll = GetLogicalDriveStrings(1023, letters);
PIString clet; PIString clet;
for (int i = 0; i < ll; ++i) { for (DWORD i = 0; i < ll; ++i) {
if (letters[i] == '\0') { if (letters[i] == '\0') {
clet.resize(2); clet.resize(2);
fi.path = clet; fi.path = clet;

View File

@@ -55,7 +55,7 @@ bool PIFileTransfer::send(PIVector<PIFile::FileInfo> entries) {
scanning = false; scanning = false;
scan_dir.up(); scan_dir.up();
//piCout << "files rel to" << d.absolutePath(); //piCout << "files rel to" << d.absolutePath();
for (int j = 0; j < fls.size(); j++) { for (uint j = 0; j < fls.size(); j++) {
allEntries << PFTFileInfo(fls[j]); allEntries << PFTFileInfo(fls[j]);
allEntries.back().dest_path = scan_dir.relative(fls[j].path); allEntries.back().dest_path = scan_dir.relative(fls[j].path);
//piCout << " abs path" << fls[j].path; //piCout << " abs path" << fls[j].path;

View File

@@ -134,7 +134,7 @@ PIString PIPeer::PeerInfo::fastestAddress() const {
REGISTER_DEVICE(PIPeer) REGISTER_DEVICE(PIPeer)
PIPeer::PIPeer(const PIString & n): PIIODevice(), eth_tcp_srv(PIEthernet::TCP_Server), eth_tcp_cli(PIEthernet::TCP_Client), diag_s(false), diag_d(false) { PIPeer::PIPeer(const PIString & n): PIIODevice(), inited__(false), eth_tcp_srv(PIEthernet::TCP_Server), eth_tcp_cli(PIEthernet::TCP_Client), diag_s(false), diag_d(false) {
//piCout << " PIPeer" << uint(this); //piCout << " PIPeer" << uint(this);
destroyed = false; destroyed = false;
setDebug(false); setDebug(false);
@@ -429,7 +429,7 @@ void PIPeer::dtReceived(const PIString & from, const PIByteArray & data) {
dataReceivedEvent(from, data); dataReceivedEvent(from, data);
if (trust_peer.isEmpty() || trust_peer == from) { if (trust_peer.isEmpty() || trust_peer == from) {
read_buffer_mutex.lock(); read_buffer_mutex.lock();
if (read_buffer.size() < read_buffer_size) read_buffer.enqueue(data); if (read_buffer.size_s() < read_buffer_size) read_buffer.enqueue(data);
read_buffer_mutex.unlock(); read_buffer_mutex.unlock();
} }
} }

View File

@@ -195,6 +195,7 @@ private:
// Data packet: 4, from, to, ticks, data_size, data // Data packet: 4, from, to, ticks, data_size, data
protected: protected:
bool inited__; //for internal use
PIMutex mc_mutex, eth_mutex, peers_mutex, send_mutex, send_mc_mutex; PIMutex mc_mutex, eth_mutex, peers_mutex, send_mutex, send_mc_mutex;
private: private:

View File

@@ -28,7 +28,7 @@ const char hash_def_key[] = "_picrypt_";
PICrypt::PICrypt() { PICrypt::PICrypt() {
#ifdef PIP_CRYPT #ifdef PIP_CRYPT
sodium_init(); if (!sodium_init()) piCout << "[PICrypt]" << "Error while initialize sodium!";
nonce_.resize(crypto_secretbox_NONCEBYTES); nonce_.resize(crypto_secretbox_NONCEBYTES);
key_.resize(crypto_secretbox_KEYBYTES); key_.resize(crypto_secretbox_KEYBYTES);
randombytes_buf(key_.data(), key_.size()); randombytes_buf(key_.data(), key_.size());
@@ -77,7 +77,7 @@ PIByteArray PICrypt::crypt(const PIByteArray & data, PIByteArray key) {
if (key.size() != crypto_secretbox_KEYBYTES) if (key.size() != crypto_secretbox_KEYBYTES)
key.resize(crypto_secretbox_KEYBYTES, ' '); key.resize(crypto_secretbox_KEYBYTES, ' ');
//return PIByteArray(); //return PIByteArray();
sodium_init(); if (!sodium_init()) return retba;
PIByteArray n; PIByteArray n;
retba.resize(data.size() + crypto_secretbox_MACBYTES); retba.resize(data.size() + crypto_secretbox_MACBYTES);
n.resize(crypto_secretbox_NONCEBYTES); n.resize(crypto_secretbox_NONCEBYTES);
@@ -123,7 +123,7 @@ PIByteArray PICrypt::decrypt(const PIByteArray & crypt_data, PIByteArray key, bo
if (ok) *ok = false; if (ok) *ok = false;
return PIByteArray(); return PIByteArray();
} }
sodium_init(); if (!sodium_init()) return retba;
PIByteArray n; PIByteArray n;
n.resize(crypto_secretbox_NONCEBYTES); n.resize(crypto_secretbox_NONCEBYTES);
retba.resize(crypt_data.size() - n.size() - crypto_secretbox_MACBYTES); retba.resize(crypt_data.size() - n.size() - crypto_secretbox_MACBYTES);
@@ -144,7 +144,7 @@ PIByteArray PICrypt::decrypt(const PIByteArray & crypt_data, PIByteArray key, bo
PIByteArray PICrypt::hash(const PIString & secret) { PIByteArray PICrypt::hash(const PIString & secret) {
PIByteArray hash; PIByteArray hash;
#ifdef PIP_CRYPT #ifdef PIP_CRYPT
sodium_init(); if (!sodium_init()) return hash;
hash.resize(crypto_generichash_BYTES); hash.resize(crypto_generichash_BYTES);
PIByteArray s(secret.data(), secret.size()); PIByteArray s(secret.data(), secret.size());
crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1); crypto_generichash(hash.data(), hash.size(), s.data(), s.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1);
@@ -159,7 +159,7 @@ ullong PICrypt::shorthash(const PIString& s, PIByteArray key) {
ullong hash = 0; ullong hash = 0;
#ifdef PIP_CRYPT #ifdef PIP_CRYPT
if (crypto_shorthash_BYTES != sizeof(hash)) piCout << "[PICrypt]" << "internal error: bad hash size"; if (crypto_shorthash_BYTES != sizeof(hash)) piCout << "[PICrypt]" << "internal error: bad hash size";
sodium_init(); if (!sodium_init()) return hash;
if (key.size() != crypto_shorthash_KEYBYTES) { if (key.size() != crypto_shorthash_KEYBYTES) {
piCout << "[PICrypt]" << "invalid key size" << key.size() << ", shoud be" << crypto_shorthash_KEYBYTES << ", filled zeros"; piCout << "[PICrypt]" << "invalid key size" << key.size() << ", shoud be" << crypto_shorthash_KEYBYTES << ", filled zeros";
key.resize(crypto_shorthash_KEYBYTES, 0); key.resize(crypto_shorthash_KEYBYTES, 0);
@@ -176,7 +176,7 @@ ullong PICrypt::shorthash(const PIString& s, PIByteArray key) {
PIByteArray PICrypt::generateKey() { PIByteArray PICrypt::generateKey() {
PIByteArray hash; PIByteArray hash;
#ifdef PIP_CRYPT #ifdef PIP_CRYPT
sodium_init(); if (!sodium_init()) return hash;
hash.resize(crypto_secretbox_KEYBYTES); hash.resize(crypto_secretbox_KEYBYTES);
randombytes_buf(hash.data(), hash.size()); randombytes_buf(hash.data(), hash.size());
#else #else
@@ -186,7 +186,7 @@ PIByteArray PICrypt::generateKey() {
} }
int PICrypt::sizeKey() { size_t PICrypt::sizeKey() {
#ifdef PIP_CRYPT #ifdef PIP_CRYPT
return crypto_secretbox_KEYBYTES; return crypto_secretbox_KEYBYTES;
#else #else
@@ -196,7 +196,7 @@ int PICrypt::sizeKey() {
} }
int PICrypt::sizeCrypt() { size_t PICrypt::sizeCrypt() {
#ifdef PIP_CRYPT #ifdef PIP_CRYPT
return crypto_secretbox_MACBYTES + crypto_secretbox_NONCEBYTES; return crypto_secretbox_MACBYTES + crypto_secretbox_NONCEBYTES;
#else #else

View File

@@ -61,10 +61,10 @@ public:
static PIByteArray generateKey(); static PIByteArray generateKey();
//! Returns key size //! Returns key size
static int sizeKey(); static size_t sizeKey();
//! Returns size which be added to data size in encryption process //! Returns size which be added to data size in encryption process
static int sizeCrypt(); static size_t sizeCrypt();
private: private:
PIByteArray nonce_, key_; PIByteArray nonce_, key_;

View File

@@ -115,7 +115,7 @@ public:
static _CVector filled(const Type & v) {_CVector vv; PIMV_FOR(i, 0) vv[i] = v; return vv;} static _CVector filled(const Type & v) {_CVector vv; PIMV_FOR(i, 0) vv[i] = v; return vv;}
private: private:
void resize(const Type & new_value = Type()) {for (int i = 0; i < Size; ++i) c[i] = new_value;} void resize(const Type & new_value = Type()) {for (uint i = 0; i < Size; ++i) c[i] = new_value;}
Type c[Size]; Type c[Size];

View File

@@ -42,7 +42,7 @@ PIStringList PISystemInfo::mountRoots() {
char letters[1024]; char letters[1024];
DWORD ll = GetLogicalDriveStrings(1023, letters); DWORD ll = GetLogicalDriveStrings(1023, letters);
PIString clet; PIString clet;
for (int i = 0; i < ll; ++i) { for (uint i = 0; i < ll; ++i) {
if (letters[i] == '\0') { if (letters[i] == '\0') {
if (clet.size_s() > 2) ret << clet.cutRight(1); if (clet.size_s() > 2) ret << clet.cutRight(1);
clet.clear(); clet.clear();
@@ -90,7 +90,7 @@ PIVector<PISystemInfo::MountInfo> PISystemInfo::mountInfo() {
char letters[1024], volname[1024], volfs[1024]; char letters[1024], volname[1024], volfs[1024];
DWORD ll = GetLogicalDriveStrings(1023, letters); DWORD ll = GetLogicalDriveStrings(1023, letters);
PIString clet; PIString clet;
for (int i = 0; i < ll; ++i) { for (DWORD i = 0; i < ll; ++i) {
if (letters[i] == '\0') { if (letters[i] == '\0') {
if (GetVolumeInformation(clet.data(), volname, 1023, 0, 0, 0, volfs, 1023)) { if (GetVolumeInformation(clet.data(), volname, 1023, 0, 0, 0, volfs, 1023)) {
m.mount_point = clet; m.mount_point = clet;

View File

@@ -152,10 +152,10 @@ void PISystemMonitor::run() {
THREADENTRY32 thread; THREADENTRY32 thread;
thread.dwSize = sizeof(THREADENTRY32); thread.dwSize = sizeof(THREADENTRY32);
if (Thread32First(snap, &thread) == TRUE) { if (Thread32First(snap, &thread) == TRUE) {
if (thread.th32OwnerProcessID == pID_) if (thread.th32OwnerProcessID == DWORD(pID_))
++thcnt; ++thcnt;
while (Thread32Next(snap, &thread) == TRUE) { while (Thread32Next(snap, &thread) == TRUE) {
if (thread.th32OwnerProcessID == pID_) if (thread.th32OwnerProcessID == DWORD(pID_))
++thcnt; ++thcnt;
} }
} }

View File

@@ -254,7 +254,7 @@ void Daemon::TileFileProgress::tileEvent(PIScreenTile * t, TileEvent e) {
Daemon::Daemon(): inited__(false), PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_" + PIString(rand() % 100)) { Daemon::Daemon(): PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_" + PIString(rand() % 100)) {
// setName("Daemon"); // setName("Daemon");
dtimer.setName("__S__Daemon_timer"); dtimer.setName("__S__Daemon_timer");
mode = rmNone; mode = rmNone;

View File

@@ -182,7 +182,6 @@ private:
void requestChDir(const PIString & d); void requestChDir(const PIString & d);
void sendDirToRemote(Remote * r); void sendDirToRemote(Remote * r);
bool inited__;
mutable PIStringList available_daemons; mutable PIStringList available_daemons;
PITimer dtimer; PITimer dtimer;
PIString conn_name; PIString conn_name;