Cast size_t to int before negating it, to silence warnings
authorPhil Miller <mille121@illinois.edu>
Fri, 6 May 2011 18:50:35 +0000 (13:50 -0500)
committerPhil Miller <mille121@illinois.edu>
Fri, 6 May 2011 18:51:30 +0000 (13:51 -0500)
We can be pretty confident that the size of the two structs will be in
int's range, so the cast will preserve its value.

src/conv-com/petable.C

index 97e16e6d7c597c6c186f08bfd16901a7ea0a65a1..8c46b5712136c8917d0b7e3edcf7fa8c458f5764 100644 (file)
@@ -653,7 +653,7 @@ PTvectorlist PeTable :: ExtractAndVectorize(comID id, int ufield, int npe, int *
   result->msgs  = (char**)((char*)result->sizes + (npacked+1)*sizeof(int) + sizeof(CmiChunkHeader));
 
   SIZEFIELD(result->sizes) = (npacked+1)*sizeof(int);
-  REFFIELD(result->sizes) = - (sizeof(struct ptvectorlist) + sizeof(CmiChunkHeader));
+  REFFIELD(result->sizes) = - (int)(sizeof(struct ptvectorlist) + sizeof(CmiChunkHeader));
   SIZEFIELD(result->msgs) = (npacked+1)*sizeof(int);
   REFFIELD(result->msgs) = - (sizeof(struct ptvectorlist) + (npacked+1)*sizeof(int) + 2*sizeof(CmiChunkHeader));
   CmiReference(result);
@@ -759,7 +759,7 @@ PTvectorlist PeTable :: ExtractAndVectorizeAll(comID id, int ufield) {
   result->msgs  = (char**)((char*)result->sizes + (nmsgs+1)*sizeof(int) + sizeof(CmiChunkHeader));
 
   SIZEFIELD(result->sizes) = (nmsgs+1)*sizeof(int);
-  REFFIELD(result->sizes) = - (sizeof(struct ptvectorlist) + sizeof(CmiChunkHeader));
+  REFFIELD(result->sizes) = - (int)(sizeof(struct ptvectorlist) + sizeof(CmiChunkHeader));
   SIZEFIELD(result->msgs) = (nmsgs+1)*sizeof(int);
   REFFIELD(result->msgs) = - (sizeof(struct ptvectorlist) + (nmsgs+1)*sizeof(int) + 2*sizeof(CmiChunkHeader));
   CmiReference(result);