Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Semantic Issue: Incompatible pointer to integer conversion sending 'NSUInteger *' (aka 'unsigned int *') to parameter of type 'NSUInteger'

So I get this warning :

Semantic Issue: Incompatible pointer to integer conversion sending 'NSUInteger *' (aka 'unsigned int *') to parameter of type 'NSUInteger' (aka 'unsigned int') 

Basically i am pulling in a JSON feed.. looping through it to match columns up with data, then place the data in an object to be used in a table row...

NSDictionary *js_result = [response JSONValue];

NSLog(@"This is the LIST: %@",[js_result objectForKey:@"LIST"]);
//  get columns
NSArray *columns = [[js_result objectForKey:@"LIST"] componentsSeparatedByString:@","];
//  get data
NSArray *rows = [[js_result objectForKey:@"QUERY"] objectForKey:@"DATA"];



NSUInteger *study_id_int = (NSUInteger *)[columns indexOfObject:@"STUDY_ID_DICOM"];
NSUInteger *study_desc_int = (NSUInteger *)[columns indexOfObject:@"STUDY_DESCRIPTION"];
NSUInteger *study_date_int = (NSUInteger *)[columns indexOfObject:@"STUDY_DATETIME"];
NSUInteger *modality_int = (NSUInteger *)[columns indexOfObject:@"MODALITY"];
NSUInteger *referring_physician_name_int = (NSUInteger *)[columns indexOfObject:@"REFERRING_PHYSICIANS_NAME"];
NSUInteger *patient_id_dicom_int = (NSUInteger *)[columns indexOfObject:@"PATIENT_ID_DICOM"];
NSUInteger *patient_name_int = (NSUInteger *)[columns indexOfObject:@"PATIENT_NAME"];
NSUInteger *birth_date_int = (NSUInteger *)[columns indexOfObject:@"BIRTH_DATE"];
NSUInteger *institution_name_int = (NSUInteger *)[columns indexOfObject:@"INSTITUTION_NAME"];
NSUInteger *study_recvd_datetime_int = (NSUInteger *)[columns indexOfObject:@"STUDY_RECVD_DATETIME"];
NSUInteger *image_count_int = (NSUInteger *)[columns indexOfObject:@"Image_Count"];
NSUInteger *patient_study_count_int = (NSUInteger *)[columns indexOfObject:@"PATIENT_STUDY_COUNT"];



StudyListRow *StudyRow = [[StudyListRow alloc] init];

for(NSMutableArray *i in rows)
{
    NSLog(@"ROW DATA: %@",i);
    StudyListRow *StudyRow = [[StudyListRow alloc] init];
    StudyRow.study_id_dicom = (NSString *)[i objectAtIndex:study_id_int];
    StudyRow.study_description = [i objectAtIndex:study_desc_int];
    StudyRow.study_datetime = [i objectAtIndex:study_date_int];
    StudyRow.modality = [i objectAtIndex:modality_int];
    StudyRow.referring_physician_name = [i objectAtIndex:referring_physician_name_int];
    StudyRow.patient_id_dicom = [i objectAtIndex:patient_id_dicom_int];
    StudyRow.patient_name = [i objectAtIndex:patient_name_int];
    StudyRow.birth_date = [i objectAtIndex:birth_date_int];
    StudyRow.institution_name = [i objectAtIndex:institution_name_int];
    StudyRow.study_recvd_datetime = [i objectAtIndex:study_recvd_datetime_int];
    StudyRow.image_count = [i objectAtIndex:image_count_int];
    StudyRow.patient_study_count = [i objectAtIndex:patient_study_count_int];



}

Each of the StudyRow.... lines gives the warning.. and I have no idea why.. Ideas?

like image 484
Critter Avatar asked Feb 08 '11 20:02

Critter


2 Answers

Lines like this:

NSUInteger *study_id_int = (NSUInteger *)[columns indexOfObject:@"STUDY_ID_DICOM"];

Should be

NSUInteger study_id_int = (NSUInteger)[columns indexOfObject:@"STUDY_ID_DICOM"];

They are primitives, not pointers to objects (where you would need the asterisk to indicate just that).

like image 69
Wevah Avatar answered Oct 10 '22 04:10

Wevah


Should be NSUInteger varName, not NSUInteger *varName. They are primitives.

like image 43
Joseph Tura Avatar answered Oct 10 '22 04:10

Joseph Tura