[cig-commits] commit: Add casting for C++
Mercurial
hg at geodynamics.org
Fri May 13 08:10:14 PDT 2011
changeset: 801:50fbc6957715
tag: tip
user: Walter Landry <wlandry at caltech.edu>
date: Fri May 13 08:08:48 2011 -0700
files: Base/Container/src/AbsArray.cxx Base/Container/src/STreeMap.cxx pcu/src/test.cxx
description:
Add casting for C++
diff -r 85b95c27409f -r 50fbc6957715 Base/Container/src/AbsArray.cxx
--- a/Base/Container/src/AbsArray.cxx Fri May 13 06:15:22 2011 -0700
+++ b/Base/Container/src/AbsArray.cxx Fri May 13 08:08:48 2011 -0700
@@ -125,7 +125,7 @@ void AbsArray_Push( void* _self, void* i
AbsArray_Resize( self, self->size + 1 );
else
self->size++;
- memcpy( self->ptr + self->size - 1, itm, self->itmSize );
+ memcpy( (char*)(self->ptr) + self->size - 1, itm, self->itmSize );
}
void AbsArray_Set( void* _self, void* itm ) {
@@ -133,7 +133,7 @@ void AbsArray_Set( void* _self, void* it
int i_i;
for( i_i = 0; i_i < self->size; i_i++ )
- memcpy( self->ptr + i_i, itm, self->itmSize );
+ memcpy( (char*)(self->ptr) + i_i, itm, self->itmSize );
}
void AbsArray_Clear( void* _self ) {
diff -r 85b95c27409f -r 50fbc6957715 Base/Container/src/STreeMap.cxx
--- a/Base/Container/src/STreeMap.cxx Fri May 13 06:15:22 2011 -0700
+++ b/Base/Container/src/STreeMap.cxx Fri May 13 08:08:48 2011 -0700
@@ -96,7 +96,7 @@ void* STreeMap_Map( const void* _self, c
while( node && (res = self->cmp( key, node->data )) )
node = (res < 0) ? node->left : node->right;
assert( node );
- return node->data + self->keySize;
+ return (char*)(node->data) + self->keySize;
}
Bool STreeMap_HasKey( const void* _self, const void* key ) {
diff -r 85b95c27409f -r 50fbc6957715 pcu/src/test.cxx
--- a/pcu/src/test.cxx Fri May 13 06:15:22 2011 -0700
+++ b/pcu/src/test.cxx Fri May 13 08:08:48 2011 -0700
@@ -133,7 +133,7 @@ void pcu_test_gathersources( pcu_test_t*
ptr = buf;
while( test->srcs ) {
pcu_source_pack( test->srcs, ptr );
- ptr += pcu_source_getPackLen( test->srcs );
+ ptr = (char*)ptr + pcu_source_getPackLen( test->srcs );
cur = test->srcs->next;
pcu_source_clear( test->srcs );
free( test->srcs );
@@ -171,12 +171,12 @@ void pcu_test_gathersources( pcu_test_t*
/* Unpack sources into the list. */
ptr = totalbuf;
- while( ptr < totalbuf + totalsize ) {
+ while( (char*)ptr < (char*)totalbuf + totalsize ) {
cur = (pcu_source_t*)malloc( sizeof(pcu_source_t) );
pcu_source_init( cur );
pcu_source_unpack( cur, ptr );
cur->test = test;
- ptr += pcu_source_getPackLen( cur );
+ ptr = (char*)ptr + pcu_source_getPackLen( cur );
pcu_test_addSource( test, cur );
}
More information about the CIG-COMMITS
mailing list