Thanks, in the meantime I realized that I had to change imagePtr from int into an NSInteger. Now it works. Do you think it is ok?
#define kDepth 32 NSInteger oneImageSize = width * height * (kDepth >> 3); Handle imagesH = NewHandleClear(totImages * oneImageSize); NSInteger *imagePtr = malloc(totImages * sizeof(NSInteger)); NSInteger baseH = *(NSInteger*)(imageBaseH); for(i = 0; i < totImages ; i++){ imagePtr[i] = (baseH + (i * oneImageSize)); imageData = [imagesArray objectAtIndex:i]; [self LoadImageData:imageData pointer:(void*)imagePtr[i] h:height]; } > Da: Mike Abdullah <cocoa...@mikeabdullah.net> > Data: Mon, 14 Dec 2009 18:41:58 +0000 > A: "gMail.com" <mac.iphone....@gmail.com> > Cc: <cocoa-dev@lists.apple.com> > Oggetto: Re: memcpy with 64 bit > > Have you read the 64 bit transition guide? > http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Cocoa64B > itGuide/Introduction/Introduction.html > Your question (use of int) suggests not. > > On 14 Dec 2009, at 18:27, gMail.com wrote: > >> Hi, >> if I compile this code against "32-bits Universal", it works. >> If I compile this code against "64-bit Intel", it doesn't work. >> I get a bad access error just on memcpy. What do I miss? I use: >> >> Base SDK 10.6 >> i386 ppc ppc64 ppc7400 ppc970 x86_64 >> GCC 4.2 or 4.0 >> Target Mac OS X 10.6 >> Active Architecture x86_64 >> >> - (void)LoadImageData:(NSData*)imageData >> pointer:(void*)handle >> h:(GLuint)imageHeight >> { >> NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] >> initWithData:imageData]; >> int bytesPRow = [bitmap bytesPerRow]; >> unsigned char *theImageData = [bitmap bitmapData]; >> int rowNum; >> >> for(rowNum = 0; rowNum < imageHeight; rowNum++){ >> memcpy(handle + (rowNum * bytesPRow), >> theImageData + (rowNum * bytesPRow), bytesPRow); >> } >> >> [bitmap release]; >> } >> >> >> Best Regards >> -- >> Leonardo >> >> >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net >> >> This email sent to cocoa...@mikeabdullah.net > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com