Closed Chorsfield closed 7 years ago
int is RIGHT. NSUInteger is WRONG.
Why would you change it from int to NSUInteger?
outlen is of type size_t which is an unsigned long. Comparing an int to an unsigned long is WRONG. It causes warnings to appear in everybody's project that uses your code.
What the FUCK is this?
NSUInteger idxFirstZero = -1;
...
if ( idxFirstZero < 0 ) {
Have you ever learnt real programming basic?
Why the fuck to fix a warning with an error? If you want to fix the compile warning, just fix the compile warning itself, not others.
Just make a type casting:
for ( int i = 0; i < (int)outlen; i++ )
int idxFirstZero = -1;
int idxNextZero = (int)outlen;
for ( int i = 0; i < outlen; i++ ) {
The compile warning is
for ( int i = 0; i < outlen; i++ ) {
Why the heck made a modification to
NSUInteger idxFirstZero = -1;
NSUInteger idxNextZero = outlen;
You can fix the compile warning by
for ( int i = 0; i < (int)outlen; i++ )
or
for ( NSUInteger i = 0; i < outlen; i++ ) {
The second is what you made. But why edit
int idxFirstZero = -1;
int idxNextZero = (int)outlen;
to
NSUInteger idxFirstZero = -1;
NSUInteger idxNextZero = outlen;
Yes, if i is uint, idxFirstZero = i; will cause compile warning, just fix it.
The bug is in YOUR code and everyone who uses YOUR code. I did fix it in YOUR code and like I pointed out in my original PR I wasn't sure about the very lines of code you are complaining about. But seeing as you are now aware of the bug you can obviously fix it in YOUR code.
不懂就要虚心地学.
I am a little unsure about the changes made on lines 325-327. The code is checking to see if a unsigned int is less than 0 which will never happen. There has to be a better way of doing the without losing precision or causing a warning in everyone who uses this lib's project.