WhatMeWorry
2005.01.13, 01:45 PM
My C legs aren't what the used to be. This straightforward C function
is giving me fits when I try to bring it over to my Codewarrior (ANSI?)
C compiler.
Codewarrior is complaining about an "illegal type" for the second parameter
of the memcpy.
memcpy(rowBuffer, image, rowSize);
compiles fine, so it is probably the pointer/address arthmetic? Or the const
void * of the second parameter? Whatever it is I can't work around it
and I've tried alot of things: Casting, moving image into a const void *,
replacing the pointer form with an array index.
It's been an hour and a half and I figured somebody can probably take a look
and find a solution in 30 seconds. You'll be saving alot of my hair.
thanks.
void flipImageY(void * image, int rowSize, int rowCount)
{
int rowIndex, halfHeight;
void * rowBuffer;
rowBuffer = malloc(rowSize);
halfHeight = (rowCount / 2);
for (rowIndex = 0; rowIndex < halfHeight; rowIndex++)
{
memcpy(rowBuffer, (image + (rowIndex * rowSize)), rowSize);
// other memcpys cut out for simplicity, but same problem as above
}
free(rowBuffer);
}
is giving me fits when I try to bring it over to my Codewarrior (ANSI?)
C compiler.
Codewarrior is complaining about an "illegal type" for the second parameter
of the memcpy.
memcpy(rowBuffer, image, rowSize);
compiles fine, so it is probably the pointer/address arthmetic? Or the const
void * of the second parameter? Whatever it is I can't work around it
and I've tried alot of things: Casting, moving image into a const void *,
replacing the pointer form with an array index.
It's been an hour and a half and I figured somebody can probably take a look
and find a solution in 30 seconds. You'll be saving alot of my hair.
thanks.
void flipImageY(void * image, int rowSize, int rowCount)
{
int rowIndex, halfHeight;
void * rowBuffer;
rowBuffer = malloc(rowSize);
halfHeight = (rowCount / 2);
for (rowIndex = 0; rowIndex < halfHeight; rowIndex++)
{
memcpy(rowBuffer, (image + (rowIndex * rowSize)), rowSize);
// other memcpys cut out for simplicity, but same problem as above
}
free(rowBuffer);
}