c和objective-c – const char *和char *

我有一个function:

-(void)ADPCMDecode:(char *)indata : (short *)outdata :(long)len { 

indata是一个char,函数做指针算术迭代一段len,修改outdata,这是一个简短的,我需要做指针运算来从中获取值。

我试图使用以下方法调用该函数:

 const char *modulatedBytes1 = [modulatedAudio bytes]; char *modulatedBytes [] = modulatedBytes1; unsigned int moduleatedLength = [modulatedAudio length]; short *decompressedBytes = NULL; [self ADPCMDecode:modulatedBytes :decompressedBytes :moduleatedLength]; DLog(@"%hi",decompressedBytes[1]); 

我在这一行得到了一个BAD ACCESS错误: *outp++ = valprev; 在函数内,因为我传递一个constant char *而不是char *

我应该如何调用该函数,以及如何从中获取输出? 我没有C的背景,这就是为什么我不明白如何去做这个。

以下是同一问题的C唯一版本: https : //pastee.org/d3y3z