I'm relatively new to Cocoa and Objective-c and I'm currently developing my first application, which is a simple backup utility.
I'm quite pleased at the progress I've made but I've run into a problem I can't seem to figure out regarding the sizes of the files/folders which are to backed up.
The way the application works is that whenever the user adds a file/folder to be backed up an object of my custom class type is added to an array. My custom class is extremely simple as it only holds 4 pieces of information regarding the file, which are the filename, it's path, it's icon and it's size.
Everything woks fine except setting the size of the file/folder using its accessor method. The method used is:
The file size passed in the above method is determined by the following:
then setBackupFileSize is called by:
where newFile is of my custom class type.
The problem I'm having is that I'm getting the following compiler warnings which either set the file/folder size to 0 at runtime or it just crashes the app.
The warnings are:
warning: cast to pointer from integer of different size
warning: invalid receiver type 'long long unsigned int'
warning: assignment makes integer from pointer without a cast
which are all for the 3rd and 4th lines in the setBackupFileSize method.
This has been driving me nuts so any help would be greatly appreciated.
Stu
I'm quite pleased at the progress I've made but I've run into a problem I can't seem to figure out regarding the sizes of the files/folders which are to backed up.
The way the application works is that whenever the user adds a file/folder to be backed up an object of my custom class type is added to an array. My custom class is extremely simple as it only holds 4 pieces of information regarding the file, which are the filename, it's path, it's icon and it's size.
Everything woks fine except setting the size of the file/folder using its accessor method. The method used is:
Code:
- (void)setBackupFileSize:(unsigned long long)bytesSize
{
if (backupFileSize != bytesSize) {
[backupFileSize release];
backupFileSize = [bytesSize retain];
}
}
The file size passed in the above method is determined by the following:
Code:
NSDictionary *infoDict = [[NSFileManager defaultManager] fileSystemAttributesAtPath:[panel filename]];
then setBackupFileSize is called by:
Code:
[newFile setBackupFileSize:[[NSNumber numberWithLongLong:[infoDict fileSize]] unsignedLongLongValue]];
where newFile is of my custom class type.
The problem I'm having is that I'm getting the following compiler warnings which either set the file/folder size to 0 at runtime or it just crashes the app.
The warnings are:
warning: cast to pointer from integer of different size
warning: invalid receiver type 'long long unsigned int'
warning: assignment makes integer from pointer without a cast
which are all for the 3rd and 4th lines in the setBackupFileSize method.
This has been driving me nuts so any help would be greatly appreciated.
Stu