ReactiveCocoa / ReactiveObjC

The 2.x ReactiveCocoa Objective-C API: Streams of values over time
MIT License
2.6k stars 496 forks source link

chore: explicitly cast LONG_MAX to double #186

Open codebytere opened 3 years ago

codebytere commented 3 years ago

Fixes a compilation error encountered in Electron as a result of Chromium enabling the -Wimplicit-const-int-float-conversion compilation flag in this CL.

Compilation Failure ``` ../../third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler.m:52:62: error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion] .tv_nsec = (long)fmin(fmax(frac * NSEC_PER_SEC, LONG_MIN), LONG_MAX) ~~~~ ^~~~~~~~ ../../third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' #define LONG_MAX __LONG_MAX__ ^~~~~~~~~~~~ :53:22: note: expanded from here #define __LONG_MAX__ 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ ../../third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler.m:51:51: error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion] .tv_sec = (time_t)fmin(fmax(seconds, LONG_MIN), LONG_MAX), ~~~~ ^~~~~~~~ ../../third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' #define LONG_MAX __LONG_MAX__ ^~~~~~~~~~~~ :53:22: note: expanded from here #define __LONG_MAX__ 9223372036854775807L ^~~~~~~~~~~~~~~~~~~~ 2 errors generated. ```

Please let me know if I need to make other associated changes or you all would prefer another approach to fixing this issue!