KissXML icon indicating copy to clipboard operation
KissXML copied to clipboard

Fix Xcode compiler warning: Implicit conversion loses integer precision:...

Open richrad opened this issue 11 years ago • 4 comments

... 'NSUInteger' (aka 'unsigned long') to 'int'

richrad avatar Nov 12 '13 20:11 richrad

:+1:

jstart avatar Apr 07 '14 20:04 jstart

+1

YSDC avatar Nov 07 '14 10:11 YSDC

+1, but this is also covered by PR #39.

ewanmellor avatar Mar 20 '15 02:03 ewanmellor

Simply silencing this one with a cast may not be the right call. - [NSData length] returns an NSUInteger, which is either an unsigned int (on 32 bit systems) or an unsigned long (on 64 bit systems). This value is being passed to a libxml function that is expecting an int, which I believe is always a 32 bit number.

So if it's a possibility that the length of the data exceeds 2^32-1, then there should be some code that checks that case. Is that a possibility? Seems like it'd be a pretty crazy edge case if it is...

After understanding that concern, I say we just cast it and get rid of this annoying warning :)

+1

tblank555 avatar Aug 31 '15 23:08 tblank555