일부 objective-c 코드 (Mac)를 C++ 코드 (win)로 이식하려고합니다. 그러나, 나는 문제가있다. 맥에서 내 데이터는 NSMutableData 객체로 들어오고 윈도우에서는 uint8_t 배열로 온다. 내 uint8_t 데이터를 NSMutableData 내부의 동일한 유형의 데이터로 변환해야합니다. 도움!uint8_t 배열을 NSMutableData로 변환하는 데 도움이 필요합니다.
//on the mac
foo(NSMutableData* received)
{
void* data = malloc([received length]);
memcpy(data, [received mutableBytes], [received length]);
bar(data);
}
//on windows
foo(const boost::shared_array<uint8_t>& received)
{
void* data = ... //magic needs to happen here
bar(data);
}