1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
--- src/arch/Threads/Threads_Pthreads.cpp.old 2006-10-24 22:01:54.000000000 +0200
+++ src/arch/Threads/Threads_Pthreads.cpp 2006-10-24 22:08:35.000000000 +0200
@@ -39,12 +39,14 @@
int ThreadImpl_Pthreads::Wait()
{
- void *val;
- int ret = pthread_join( thread, &val );
+ int *val;
+ int ret = pthread_join( thread, (void **)&val );
if( ret )
- RageException::Throw( "pthread_join: %s", strerror(errno) );
+ RageException::Throw( "pthread_join: %s", strerror(ret) );
- return (int) val;
+ int iRet = *val;
+ delete val;
+ return iRet;
}
ThreadImpl *MakeThisThread()
@@ -67,7 +69,8 @@
/* Tell MakeThread that we've set m_piThreadID, so it's safe to return. */
pThis->m_StartFinishedSem->Post();
- return (void *) pThis->m_pFunc( pThis->m_pData );
+ int iRet = pThis->m_pFunc( pThis->m_pData );
+ return new int(iRet);
}
ThreadImpl *MakeThread( int (*pFunc)(void *pData), void *pData, uint64_t *piThreadID )
--- src/crypto51/misc.h.old 2006-10-24 22:17:51.000000000 +0200
+++ src/crypto51/misc.h 2006-10-24 23:13:30.000000000 +0200
@@ -142,7 +142,7 @@
inline bool IsAlignedOn(const void *p, unsigned int alignment)
{
- return IsPowerOf2(alignment) ? ModPowerOf2((unsigned int)p, alignment) == 0 : (unsigned int)p % alignment == 0;
+ return IsPowerOf2(alignment) ? ModPowerOf2((uintptr_t)p, alignment) == 0 : (uintptr_t)p % alignment == 0;
}
template <class T>
--- src/crypto51/misc.cpp.old 2006-10-24 23:28:55.000000000 +0200
+++ src/crypto51/misc.cpp 2006-10-24 23:30:19.000000000 +0200
@@ -16,7 +16,7 @@
void xorbuf(byte *buf, const byte *mask, unsigned int count)
{
- if (((unsigned int)buf | (unsigned int)mask | count) % WORD_SIZE == 0)
+ if (((uintptr_t)buf | (uintptr_t)mask | count) % WORD_SIZE == 0)
XorWords((word *)buf, (const word *)mask, count/WORD_SIZE);
else
{
@@ -27,7 +27,7 @@
void xorbuf(byte *output, const byte *input, const byte *mask, unsigned int count)
{
- if (((unsigned int)output | (unsigned int)input | (unsigned int)mask | count) % WORD_SIZE == 0)
+ if (((uintptr_t)output | (uintptr_t)input | (uintptr_t)mask | count) % WORD_SIZE == 0)
XorWords((word *)output, (const word *)input, (const word *)mask, count/WORD_SIZE);
else
{
|