returnCFNumberCreate(0,kCFNumberSInt16Type,&x);// expected-warning{{An 8-bit integer is used to initialize a CFNumber object that represents a 16-bit integer; 8 bits of the CFNumber value will be garbage}}
returnCFNumberCreate(0,kCFNumberSInt8Type,&x);// expected-warning{{A 16-bit integer is used to initialize a CFNumber object that represents an 8-bit integer; 8 bits of the integer value will be lost}}
returnCFNumberCreate(0,kCFNumberLongType,&i);// expected-warning{{A 32-bit integer is used to initialize a CFNumber object that represents a 64-bit integer}}
}
unsignedchargetValueTest1(CFNumberRefx){
unsignedcharscalar=0;
CFNumberGetValue(x,kCFNumberSInt16Type,&scalar);// expected-warning{{A CFNumber object that represents a 16-bit integer is used to initialize an 8-bit integer; 8 bits of the CFNumber value will overwrite adjacent storage}}
returnscalar;
}
unsignedchargetValueTest2(CFNumberRefx){
unsignedshortscalar=0;
CFNumberGetValue(x,kCFNumberSInt8Type,&scalar);// expected-warning{{A CFNumber object that represents an 8-bit integer is used to initialize a 16-bit integer; 8 bits of the integer value will be garbage}}