git-svn-id: svn://db.shs.com.ru/pip@669 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -272,7 +272,7 @@ void PIKbdListener::readKeyboard() {
|
||||
MouseButtons mb = getButtons(mer.dwButtonState);
|
||||
//me.action = getButtons(mer.dwButtonState);
|
||||
if (mer.dwEventFlags & MOUSE_WHEELED) {
|
||||
memcpy(&we, &me, sizeof(me));
|
||||
memcpy((void*)(&we), (const void*)(&me), sizeof(me));
|
||||
we.action = MouseWheel;
|
||||
we.direction = short((mer.dwButtonState >> 8) & 0xFFFF) > 0;
|
||||
//piCout << "wheel" << we.direction;
|
||||
@@ -305,7 +305,7 @@ void PIKbdListener::readKeyboard() {
|
||||
me.buttons = mb;
|
||||
if (piCompareBinary(&prev_me, &me, sizeof(me)))
|
||||
break;
|
||||
memcpy(&prev_me, &me, sizeof(me));
|
||||
memcpy((void*)(&prev_me), (const void*)(&me), sizeof(me));
|
||||
//PIString _s[] = {"press", "release", "dbl click", "move"};
|
||||
//piCoutObj << _s[me.action] << me.buttons << ":" << me.x << me.y;
|
||||
mouseEvent(me, kbddata_);
|
||||
@@ -363,7 +363,7 @@ void PIKbdListener::readKeyboard() {
|
||||
me.y = uchar(rc[5] - '!');
|
||||
int b = rc[3] & 0x7, a = rc[3] & 0x60;
|
||||
if (a == 0x60) {
|
||||
memcpy(&we, &me, sizeof(me));
|
||||
memcpy((void*)(&we), (const void*)(&me), sizeof(me));
|
||||
we.action = MouseWheel;
|
||||
we.direction = (b == 0);
|
||||
//piCout << "wheel" << we.direction;
|
||||
|
||||
@@ -235,13 +235,13 @@ public:
|
||||
alloc(pid_size + 1, true);
|
||||
if (index < pid_size - 1) {
|
||||
size_t os = pid_size - index - 1;
|
||||
memmove(&(pid_data[index + pid_start + 1]), &(pid_data[index + pid_start]), os * sizeof(T));
|
||||
memmove((void*)(&(pid_data[index + pid_start + 1])), (const void*)(&(pid_data[index + pid_start])), os * sizeof(T));
|
||||
}
|
||||
} else {
|
||||
alloc(pid_size + 1, false, -1);
|
||||
//piCout << "insert front" << pid_size << pid_rsize << pid_start << "!<";
|
||||
if (index > 0)
|
||||
memmove(&(pid_data[pid_start]), &(pid_data[pid_start + 1]), index * sizeof(T));
|
||||
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + 1])), index * sizeof(T));
|
||||
}
|
||||
//piCout << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
|
||||
PIINTROSPECTION_CONTAINER_USED(sizeof(T))
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
ssize_t os = pid_size - index;
|
||||
alloc(pid_size + other.pid_size, true);
|
||||
if (os > 0)
|
||||
memmove(&(pid_data[index + pid_start + other.pid_size]), &(pid_data[index + pid_start]), os * sizeof(T));
|
||||
memmove((void*)(&(pid_data[index + pid_start + other.pid_size])), (const void*)(&(pid_data[index + pid_start])), os * sizeof(T));
|
||||
} else {
|
||||
//if (pid_start < other.pid_size) pid_start = 0;
|
||||
//piCout << this << " insert offseted start ba" << pid_start << pid_size << pid_rsize;
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
//piCout << this << " insert offseted start aa" << pid_start << pid_size << pid_rsize;
|
||||
//piCout << this << " insert front" << pid_size << pid_rsize << pid_start << "!<";
|
||||
if (index > 0)
|
||||
memmove(&(pid_data[pid_start]), &(pid_data[pid_start + other.pid_size]), index * sizeof(T));
|
||||
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + other.pid_size])), index * sizeof(T));
|
||||
}
|
||||
//piCout << this << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
|
||||
newT(pid_data + pid_start + index, other.pid_data + other.pid_start, other.pid_size);
|
||||
@@ -281,9 +281,9 @@ public:
|
||||
deleteT(&(pid_data[index + pid_start]), count);
|
||||
if (os <= index) {
|
||||
//if (true) {
|
||||
if (os > 0) memmove(&(pid_data[index + pid_start]), &(pid_data[index + pid_start + count]), os * sizeof(T));
|
||||
if (os > 0) memmove((void*)(&(pid_data[index + pid_start])), (const void*)(&(pid_data[index + pid_start + count])), os * sizeof(T));
|
||||
} else {
|
||||
if (index > 0) memmove(&(pid_data[pid_start + count]), &(pid_data[pid_start]), index * sizeof(T));
|
||||
if (index > 0) memmove((void*)(&(pid_data[pid_start + count])), (const void*)(&(pid_data[pid_start])), index * sizeof(T));
|
||||
pid_start += count;
|
||||
}
|
||||
pid_size -= count;
|
||||
@@ -424,7 +424,7 @@ private:
|
||||
ssize_t ns = (pid_rsize - pid_size) / 2;
|
||||
if (pid_start != ns) {
|
||||
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
|
||||
memmove(pid_data + ns, pid_data + pid_start, pid_size * sizeof(T));
|
||||
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
|
||||
pid_start = ns;
|
||||
}
|
||||
}
|
||||
@@ -433,7 +433,7 @@ private:
|
||||
ssize_t ns = (pid_rsize - pid_size) / 2;
|
||||
if (pid_start != ns) {
|
||||
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
|
||||
memmove(pid_data + ns, pid_data + pid_start, pid_size * sizeof(T));
|
||||
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
|
||||
pid_start = ns;
|
||||
}
|
||||
}
|
||||
@@ -450,7 +450,7 @@ private:
|
||||
if (as != pid_rsize) {
|
||||
//printf("(%p) realloc %d -> %d (%p)\n", this, pid_rsize, as, pid_data);
|
||||
PIINTROSPECTION_CONTAINER_ALLOC((as-pid_rsize)*sizeof(T))
|
||||
T * p_d = (T*)(realloc(pid_data, as*sizeof(T)));
|
||||
T * p_d = (T*)(realloc((void*)(pid_data), as*sizeof(T)));
|
||||
assert(p_d);
|
||||
pid_data = p_d;
|
||||
pid_rsize = as;
|
||||
@@ -473,7 +473,7 @@ private:
|
||||
PIINTROSPECTION_CONTAINER_ALLOC((as-pid_rsize)*sizeof(T))
|
||||
if (pid_rsize > 0 && pid_data != 0) {
|
||||
//printf("%X copy from %p + %d to %p + %d %d el\n", this, pid_data, pid_start, td, ns, pid_size);
|
||||
memcpy(td + ns, pid_data + pid_start, pid_size * sizeof(T));
|
||||
memcpy((void*)(td + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
|
||||
deleteRaw(pid_data);
|
||||
}
|
||||
pid_data = td;
|
||||
@@ -495,7 +495,7 @@ private:
|
||||
};
|
||||
|
||||
#define __PIDEQUE_SIMPLE_TYPE__(T) \
|
||||
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(s*sizeof(T)); memcpy(dst, src, s * sizeof(T));} \
|
||||
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
|
||||
template<> inline void PIDeque<T>::deleteT(T * d, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(sz*sizeof(T));} \
|
||||
template<> inline void PIDeque<T>::elementNew(T * to, const T & from) {(*to) = from;} \
|
||||
template<> inline void PIDeque<T>::elementDelete(T & from) {;} \
|
||||
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
alloc(piv_size + 1);
|
||||
if (index < piv_size - 1) {
|
||||
size_t os = piv_size - index - 1;
|
||||
memmove(&(piv_data[index + 1]), &(piv_data[index]), os * sizeof(T));
|
||||
memmove((void*)(&(piv_data[index + 1])), (const void*)(&(piv_data[index])), os * sizeof(T));
|
||||
}
|
||||
//zeroRaw(&(piv_data[index]), 1);
|
||||
elementNew(piv_data + index, v);
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
ssize_t os = piv_size - index;
|
||||
alloc(piv_size + other.piv_size);
|
||||
if (os > 0)
|
||||
memmove(&(piv_data[index + other.piv_size]), &(piv_data[index]), os * sizeof(T));
|
||||
memmove((void*)(&(piv_data[index + other.piv_size])), (const void*)(&(piv_data[index])), os * sizeof(T));
|
||||
newT(piv_data + index, other.piv_data, other.piv_size);
|
||||
return *this;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
}
|
||||
size_t os = piv_size - index - count;
|
||||
deleteT(&(piv_data[index]), count);
|
||||
memmove(&(piv_data[index]), &(piv_data[index + count]), os * sizeof(T));
|
||||
memmove((void*)(&(piv_data[index])), (const void*)(&(piv_data[index + count])), os * sizeof(T));
|
||||
piv_size -= count;
|
||||
return *this;
|
||||
}
|
||||
@@ -360,7 +360,7 @@ private:
|
||||
if (as == piv_rsize) return;
|
||||
|
||||
//cout << std::hex << " ![("<<this<<")realloc " << piv_data << " data ... <\n" << endl;
|
||||
T * p_d = (T*)(realloc(piv_data, as*sizeof(T)));
|
||||
T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T)));
|
||||
assert(p_d);
|
||||
piv_data = p_d;
|
||||
//zeroRaw(&(piv_data[os]), as - os);
|
||||
@@ -432,7 +432,7 @@ __PIVECTOR_SIMPLE_FUNCTIONS__(float)
|
||||
__PIVECTOR_SIMPLE_FUNCTIONS__(double)
|
||||
__PIVECTOR_SIMPLE_FUNCTIONS__(ldouble)*/
|
||||
#define __PIVECTOR_SIMPLE_TYPE__(T) \
|
||||
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {memcpy(dst, src, s * sizeof(T));} \
|
||||
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
|
||||
template<> inline void PIVector<T>::deleteT(T * d, size_t sz) {;} \
|
||||
template<> inline void PIVector<T>::elementNew(T * to, const T & from) {(*to) = from;} \
|
||||
template<> inline void PIVector<T>::elementDelete(T & from) {;} \
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
#define PRIVATE_DEFINITION_END(c) \
|
||||
}; \
|
||||
c::__PrivateInitializer__::__PrivateInitializer__() {p = new c::__Private__();} \
|
||||
c::__PrivateInitializer__::__PrivateInitializer__(const c::__PrivateInitializer__ & o) {if (p) delete p; p = new c::__Private__();} \
|
||||
c::__PrivateInitializer__::__PrivateInitializer__(const c::__PrivateInitializer__ & o) {/*if (p) delete p;*/ p = new c::__Private__();} \
|
||||
c::__PrivateInitializer__::~__PrivateInitializer__() {delete p; p = 0;} \
|
||||
c::__PrivateInitializer__ & c::__PrivateInitializer__::operator =(const c::__PrivateInitializer__ & o) {if (p) delete p; p = new c::__Private__(); return *this;}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ inline PIByteArray & operator <<(PIByteArray & s, const PIByteArray & v) {s << i
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIByteArray::RawData & v) {int os = s.size_s(); s.enlarge(v.s); if (v.s > 0) memcpy(s.data(os), v.d, v.s); return s;}
|
||||
|
||||
#undef PBA_OPERATOR_TO
|
||||
#define PBA_OPERATOR_FROM memcpy(&v, s.data(), sizeof(v)); s.remove(0, sizeof(v));
|
||||
#define PBA_OPERATOR_FROM memcpy((void*)(&v), s.data(), sizeof(v)); s.remove(0, sizeof(v));
|
||||
|
||||
//! \relatesalso PIByteArray \brief Restore operator
|
||||
inline PIByteArray & operator >>(PIByteArray & s, bool & v) {assert(s.size() >= 1u); v = s.take_front(); return s;}
|
||||
@@ -212,7 +212,7 @@ template<typename T> inline PIByteArray & operator >>(PIByteArray & s, PIFlags<T
|
||||
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray & v) {assert(s.size_s() >= 4); int sz; s >> sz; v.resize(sz); if (sz > 0) memcpy(v.data(), s.data(), v.size()); s.remove(0, v.size()); return s;}
|
||||
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {assert(s.size_s() >= v.s); if (v.s > 0) memcpy(v.d, s.data(), v.s); s.remove(0, v.s); return s;}
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {assert(s.size_s() >= v.s); if (v.s > 0) memcpy((void*)(v.d), s.data(), v.s); s.remove(0, v.s); return s;}
|
||||
|
||||
|
||||
template<typename Type0, typename Type1> inline PIByteArray & operator <<(PIByteArray & s, const PIPair<Type0, Type1> & v);
|
||||
|
||||
Reference in New Issue
Block a user