version 4.5.0
PIThread::stopAndWait now returns bool PIKbdListener on Linux now use piwaitevent_p and can immediately stop new base method piZeroMemory, also migrate all "memset 0" to piZeroMemory
This commit is contained in:
@@ -558,6 +558,23 @@ inline uint piHash(const ldouble & v) {
|
||||
return piHashData((const uchar *)&v, sizeof(v));
|
||||
}
|
||||
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Zero "size" bytes by address "ptr".
|
||||
//! \~russian Зануляет "size" байт по адресу "ptr".
|
||||
inline void piZeroMemory(void * ptr, size_t size) {
|
||||
memset(ptr, 0, size);
|
||||
}
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Zero variable "v" memory.
|
||||
//! \~russian Зануляет память переменной "v".
|
||||
template<typename T>
|
||||
inline void piZeroMemory(T & v) {
|
||||
piZeroMemory(&v, sizeof(v));
|
||||
}
|
||||
|
||||
|
||||
//! \~\brief
|
||||
//! \~english Call \b delete on each "container" element.
|
||||
//! \~russian Вызывает \b delete на каждый элемент "container".
|
||||
|
||||
@@ -167,7 +167,7 @@ PIInit::PIInit() {
|
||||
for (l = 0; l < MAX_PATH; ++l)
|
||||
if (cpinfo.CodePageName[l] == '\0' || cpinfo.CodePageName[l] == ' ') break;
|
||||
__sysoemname__ = new char[256];
|
||||
memset(__sysoemname__, 0, 256);
|
||||
piZeroMemory(__sysoemname__, 256);
|
||||
memcpy(__sysoemname__, "ibm-", 4);
|
||||
memcpy(&(__sysoemname__[4]), cpinfo.CodePageName, l);
|
||||
# else
|
||||
@@ -190,7 +190,7 @@ PIInit::PIInit() {
|
||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
|
||||
# endif
|
||||
char cbuff[1024];
|
||||
memset(cbuff, 0, 1024);
|
||||
piZeroMemory(cbuff, 1024);
|
||||
if (gethostname(cbuff, 1023) == 0) {
|
||||
sinfo->hostname = cbuff;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ PIInit::PIInit() {
|
||||
wchar_t ** argv_ = CommandLineToArgvW(GetCommandLineW(), &argc_);
|
||||
if (argc_ > 0 && argv_ != 0) sinfo->execCommand = argv_[0];
|
||||
LocalFree(argv_);
|
||||
memset(cbuff, 0, 1024);
|
||||
piZeroMemory(cbuff, 1024);
|
||||
ulong unlen = 1023;
|
||||
if (GetUserNameA(cbuff, &unlen) != 0) sinfo->user = cbuff;
|
||||
# else // WINDOWS
|
||||
@@ -219,7 +219,7 @@ PIInit::PIInit() {
|
||||
if (ps)
|
||||
sinfo->user = ps->pw_name;
|
||||
else {
|
||||
memset(cbuff, 0, 1024);
|
||||
piZeroMemory(cbuff, 1024);
|
||||
char * l = getlogin();
|
||||
if (l) sinfo->user = l;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void PIWaitEvent::create() {
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i < 3; ++i)
|
||||
memset(&(fds[i]), 0, sizeof(fds[i]));
|
||||
piZeroMemory(fds[i]);
|
||||
if (::pipe(pipe_fd) < 0) {
|
||||
piCout << "Error with pipe:" << errorString();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user