Is there any replacement for memcpy in iOS? So far as I know, memcpy is not 'safe', and the suggested alternative is 'memcpy_s'
But, code fail to compile due to 'Undefined symbols for architecture armv7:' problem, after replacing memcpy with memcpy_s.
How can I fix this problem? How to setup the project settings? Any help will be appreciated.
Some code from AsyncSocket.m:
- (CFIndex)readIntoBuffer:(UInt8 *)buffer maxLength:(CFIndex)length
{
if([_partialReadBuffer length] > 0)
{
// Determine the maximum amount of data to read
CFIndex bytesToRead = MIN(length, [_partialReadBuffer length]);
// Copy the bytes from the buffer
memcpy(buffer, [_partialReadBuffer bytes], bytesToRead);
// Remove the copied bytes from the buffer
[_partialReadBuffer replaceBytesInRange:NSMakeRange(0, bytesToRead) withBytes:NULL length:0];
return bytesToRead;
}
else
{
return CFReadStreamRead(_theReadStream, buffer, length);
}
}