Issue
In GCC I got the following error:
aes.c: In function ‘copy_block’:
aes.c:278: error: lvalue required as increment operand
aes.c:278: error: lvalue required as increment operand
This is the piece of code:
static void copy_block( void * d, void *s, uint_8t nn )
{
while( nn-- )
*((uint_8t*)d)++ = *((uint_8t*)s)++;
}
I tried to change it to a compileable version, but unfortunately for me as a Java programmer, it's not clear what is really happening here.
Maybe someone has an idea how I can change the source that it is compileable in GCC or someone has an idea what is happening here in detail. For me it seems wierd with the dereferencing of the left hand value, but somehow it seems to work perfectly in Visual C++.
This is a small legacy program, which I have to port to a Linux machine.
thank you for your help in advance.
Solution
Try this:
#include <string.h>
static void copy_block( void * d, void *s, uint_8t nn ) {
memcpy(d, s, (size_t)nn);
}
What's being done there isn't good.
Answered By - sje397 Answer Checked By - Clifford M. (WPSolving Volunteer)