jbenet / ios-ntp

SNTP implementation for iOS
http://code.google.com/p/ios-ntp/
MIT License
368 stars 112 forks source link

Static Analysis #16

Open isadon opened 9 years ago

isadon commented 9 years ago

Hi, I will be using your library on one of my iOS projects soon but have a been a bit worried because after running ios-ntp through AppCode's static analysis there are a lot of valid warnings. For example in various places an integer is return from a function that is supposed to return an unsigned integer. -- see GCDAsyncUdpSocket.m line 1663. Though it doesn't speak to whether the library works or not it would be great if you could fix the code up a bit in the hopes of maybe prevent any crashes or problems that may occur. See Appcode at https://www.jetbrains.com/objc/

Thanks

gavineadie commented 9 years ago

I agree that the type of a returned variable should match the defined function/method return type but, at least in the case you cite, (1) GCDAsyncUdpSocket.m is code from another library at https://github.com/robbiehanson/CocoaAsyncSocket and that class hasn't been touched for a year, and (2) the function in question (indexOfInterfaceAddr4) is not used anywhere in ios-ntp. The CocoaAsyncSocket code is so widely used that I suspect it is behaving correctly.

Of course, you are not restricted from correcting these type inconsistencies (and maybe pushing your work to Robbie), or from dropping out all the unused functions in your version of the code.