Squashed 'third_party/allwpilib/' changes from 83f1860047..f1a82828fe

f1a82828fe [wpiutil] Add DataLog and DataLogManager Stop() (#5860)
2a04e12c6f [apriltag] AprilTagFieldLayout: Add accessors for origin and field dimensions (#5869)
33e0089afb Cleanup usages of std::function<void(void)> (#5864)
d06fa633d5 [build] Fix protobuf generation when building with make (#5867)
049732afb8 [cscore] Make camera connection logging clearer (#5866)
87f7c19f90 [wpimath] Make InterpolatingDoubleTreeMap constructor public (#5865)
6b53ef47cf [wpimath] Don't recreate TrapezoidProfile in ProfiledPIDController calculate() (#5863)
8a3a268ae6 [commands] Add finallyDo with zero-arg lambda (#5862)
1c35d42cd0 [wpilib] Pop diagnostic for deprecated function use (#5859)
ddc8db6c26 [wpimath] Add feedforward constant constructor to ElevatorSim (#5823)
c6aff2c431 [upstream_utils] Update to LLVM 17.0.4 (#5855)
a9c5b18a39 [build] Update OpenCV to 2024-4.8.0-2 (#5854)
9540b6922d [hal] Add CAN IDs for AndyMark and Vivid Hosting (#5852)
83a7d33c47 [glass] Improve display of protobuf/struct type strings (#5850)
a4a8ad9c75 [commands] Make Java SelectCommand generic (#5849)
9eecf2a456 [build] Add CMake option to build Java sources jars (#5768)
9536a311cb [wpilib] Add support for the PS5 DualSense controller (#5257)
8d5e6737fc [wpilibc] SolenoidSim: Add virtual destructor (#5848)
07e13d60a2 [ntcore] Fix write_impl (#5847)
1713386869 [wpiutil] ProtobufMessageDatabase: Fix out-of-order Add() rebuild (#5845)
35472f5fc9 [ntcore] Fix a use-after-free in client close (#5844)
ed168b522c [ntcore] Disable buf pool when asan is enabled (#5843)
3e7ba2cc6f [wpinet] WebSocket: Fix write behavior (#5841)
80c47da237 [sim] Disable the robot program when DS disconnects (#5818)
abe1cec90c [wpilib] Update Usage Reporting ResourceType from NI Libraries (#5842)
cdf981abba [glass] Fix position of data type in NT view (#5840)
04dcd80adb [build] Publish unit tests for examples (#5838)
49920234ac [build] Fix checkstyle rules to allow Windows paths (#5839)
366b715942 [wpilib] Fix SendableChooser test (#5835)
3ba501f947 [commands] Java: Fix CommandXboxController.leftTrigger() parameter order (#5831)
ec569a58ef [wpimath] Make KalmanTypeFilter interface public (#5830)
b91317fd36 [wpiutil] DataLog.addSchema(): Don't add into a set view (#5829)
2ab4fcbc24 [wpiutil] ProtobufMessageDatabase: Clear messages first (#5827)
98c14f1692 [wpimath] Add EKF/UKF u-y-R correct overload (#5832)
60bcdeded9 [ci] Disable java in sanitizer builds (#5833)
c87f8fd538 [commands] Add DeferredCommand (#5566)
ad80eb3a0b [ci] Update actions for comment-command (#5824)
c7d6ad5a0b [ntcore] WebSocketConnection: Use weak capture (#5822)
8a8e220792 [simgui] Add 'Invalid' option for AllianceStation (#5820)
cfc6a47f76 [sim] DS plugin: Fix off-by-one error when setting alliance station (#5819)
8efa586ace [ntcore] Don't check type string on publishing an entry (#5816)
23ea188e60 [glass] Add protobuf decode error log message (#5812)
928e87b4f4 [build] Add combined test meta-task (#5813)
63ef585d4b [wpiutil] Fix compilation of MathExtras.h on Windows with /sdl (#5809)
b03a7668f9 [build] Windows CMake/vcpkg fixes (#5807)
3f08bcde54 [hal] Fix HAL AllianceStation on rio (#5811)
196d963dc4 [ntcore] Fix off-by-one error in stream write (#5810)
f4cbcbc984 Fix typos (NFC) (#5804)
ec0f7fefb0 [myrobot] Update the myRobot JRE (#5805)
3d618bdbfd [wpiutil] Fix Java struct array unpacking (#5801)
1fa7445667 [ntcore] Check for valid client in incoming text and binary (#5799)
269b9647da [ci] Update JDK for combine step (#5794)
bee32f080e [docs] Add wpiunits to JavaDocs (#5793)
25dad5a531 [wpinet] TCPConnector_parallel: Don't use thread_local (#5791)
4a93581f1a [build] cmake: use default library type for libglassnt, libglass, wpigui, and imgui (#5797)
abb2857e03 [wpilib] Counter: Fix default distance per pulse, add distance and rate to C++ (#5796)
b14a61e1c0 [readme] Add link to QuickBuffers release page (#5795)
cf54d9ccb7 [wpiutil, ntcore] Add structured data support (#5391)
ecb7cfa9ef [wpimath] Add Exponential motion profile (#5720)
7c6fe56cf2 [ntcore] Fix crash on disconnect (#5788)
85147bf69e [wpinet] WebSocketSerializer: Fix UB (#5787)
244163acad [wpinet] uv::Stream::TryWrite(): Return 0 on EAGAIN (#5784)
820728503d [hal] Remove extra semicolon in RoboRioData (#5786)
45f307d87e [upstream_utils] Upgrade to LLVM 17.0.3 (#5785)
4ce4d63efc [wpilibj] Fix RobotBase.isSimulation() (#5783)
579007ceb3 [commands] Add requirements parameter to Commands.idle() (#5774)
3f3a169149 [wpilib] Make physics sim setState() functions public (#5779)
7501e4ac88 [wpilib] Close sim device in ADIS IMUs (#5776)
99630d2e78 [wpimath] Upgrade to EJML 0.43.1 (#5778)
02cbbc997d [wpimath] Make Vector-Vector binary operators return Vector (#5772)
ed93889e17 [examples] Fix typo in TimesliceRobot example name (#5773)
da70e4c262 [docs] Add jinja2 to CMake prerequisites (#5771)
e814595ea7 [wpimath] Add ChassisSpeeds.fromRobotRelativeSpeeds() (#5744)
f98c943445 [wpimath] LinearSystemId: Add DCMotorSystem overload (#5770)
b3eb64b0f7 [wpiutil] ct_string: Use inline namespace for literals (#5767)
7d9ba256c2 Revert "[build] Add CMake option to build Java source jars (#5756)" (#5766)
1f6492e3d8 [sysid] Update JSON library usage (#5765)
638f04f626 [wpiutil] Add protobuf to thirdparty sources (#5746)
210255bfff [wpiutil] Update json to 3.11.2 (#5680)
896772c750 [wpimath] Add DCMotor functions for Kraken X60 and Neo Vortex (#5759)
fd427f6c82 [wpimath] Fix hardcoded module count in SwerveDriveKinematics.resetHeading() (#5762)
c0b4c6cce6 [wpimath] Add overloads for Transform2d and Transform3d (#5757)
9a0aafd8ab [examples] Make swerve examples multiply desired module speeds by cosine of heading error (#5758)
1c724884ca [build] Add CMake option to build Java source jars (#5756)
5b0db6b93e [ci] Forward CI as well (#5755)
f8cbbbac12 [ci] Take 2 on passing GITHUB_REF (#5754)
b9944be09c [ci] Pass GITHUB_REF to docker container (#5753)
de5e4eda6c [build] Update apriltag, libssh, googletest for 2024 (#5752)
227e660e20 [upstream_utils] Upgrade to LLVM 17.0.2 (#5750)
36f94c9f21 [commands,romi,xrp] Add frcYear to vendordep (#5747)
741d166457 [glass] NT view: enhance array support (#5732)
1d23513945 [ntcore] Fix string array value comparison (#5745)
ff1849052e [commands] Make command scheduling order consistent (#5470)
58e8474368 [build] Disable armsimulation unit test (#5739)
fb07b0da49 [examples] Add XRP C++ Examples and Templates (#5743)
81893ad73d Run wpiformat with clang-format 17 (#5740)
faa1e665ba [wpimath] Add ElevatorFeedforward.calculate(currentV, nextV) overload (#5715)
a789632052 [build] Update to native utils 2024.3.1 (#5738)
8f60ab5182 [build] Update OpenCV to 2024-4.8.0-1 (#5737)
33243f982b [wpimath] Expand Quaternion class with additional operators (#5600)
420f2f7c80 [ntcore] Add RTT-only subprotocol (#5731)
2b63e35ded [ntcore] Fix moving outgoing queue to new period (#5735)
be939cb636 [ntcore] Fix notification of SetDefaultEntryValue (#5733)
69a54de202 [build] Update enterprise plugin (#5730)
fef03a3ff5 [commands] Clean up C++ includes after Requirements was added (#5719)
8b7c6852cf [ntcore] Networking improvements (#5659)
1d19e09ca9 [wpiutil] Set WPI_{UN}IGNORE_DEPRECATED to empty when all else fails (#5728)
58141d6eb5 [wpilib] Make BooleanEvent more consistent (#5436)
6576d9b474 [wpilib] SendableChooser: implement Sendable instead of NTSendable (#5718)
a4030c670f [build] Update to gradle 8.4, enable win arm builds (#5727)
0960f11eba [wpinet] Revert removal of uv_clock_gettime() (#5723)
cb1bd0a3be [wpiutil] Get more precise system time on Windows (#5722)
4831277ffe [wpigui] Fix loading a maximized window on second monitor (#5721)
3eb372c25a [wpiutil] SendableBuilder: Add PublishConst methods (#5158)
1fec8596a4 [ci] Fix -dirty version (#5716)
f7e47d03f3 [build] Remove unnecessary CMake config installs (#5714)
a331ed2374 [sysid] Add SysId (#5672)
8d2cbfce16 [wpiutil] DataLog: Stop logging if insufficient free space (#5699)
48facb9cef [ntcoreffi] Add DataLogManager (#5702)
aecbcb08fc [ntcore] Correctly start DataLog for existing publishers (#5703)
5e295dfbda [wpiutil] DataLog: Limit total buffer allocation (#5700)
c7c7e05d9d [ci] Unbreak combiner (#5698)
c92bad52cb [wpilib] DataLogManager: Use system time valid function (#5697)
d404af5f24 [wpilib] RobotController: Add isSystemTimeValid() (#5696)
e56f1a3632 [ci] Run combine but skip all steps (#5695)
8f5bcad244 [ci] Use sccache for cmake builds (#5692)
703dedc4a6 [ci] Upgrade get-cmake action to fix node12 deprecation warning (#5694)
c69a0d7504 [ci] Don't run example unit test that segfaults (#5693)
66358d103e Add menu items for online docs to GUI tools (#5689)
4be8384a76 [ci] Disable combine on PR builds (#5691)
90288f06a6 [ci] Fix Gradle disk space issues (#5688)
9e9583412e [wpigui] Make wpi::gui::OpenURL() fork the process first (#5687)
d4fcd80b7b [ci] Gradle: Use container only for build step (#5684)
7b70e66772 [outlineviewer] Fix thirdparty library include sorting (#5683)
5f651df5d5 [build] Clean up Gradle configs (#5685)
65b26738d5 Add CMakeSettings.json to gitignore (#5682)
d0305951ad Fix GitHub inline warnings (#5681)
e8d4a20331 [build][cmake] Fix windows tests and re-enable CI tests (#5674)
2b58bbde0b [xrp] Add Reflectance sensor and rangefinder classes (#5673)
dd5612fbee [json] Add forward definition header (#5676)
eab44534c3 [wpimath] Remove unused SmallString include (#5677)
5ab54ff760 Replace wpi::raw_istream with wpi::MemoryBuffer (#5675)
1b6ec5a95d [wpiutil] Upgrade to LLVM 17.0.1 (#5482)
07a0d22fe6 [build] Build examples in CMake CI (#5667)
97021f074a [build] Upgrade imgui and implot (#5668)
87ce1e3761 [build] Fix wpilibNewCommands CMake install (#5671)
6ef94de9b5 [wpimath] Add tests for ArmFeedforward and ElevatorFeedforward (#5663)
c395b29fb4 [wpinet] Add WebSocket::TrySendFrames() (#5607)
c4643ba047 [romi/xrp] Fix version typo in vendordep json (#5664)
51dcb8b55a [examples] Make Romi/XRP Examples use appropriate vendordeps (#5665)
daf7702007 [build] Test each example in a new environment (#5662)
e67df8c180 [wpilib] Const-qualify EncoderSim getters (#5660)
7be290147c [wpiutil] Refactor SpanMatcher and TestPrinters from ntcore (#5658)
9fe258427a [commands] Add proxy factory to Commands (#5603)
633c5a8a22 [commands] Add C++ Requirements struct (#5504)
b265a68eea [commands] Add interruptor parameter to onCommandInterrupt callbacks (#5461)
e93c233d60 [ntcore] Compute Value memory size when creating value (#5657)
5383589f99 [wpinet] uv::Request: Return shared_ptr from Release() (#5656)
40b552be4a [wpinet] uv::Stream: Return error from TryWrite() (#5655)
202a75fe08 [wpinet] RequestImpl: Avoid infinite loop in shared_from_this() (#5654)
8896515eb7 [wpinet] uv::Buffer: Add bytes() accessor (#5653)
ae59a2fba2 [wpinet] uv::Error: Change default error to 0 (#5652)
3b51ecc35b [wpiutil] SpanExtras: Add take_back and take_front (#5651)
17f1062885 Replace std::snprintf() with wpi::format_to_n_c_str() (#5645)
bb39900353 [romi/xrp] Add Romi and XRP Vendordeps (#5644)
cb99517838 [build] cmake: Use default install location on windows for dlls (#5580)
25b0622d4c [build] Add Windows CMake CI (#5516)
34e7849605 Add warning to development builds instructions (NFC) (#5646)
e9e611c9d8 [cameraserver] Remove CameraServer.SetSize() (#5650)
94f58cc536 [wpilib] Remove Compressor.Enabled() (#5649)
4da5aee88a [wpimath] Remove SlewRateLimiter 2 argument constructor (#5648)
2e3ddf5502 Update versions in development builds instructions to 2024 (#5647)
19a8850fb1 [examples] Add TimesliceRobot templates (#3683)
9047682202 [sim] Add XRP-specific plugin (#5631)
575348b81c [wpilib] Use IsSimulation() consistently (#3534)
12e2043b77 [wpilib] Clean up Notifier (#5630)
4bac4dd0f4 [wpimath] Move PIDController from frc2 to frc namespace (#5640)
494cfd78c1 [wpiutil] Fix deprecation warning in LLVM for C++23 (#5642)
43a727e868 [apriltag] Make loadAprilTagFieldLayout throw an unchecked exception instead (#5629)
ad4b017321 [ci] Use Ninja for faster builds (#5626)
4f2114d6f5 Fix warnings from GCC 13 release build (#5637)
e7e927fe26 [build] Also compress debug info for CMake RelWithDebInfo build type (#5638)
205a40c895 [build] Specify zlib for debug info compression (#5636)
707444f000 [apriltag] Suppress -Wtype-limits warning in asserts from GCC 13 (#5635)
3b79cb6ed3 [commands] Revert SubsystemBase deprecation/removal (#5634)
bc7f23a632 [build] Compress Linux debug info (#5633)
57b2d6f254 [build] Update to image 2024 v1.0 (#5625)
339ef1ea39 [wpilib] DataLogManager: Warn user if logging to RoboRIO 1 internal storage (#5617)
7a9a901a73 [build] Fix cmake config files (#5624)
298f8a6e33 [wpilib] Add Mechanism2d tests and make Java impl match C++ (#5527)
d7ef817bae [apriltag] Update apriltag library (#5619)
c3fb31fd0e [docs] Switch to Java 17 api docs (#5613)
bd64f81cf9 [build] Run Google tests in release mode in CI (#5615)
66e6bd81ea [wpimath] Cleanup wpimath/algorithms.md (NFC) (#5621)
4fa56fd884 [build] Add missing find_dependency call (#5623)
f63d958995 [build] Update to native utils 2024.2.0 (#5601)
a9ab08f48b [wpimath] Rename ChassisSpeeds.fromDiscreteSpeeds() to discretize() (#5616)
8e05983a4a [wpimath] Add math docs to plant inversion feedforward internals (NFC) (#5618)
3a33ce918b [ntcore] Add missing StringMap include (#5620)
a6157f184d [wpiutil] timestamp: Add ShutdownNowRio (#5610)
e9f612f581 [build] Guard policy setting for CMake versions below 3.24 (#5612)
1a6df6fec6 [wpimath] Fix DARE Q decomposition (#5611)
9b3f7fb548 [build] Exclude IntelliJ folders from spotless XML (#5602)
814f18c7f5 [wpimath] Fix computation of C for DARE (A, C) detectability check (#5609)
ac23f92451 [hal] Add GetTeamNumber (#5596)
a750bee54d [wpimath] Use std::norm() in IsStabilizable() (#5599)
8e2465f8a0 [wpimath] Add arithmetic functions to wheel speeds classes (#5465)
10d4f5b5df [wpimath] Clean up notation in DARE precondition docs (#5595)
b2dd59450b [hal] Fix unfinished/incorrect GetCPUTemp functions (#5598)
99f66b1e24 [wpimath] Replace frc/EigenCore.h typedefs with Eigen's where possible (#5597)
383289bc4b [build] Make custom CMake macros use lowercase (#5594)
45e7720ec1 [build] Add error message when downloading files in CMake (#5593)
4e0d785356 [wpimath] ChassisSpeeds: document that values aren't relative to the robot (NFC) (#5551)
3c04580a57 [commands] ProxyCommand: Use inner command name in unique_ptr constructor (#5570)
cf19102c4a [commands] SelectCommand: Fix leakage and multiple composition bug (#5571)
171375f440 [ntcoreffi] Link to NI libraries (#5589)
89add5d05b Disable flaky tests (#5591)
a8d4b162ab [ntcore] Remove RPC manual tests (#5590)
39a73b5b58 [commands] C++: Add CommandPtr supplier constructor to ProxyCommand (#5572)
36d514eae7 [commands] Refactor C++ ScheduleCommand to use SmallSet (#5568)
52297ffe29 [commands] Add idle command (#5555)
67043a8eeb [wpimath] Add angular jerk unit (#5582)
51b0fb1492 [wpimath] Fix incorrect header inclusion in angular_acceleration.h (#5587)
b7657a8e28 [wpimath] Split WPIMathJNI into logical chunks (#5552)
ea17f90f87 [build] Fix tool builds with multiple arm platforms installed (#5586)
f1d7b05723 [wpimath] Clean up unit formatter (#5584)
d7264ff597 Replace wpi::errs() usage with fmtlib (#5560)
ab3bf39e0e [wpiutil] Upgrade to fmt 10.1.1 (#5585)
165ebe4c79 Upgrade to fmt 10.1.0 (#5326)
8e2a7fd306 Include thirdparty libraries with angle brackets (#5578)
e322ab8e46 [wpimath] Fix docs for DARE ABQRN stabilizability check (NFC) (#5579)
360fb835f4 [upstream_utils] Handle edge case in filename matches (#5576)
9d86624c00 [build] Fix CMake configure warnings (#5577)
969979d6c7 [wpiutil] Update to foonathan memory 0.7-3 (#5573)
0d2d989e84 [wpimath] Update to gcem 1.17.0 (#5575)
cf86af7166 [wpiutil] Update to mpack 1.1.1 (#5574)
a0c029a35b [commands] Fix dangling SelectCommand documentation (NFC) (#5567)
349141b91b [upstream_utils] Document adding a patch (NFC) (#5432)
7889b35b67 [wpimath] Add RamseteController comparison to LTV controller docs (NFC) (#5559)
b3ef536677 [build] Ignore nt/sim json files in spotless (#5565)
ed895815b5 [build] Compile Java with UTF-8 encoding (#5564)
2e4ad35e36 [wpiutil] jni_util: Add JSpan and CriticalJSpan (#5554)
8f3d6a1d4b [wpimath] Remove discretizeAQTaylor() (#5562)
7c20fa1b18 [wpimath] Refactor DARE tests to reduce RAM usage at compile time (#5557)
89e738262c [ntcore] Limit buffer pool size to 64KB per connection (#5485)
96f7fa662e Upgrade Maven dependencies (#5553)
7a2d336d52 [wpinet] Leak multicast handles during windows shutdown (#5550)
f9e2757d8f [wpimath] Use JDoubleArrayRef in all JNI functions (#5546)
0cf6e37dc1 [wpimath] Make LTV controller constructors use faster DARE solver (#5543)
6953a303b3 [build] Fix the windows build with fmt (#5544)
7a37e3a496 [wpimath] Correct Rotation3d::RotateBy doc comment (NFC) (#5541)
186b409e16 [wpimath] Remove internal Eigen header include (#5539)
03764dfe93 [wpimath] Add static matrix support to DARE solver (#5536)
394cfeadbd [wpimath] Use SDA algorithm instead of SSCA for DARE solver (#5526)
a4b7fde767 [wpilib] Add mechanism specific SetState overloads to physics sims (#5534)
8121566258 [wpimath] Fix CoordinateSystem.convert() Transform3d overload (#5532)
b542e01a0b [glass] Fix array crash when clearing existing workspace (#5535)
e2e1b763b2 [wpigui] Fix PFD file dialogs not closing after window closing (#5530)
86d7bbc4e4 [examples] Add Java Examples and Templates for the XRP (#5529)
e8b5d44752 [wpimath] Make Java Quaternion use doubles instead of Vector (#5525)
38c198fa64 [myRobot] Add apriltags to myRobot build (#5528)
00450c3548 [wpimath] Upgrade to EJML 0.42 (#5531)
faf3cecd83 [wpimath] Don't copy Matrix and underlying storage in VecBuilder (#5524)
6b896a38dc [build] Don't enforce WITH_FLAT_INSTALL with MSVC (part 2) (#5517)
c01814b80e [wpiutil] Add C API for DataLog (#5509)
b5bd0771eb [wpimath] Document extrinsic vs intrinsic rotations (NFC) (#5508)
84ed8aec05 [build] Don't enforce WITH_FLAT_INSTALL with MSVC (#5515)
999f677d8c [ntcoreffi] Add WPI_Impl_SetupNowRio to exported symbols (#5510)
338f37d302 Fix header sorting of libssh (#5507)
75cbd9d6d0 [glass] Add background color selector to glass plots (#5506)
e2c190487b [examples] Add flywheel bang-bang controller example (#4071)
c52dad609e [wpinet] WebSocket: Send pong in response to ping (#5498)
e2d17a24a6 [hal] Expose power rail disable and cpu temp functionality (#5477)
3ad5d2e42d [hal,wpiutil] Use HMB for FPGA Timestamps (#5499)
b46a872494 [ntcore] Remove pImpl from implementation (#5480)
d8c59ccc71 [wpimath] Add tests for MathUtil clamp() and interpolate() (#5501)
0552c8621d [glass,ov] Improve Glass and OutlineViewer title bar message (#5502)
90e37a129f [wpiutil,wpimath] Add generic InterpolatingTreeMap (#5372)
d83a6edc20 [wpilib] Update GetMatchTime docs and units (#5232)
6db2c42966 [wpimath] Trajectory: Throw on empty lists of States (#5497)
21439b606c [wpimath] Disallow LTV controller max velocities above 15 m/s (#5495)
7496e0d208 [ntcore] Value: More efficiently store arrays (#5484)
0c93aded8a [wpimath] Change kinematics.ToTwist2d(end - start) to kinematics.ToTwist2d(start, end) (#5493)
815a8403e5 [wpimath] Give infeasible trajectory constraints a better exception message (#5492)
35a8b129d9 [wpimath] Add RotateBy() function to pose classes (#5491)
26d6e68c8f [upstream_utils] Add GCEM to CI (#5483)
6aa469ae45 [wpilib] Document how to create LinearSystem object for physics sim classes (NFC) (#5488)
a01b6467d3 [wpimath] Link to docs on LQR and KF tolerances (#5486)
d814f1d123 [wpimath] Fix copy-paste error from Pose2d docs (NFC) (#5490)
98f074b072 [wpimath] Add folder prefix to geometry includes (#5489)
e9858c10e9 [glass] Add tooltips for NT settings (#5476)
12dda24f06 [examples] Fix C robot template not correctly looping (#5474)
fc75d31755 [apriltag] Update apriltaglib (#5475)
a95994fff6 [wpiutil] timestamp: Call FPGA functions directly (#5235)
2ba8fbb6f4 [wpimath] Improve documentation for SwerveModulePosition::operator- (#5468)
b8cdf97621 [build] Prepare for Windows arm64 builds (#5390)
552f4b76b5 [wpimath] Add FOC-enabled Falcon constants to the DCMotor class (#5469)
1938251436 [examples] Add Feedforward to ElevatorProfiledPid (#5300)
873c2a6c10 [examples] Update ElevatorTrapezoidProfile example (#5466)
99b88be4f3 [wpilib] Reduce usage of NTSendable (#5434)
d125711023 [hal] Fix Java REVPH faults bitfield (take 2) (#5464)
c3fab7f1f2 [ntcore] Don't update timestamp when value is unchanged (#5356)
5ec7f18bdc [wpilib] EventLoop docs: Remove BooleanEvent references (NFC) (#5463)
c065ae1fcf [wpiunits] Add subproject for a Java typesafe unit system (#5371)
44acca7c00 [wpiutil] Add ClassPreloader (#5365)
88b11832ec [hal] Fix Java REVPH faults bitfield (#5148)
fb57d82e52 [ntcore] Enhance Java raw value support
3a6e40a44b [wpiutil] Enhance DataLog Java raw value support
8dae5af271 [wpiutil] Add compile-time string utilities (ct_string) (#5462)
fc56f8049a [wpilib] DriverStation: Change alliance station to use optional (#5229)
ef155438bd [build] Consume libuv via cmake config instead of via pkg-config (#5438)
86e91e6724 [wpimath] Refactor TrapezoidProfile API (#5457)
72a4543493 [wpilib] DutyCycleEncoderSim: Expand API (#5443)
657338715d [wpimath] Add ChassisSpeeds method to fix drifting during compound swerve drive maneuvers (#5425)
1af224c21b Add missing <functional> includes (#5459)
0b91ca6d5a [wpilib] SendableChooser: Add onChange listener (#5458)
6f7cdd460e [wpimath] Pose3d: Switch to JNI for exp and log (#5444)
c69e34c80c [wpimath] ChassisSpeeds: Add arithmetic functions (#5293)
335e7dd89d [wpilib] Simulation: Add ctor parameter to set starting state of mechanism sims (#5288)
14f30752ab [wpilib] Deprecate Accelerometer and Gyro interfaces (#5445)
70b60e3a74 [commands] Trigger: Fix method names in requireNonNullParam (#5454)
593767c8c7 [wpimath] Improve Euler angle calculations in gimbal lock (#5437)
daf022d3da [build] Make devImplementation inherit from implementation (#5450)
9b8d90b852 [examples] Convert the unitless joystick inputs to actual physical units (#5451)
1f6428ab63 [ntcore] Fix undefined comparison behavior when array is empty (#5448)
17eb9161cd Update code owners for removal of old commands (#5447)
3c4b58ae1e [wpinet] Upgrade to libuv 1.46.0 (#5446)
aaea85ff16 [commands] Merge CommandBase into Command and SubsystemBase into Subsystem (#5392)
7ac932996a [ci] Use PAT for workflow dispatch (#5442)
efe1987e8b [ci] Trigger pages repo workflow (#5441)
828bc5276f [wpiutil] Upgrade to LLVM 16.0.6 (#5435)
701df9eb87 [ci] Change documentation publish to single-commit (#5440)
e5452e3f69 [wpiutil] Add WPICleaner and an example how to use it (#4850)
7a099cb02a [commands] Remove deprecated classes and functions (#5409)
b250a03944 [wpilib] Add function to wait for DS Connection (#5230)
a6463ed761 [wpiutil] Fix unused variable warning in release build (#5430)
f031513470 [ntcore] NetworkTable::GetSubTables(): Remove duplicates (#5076)
f8e74e2f7c [hal] Unify PWM simulation Speed, Position, and Raw (#5277)
fd5699b240 Remove references to Drake (#5427)
e2d385d80a [build] cmake: Respect USE_SYSTEM_FMTLIB (#5429)
d37f990ce3 [hal] Fix HAL Relay/Main doc module (NFC) (#5422)
a7a8b874ac [docs] Expand HAL_ENUM in doxygen docs (#5421)
3a61deedde [wpimath] Rotation2d: Only use gcem::hypot when constexpr evaluated (#5419)
96145de7db [examples] Fix formatting (NFC) (#5420)
fffe6a7b9a [examples] Improve Pneumatics example coverage in Solenoid and RapidReactCmdBot examples (#4998)
6b5817836d [wpimath] Add tolerance for some tests (#5416)
3233883f3e [cscore] Fix warnings on macos arm (#5415)
c4fc21838f [commands] Add ConditionalCommand getInterruptionBehavior (#5161)
89fc51f0d4 Add tests for SendableChooser and Command Sendable functionality (#5179)
663bf25aaf [docs] Generate docs for symbols in __cplusplus (#5412)
fe32127ea8 [command] Clean up Command doc comments (NFC) (#5321)
c1a01569b4 [wpilib][hal] PWM Raw using microseconds (#5283)
1fca519fb4 [wpiutil] Remove remnants of ghc fs and tcb_span libraries (#5411)
90602cc135 [github] Update issue template to collect more project info (#5090)
34412ac57e [build] Exclude files in bin from Spotless (#5410)
61aa60f0e3 [wpilib] Add robot callback that is called when the DS is initially connected (#5231)
ebae341a91 [commands] Add test for subsystem registration and periodic (#5408)
5d3a133f9f Remove spaces in NOLINT comments (#5407)
3a0e484691 [wpimath] Fix clang-tidy warnings (#5403)
eb3810c765 [wpiutil] Fix clang-tidy warnings (#5406)
c4dc697192 [hal] WS Simulation: Add message filtering capability (#5395)
0eccc3f247 [ntcore] Fix clang-tidy warnings (#5405)
f4dda4bac0 [hal] Add javadocs for JNI (NFC) (#5298)
1c20c69793 [cscore] Fix clang-tidy warnings (#5404)
1501607e48 [commands] Fix clang-tidy warnings (#5402)
991f4b0f62 [wpimath] PIDController: Add IZone (#5315)
f5b0d1484b [wpimath] Add isNear method to MathUtil (#5353)
2ce248f66c [hal] Fix clang-tidy warnings (#5401)
5fc4aee2d2 [wpimath] SwerveDriveKinematics: Rename currentChassisSpeed to desiredChassisSpeed (#5393)
50b90ceb54 [wpimath] SwerveDriveKinematics: Add reset method (#5398)
316cd2a453 [commands] Notify DriverStationSim in CommandTestBaseWithParam (#5400)
d4ea5fa902 [cscore] VideoMode: Add equals override (Java) (#5397)
d6bd72d738 [wpimath] ProfiledPIDController: Add getConstraints (#5399)
25ad5017a9 [wpimath] Refactor kinematics, odometry, and pose estimator (#5355)
5c2addda0f [doc] Add missing pneumatics docs (NFC) (#5389)
c3e04a6ea2 Fix loading tests on macos 12 (#5388)
d5ed9fb859 [wpimath] Create separate archive with just units headers (#5383)
901ab693d4 [wpimath] Use UtilityClassTest for more utility classes (#5384)
9d53231b01 [wpilib] DataLogManager: Add warning for low storage space (#5364)
d466933963 [wpiutil] Group doxygen into MPack module (#5380)
652d1c44e3 [wpiutil] Upgrade to macOS 12 to remove concept shims (#5379)
6414be0e5d [wpimath] Group units doxygen modules (#5382)
7ab5800487 [wpiutil] Fix docs typo in SmallVector (#5381)
59905ea721 Replace WPI_DEPRECATED() macro with [[deprecated]] attribute (#5373)
753cb49a5e [ntcore] Fix doxygen module in generated C types (NFC) (#5374)
1c00a52b67 [hal] Expose CAN timestamp base clock (#5357)
91cbcea841 Replace SFINAE with concepts (#5361)
d57d1a4598 [wpimath] Remove unnecessary template argument from unit formatter (#5367)
5acc5e22aa [wpimath] Only compute eigenvalues with EigenSolvers (#5369)
d3c9316a97 extend shuffleboard test timeout (#5377)
1ea868081a [ci] Fix /format command (#5376)
5fac18ff4a Update formatting to clang-format 16 (#5370)
a94a998002 [wpimath] Generalize Eigen formatter (#5360)
125f6ea101 [wpimath] Make SwerveDriveKinematics::ToChassisSpeeds() take const-ref argument (#5363)
51066a5a8a [wpimath] Move unit formatters into units library (#5358)
282c032b60 [wpilibc] Add unit-aware Joystick.GetDirection() (#5319)
073d19cb69 [build] Fix CMake warning (#5359)
01490fc77b [wpiutil] DataLog: Add documentation for append methods (NFC) (#5348)
c9b612c986 [wpilibcExamples] Make C++ state-space elevator KF and LQR match Java (#5346)
eed1e6e3cb [wpimath] Replace DiscretizeAQTaylor() with DiscretizeAQ() (#5344)
c976f40364 [readme] Document how to run examples in simulation (#5340)
4d28bdc19e [ci] Update Github Pages deploy action parameters (#5343)
e0f851871f [ci] Fix github pages deploy version (#5342)
063c8cbedc Run wpiformat (NFC) (#5341)
96e41c0447 [ci] Update deploy and sshagent actions (#5338)
fd294bdd71 [build] Fix compilation with GCC 13 (#5322)
d223e4040b [dlt] Add delete without download functionality (#5329)
abc19bcb43 [upstream_utils] Zero out commit hashes and show 40 digits in index hashes (#5336)
e909f2e687 [build] Update gradle cache repo name (#5334)
52bd5b972d [wpimath] Rewrite DARE solver (#5328)
3876a2523a [wpimath] Remove unused MatrixImpl() function (#5330)
c82fcb1975 [wpiutil] Add reflection based cleanup helper (#4919)
15ba95df7e [wpiutil] Use std::filesystem (#4941)
77c2124fc5 [wpimath] Remove Eigen's custom STL types (#4945)
27fb47ab10 [glass] Field2D: Embed standard field images (#5159)
102e4f2566 [wpilib] Remove deprecated and broken SPI methods (#5249)
463a90f1df [wpilib, hal] Add function to read the RSL state (#5312)
7a90475eec [wpilib] Update RobotBase documentation (NFC) (#5320)
218cfea16b [wpilib] DutyCycleEncoder: Fix reset behavior (#5287)
91392823ff [build] Update to gradle 8.1 (#5303)
258b7cc48b [wpilibj] Filesystem.getDeployDirectory(): Strip JNI path from user.dir (#5317)
26cc43bee1 [wpilib] Add documentation to SPI mode enum (NFC) (#5324)
ac4da9b1cb [hal] Add HAL docs for Addressable LED (NFC) (#5304)
21d4244cf7 [wpimath] Fix DCMotor docs (NFC) (#5309)
1dff81bea7 [hal] Miscellaneous HAL doc fixes (NFC) (#5306)
7ce75574bf [wpimath] Upgrade to Drake v1.15.0 (#5310)
576bd646ae [hal] Add CANManufacturer for Redux Robotics (#5305)
ee3b4621e5 [commands] Add onlyWhile and onlyIf (#5291)
40ca094686 [commands] Fix RepeatCommand calling end() twice (#5261)
9cbeb841f5 [rtns] Match imaging tool capitalization (#5265)
a63d06ff77 [examples] Add constants to java gearsbot example (#5248)
b6c43322a3 [wpilibc] XboxController: Add return tag to docs (NFC) (#5246)
5162d0001c [hal] Fix and document addressable LED timings (#5272)
90fabe9651 [wpilibj] Use method references in drive class initSendable() (#5251)
24828afd11 [wpimath] Fix desaturateWheelSpeeds to account for negative speeds (#5269)
e099948a77 [wpimath] Clean up rank notation in docs (NFC) (#5274)
fd2d8cb9c1 [hal] Use std::log2() for base-2 logarithm (#5278)
ba8c64bcff [wpimath] Fix misspelled Javadoc parameters in pose estimators (NFC) (#5292)
f53c6813d5 [wpimath] Patch Eigen warnings (#5290)
663703d370 [gitattributes] Mark json files as lf text files (#5256)
aa34aacf6e [wpilib] Shuffleboard: Keep duplicates on SelectTab() (#5198)
63512bbbb8 [wpimath] Fix potential divide-by-zero in RKDP (#5242)
9227b2166e [wpilibj] DriverStation: Fix joystick data logs (#5240)
fbf92e9190 [wpinet] ParallelTcpConnector: don't connect to duplicate addresses (#5169)
2108a61362 [ntcore] NT4 client: close timed-out connections (#5175)
0a66479693 [ntcore] Optimize scan of outgoing messages (#5227)
b510c17ef6 [hal] Fix RobotController.getComments() mishandling quotes inside the comments string (#5197)
e7a7eb2e93 [commands] WaitCommand: Remove subclass doc note (NFC) (#5200)
a465f2d8f0 [examples] Shuffleboard: Correct parameter order (#5204)
a3364422fa LICENSE.md: Bump year to 2023 (#5195)
df3242a40a [wpimath] Fix NaN in C++ MakeCostMatrix() that takes an array (#5194)
00abb8c1e0 [commands] RamseteCommand: default-initialize m_prevSpeeds (#5188)
c886273fd7 [wpilibj] DutyCycleEncoder.setDistancePerRotation(): fix simulation (#5147)
53b5fd2ace [ntcore] Use int64 for datalog type string (#5186)
56b758320f [wpilib] DataLogManager: increase time for datetime to be valid (#5185)
08f298e4cd [wpimath] Fix Pose3d log returning Twist3d NaN for theta between 1E-8 and 1E-7 (#5168)
6d0c5b19db [commands] CommandScheduler.isComposed: Remove incorrect throws clause (NFC) (#5183)
0d22cf5ff7 [wpilib] Fix enableLiveWindowInTest crashing in disabled (#5173)
32ec5b3f75 [wpilib] Add isTestEnabled and minor docs cleanup (#5172)
e5c4c6b1a7 [wpimath] Fix invalid iterator access in TimeInterpolatableBuffer (#5138)
099d048d9e [wpimath] Fix Pose3d log returning Twist3d NaN for theta between 1E-9 and 1E-8 (#5143)
4af84a1c12 Fix Typos (NFC) (#5137)
ce3686b80d [wpimath] Check LTV controller max velocity precondition (#5142)
4b0eecaee0 [commands] Subsystem: Add default command removal method (#5064)
edf4ded412 [wpilib] PH: Revert to 5V rail being fixed 5V (#5122)
4c46b6aff9 [wpilibc] Fix DataLogManager crash on exit in sim (#5125)
490ca4a68a [wpilibc] Fix XboxController::GetBackButton doc (NFC) (#5131)
cbb5b0b802 [hal] Simulation: Fix REV PH solenoids 8+ (#5132)
bb7053d9ee [hal] Fix HAL_GetRuntimeType being slow on the roboRIO (#5130)
9efed9a533 Update .clang-format to c++20 (#5121)
dbbfe1aed2 [wpilib] Use PH voltage to calc Analog pressure switch threshold (#5115)
de65a135c3 [wpilib] DutyCycleEncoderSim: Add channel number constructor (#5118)
3e9788cdff [docs] Strip path from generated NT docs (#5119)
ecb072724d [ntcore] Client::Disconnect(): actually close connection (#5113)
0d462a4561 [glass] NT view: Change string/string array to quoted (#5111)
ba37986561 [ntcore] NetworkClient::Disconnect: Add null check (#5112)
25ab9cda92 [glass,ov] Provide menu item to create topic from root (#5110)
2f6251d4a6 [glass] Set default value when publishing new topic (#5109)
e9a7bed988 [wpimath] Add timestamp getter to MathShared (#5091)
9cc14bbb43 [ntcore] Add stress test to dev executable (#5107)
8068369542 [wpinet] uv: Stop creating handles when closing loop (#5102)
805c837a42 [ntcore] Fix use-after-free in server (#5101)
fd18577ba0 [commands] Improve documentation of addRequirements (NFC) (#5103)
74dea9f05e [wpimath] Fix exception for empty pose buffer in pose estimators (#5106)
9eef79d638 [wpilib] PneumaticHub: Document range of enableCompressorAnalog (NFC) (#5099)
843574a810 [ntcore] Use wpi::Now instead of loop time for transmit time
226ef35212 [wpinet] WebSocket: Reduce server send frame overhead
b30664d630 [ntcore] Reduce initial connection overhead
804e5ce236 [examples] MecanumDrive: Fix axis comment in C++ example (NFC) (#5096)
49af88f2bb [examples] ArmSimulation: Fix flaky test (#5093)
d56314f866 [wpiutil] Disable mock time on the Rio (#5092)
43975ac7cc [examples] ArmSimulation, ElevatorSimulation: Extract mechanism to class (#5052)
5483464158 [examples, templates] Improve descriptions (NFC) (#5051)
785e7dd85c [wpilibc] SendableChooser: static_assert copy- and default-constructibility (#5078)
e57ded8c39 [ntcore] Improve disconnect error reporting (#5085)
01f0394419 [wpinet] Revert WebSocket: When Close() is called, call closed immediately (#5084)
59be120982 [wpimath] Fix Pose3d exp()/log() and add rotation vector constructor to Rotation3d (#5072)
37f065032f [wpilib] Refactor TimedRobot tests (#5068)
22a170bee7 [wpilib] Add Notifier test (#5070)
2f310a748c [wpimath] Fix DCMotor.getSpeed() (#5061)
b43ec87f57 [wpilib] ElevatorSim: Fix WouldHitLimit methods (#5057)
19267bef0c [ntcore] Output warning on property set on unpublished topic (#5059)
84cbd48d84 [ntcore] Handle excludeSelf on SetDefault (#5058)
1f35750865 [cameraserver] Add GetInstance() to all functions (#5054)
8230fc631d [wpilib] Revert throw on nonexistent SimDevice name in SimDeviceSim (#5053)
b879a6f8c6 [wpinet] WebSocket: When Close() is called, call closed immediately (#5047)
49459d3e45 [ntcore] Change wire timeout to fixed 1 second (#5048)
4079eabe9b [wpimath] Discard stale pose estimates (#5045)
fe5d226a19 [glass] Fix option for debug-level NT logging (#5049)
b7535252c2 [ntcore] Don't leak buffers in rare WS shutdown case (#5046)
b61ac6db33 [ntcore] Add client disconnect function (#5022)
7b828ce84f [wpimath] Add nearest to Pose2d and Translation2d (#4882)
08a536291b [examples] Improvements to Elevator Simulation Example (#4937)
193a10d020 [wpigui] Limit frame rate to 120 fps by default (#5030)
7867bbde0e [wpilib] Clarify DS functions provided by FMS (NFC) (#5043)
fa7c01b598 [glass] Add option for debug-level NT logging (#5007)
2b81610248 [wpiutil] Add msgpack to datalog Python example (#5032)
a4a369b8da CONTRIBUTING.md: Add unicodeit CLI to math docs guidelines (#5031)
d991f6e435 [wpilib] Throw on nonexistent SimDevice name in SimDeviceSim constructor (#5041)
a27a047ae8 [hal] Check for null in getSimDeviceName JNI (#5038)
2f96cae31a [examples] Hatchbots: Add telemetry (#5011)
83ef8f9658 [simulation] GUI: Fix buffer overflow in joystick axes copy (#5036)
4054893669 [commands] Fix C++ Select() factory (#5024)
f75acd11ce [commands] Use Timer.restart() (#5023)
8bf67b1b33 [wpimath] PIDController::Calculate(double, double): update setpoint flag (#5021)
49bb1358d8 [wpiutil] MemoryBuffer: Fix GetMemoryBufferForStream (#5017)
9c4c07c0f9 [wpiutil] Remove NDEBUG check for debug-level logging (#5018)
1a47cc2e86 [ntcore] Use full handle when subscribing (#5013)
7cd30cffbc Ignore networktables.json (#5006)
92aecab2ef [commands] Command controllers are not subclasses (NFC) (#5000)
8785bba080 [ntcore] Special-case default timestamps (#5003)
9e5b7b8040 [ntcore] Handle topicsonly followed by value subscribe (#4991)
917906530a [wpilib] Add Timer::Restart() (#4963)
00aa66e4fd [wpimath] Remove extraneous assignments from DiscretizeAB() (#4967)
893320544a [examples] C++ RamseteCommand: Fix units (#4954)
b95d0e060d [wpilib] XboxController: Fix docs discrepancy (NFC) (#4993)
008232b43c [ntcore] Write empty persistent file if none found (#4996)
522be348f4 [examples] Rewrite tags (NFC) (#4961)
d48a83dee2 [wpimath] Update Wikipedia links for quaternion to Euler angle conversion (NFC) (#4995)
504fa22143 [wpimath] Workaround intellisense Eigen issue (#4992)
b2b25bf09f [commands] Fix docs inconsistency for toggleOnFalse(Command) (NFC) (#4978)
ce3dc4eb3b [hal] Properly use control word that is in sync with DS data (#4989)
1ea48caa7d [wpilib] Fix C++ ADXRS450 and Java SPI gyro defs (#4988)
fb101925a7 [build] Include wpimathjni in commands binaries (#4981)
657951f6dd [starter] Add a process starter for use by the installer for launching tools (#4931)
a60ca9d71c [examples] Update AprilTag field load API usage (#4975)
f8a45f1558 [wpimath] Remove print statements from tests (#4977)
ecba8b99a8 [examples] Fix swapped arguments in MecanumControllerCommand example (#4976)
e95e88fdf9 [examples] Add comment to drivedistanceoffboard example (#4877)
371d15dec3 [examples] Add Computer Vision Pose Estimation and Latency Compensation Example (#4901)
cb9b8938af [sim] Enable docking in the GUI (#4960)
3b084ecbe0 [apriltag] AprilTagFieldLayout: Improve API shape for loading builtin JSONs (#4949)
27ba096ea1 [wpilib] Fix MOI calculation error in SingleJointedArmSim (#4968)
42c997a3c4 [wpimath] Fix Pose3d exponential and clean up Pose3d logarithm (#4970)
5f1a025f27 [wpilibj] Fix typo in MecanumDrive docs (NFC) (#4969)
0ebf79b54c [wpimath] Fix typo in Pose3d::Exp() docs (NFC) (#4966)
a8c465f3fb [wpimath] HolonomicDriveController: Add getters for the controllers (#4948)
a7b1ab683d [wpilibc] Add unit test for fast deconstruction of GenericHID (#4953)
bd6479dc29 [build] Add Spotless for JSON (#4956)
5cb0340a8c [hal, wpilib] Load joystick values upon code initialization (#4950)
ab0e8c37a7 [readme] Update build requirements (NFC) (#4947)
b74ac1c645 [build] Add apriltag to C++ cmake example builds (#4944)
cf1a411acf [examples] Add example programs for AprilTags detection (#4932)
1e05b21ab5 [wpimath] Fix PID atSetpoint to not return true prematurely (#4906)
e5a6197633 [wpimath] Fix SwerveDriveKinematics not initializing a new array each time (#4942)
039edcc23f [ntcore] Queue current value on subscriber creation (#4938)
f7f19207e0 [wpimath] Allow multiple vision measurements from same timestamp (#4917)
befd12911c [commands] Delete UB-causing rvalue variants of CommandPtr methods (#4923)
34519de60a [commands] Fix spacing in command composition exception (#4924)
dc4355c031 [hal] Add handle constructor and name getters for sim devices (#4925)
53d8d33bca [hal, wpilibj] Add missing distance per pulse functions to EncoderSim (#4928)
530ae40614 [apriltag] Explain what April tag poses represent (NFC) (#4930)
79f565191e [examples] DigitalCommunication, I2CCommunication: Add tests (#4865)
2cd9be413f [wpilib, examples] Cleanup PotentiometerPID, Ultrasonic, UltrasonicPID examples (#4893)
babb0c1fcf [apriltag] Add 2023 field layout JSON (#4912)
330ba45f9c [wpimath] Fix swerve kinematics util classes equals function (#4907)
51272ef6b3 [fieldImages] Add 2023 field (#4915)
0d105ab771 [commands] Deduplicate command test utils (#4897)
cf4235ea36 [wpiutil] Guard MSVC pragma in SymbolExports.h (#4911)
2d4b7b9147 [build] Update opencv version in opencv.gradle (#4909)
aec6f3d506 [ntcore] Fix client flush behavior (#4903)
bfe346c76a [build] Fix cmake java resources (#4898)

Change-Id: Ia1dd90fe42c6cd5df281b8a5b710e136f54355f4
git-subtree-dir: third_party/allwpilib
git-subtree-split: f1a82828fed8950f9a3f1586c44327027627a0c8
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch b/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch
new file mode 100644
index 0000000..4d9603f
--- /dev/null
+++ b/upstream_utils/libuv_patches/0002-Fix-missing-casts.patch
@@ -0,0 +1,1642 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: PJ Reiniger <pj.reiniger@gmail.com>
+Date: Tue, 26 Apr 2022 15:01:25 -0400
+Subject: [PATCH 02/10] Fix missing casts
+
+---
+ src/fs-poll.c                  | 10 ++++----
+ src/inet.c                     | 11 ++++----
+ src/strscpy.c                  |  2 +-
+ src/thread-common.c            |  2 +-
+ src/threadpool.c               |  2 +-
+ src/unix/bsd-ifaddrs.c         |  2 +-
+ src/unix/core.c                | 18 ++++++-------
+ src/unix/darwin-proctitle.c    |  5 ++--
+ src/unix/darwin.c              |  2 +-
+ src/unix/freebsd.c             |  4 +--
+ src/unix/fs.c                  | 20 +++++++--------
+ src/unix/fsevents.c            | 34 ++++++++++++-------------
+ src/unix/getaddrinfo.c         |  8 +++---
+ src/unix/ibmi.c                |  2 +-
+ src/unix/kqueue.c              |  6 ++---
+ src/unix/linux.c               | 46 +++++++++++++++++-----------------
+ src/unix/loop.c                |  2 +-
+ src/unix/netbsd.c              |  4 +--
+ src/unix/openbsd.c             |  4 +--
+ src/unix/pipe.c                |  4 +--
+ src/unix/poll.c                |  4 +--
+ src/unix/posix-poll.c          |  2 +-
+ src/unix/process.c             |  4 +--
+ src/unix/proctitle.c           |  2 +-
+ src/unix/random-sysctl-linux.c |  2 +-
+ src/unix/stream.c              | 31 ++++++++++++-----------
+ src/unix/thread.c              |  5 ++--
+ src/unix/udp.c                 |  8 +++---
+ src/uv-common.c                | 16 ++++++------
+ src/win/core.c                 |  8 +++---
+ src/win/fs-event.c             |  4 +--
+ src/win/fs-fd-hash-inl.h       |  2 +-
+ src/win/fs.c                   | 28 ++++++++++-----------
+ src/win/pipe.c                 | 12 ++++-----
+ src/win/process.c              | 12 ++++-----
+ src/win/tcp.c                  |  2 +-
+ src/win/thread.c               |  4 +--
+ src/win/util.c                 | 27 ++++++++++----------
+ 38 files changed, 183 insertions(+), 178 deletions(-)
+
+diff --git a/src/fs-poll.c b/src/fs-poll.c
+index 1bac1c568e36cadd0b68451926c6f045f88342d2..5a39daed095502b2db34f23fcaf0ab04f31f96ff 100644
+--- a/src/fs-poll.c
++++ b/src/fs-poll.c
+@@ -77,7 +77,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
+ 
+   loop = handle->loop;
+   len = strlen(path);
+-  ctx = uv__calloc(1, sizeof(*ctx) + len);
++  ctx = (struct poll_ctx*)uv__calloc(1, sizeof(*ctx) + len);
+ 
+   if (ctx == NULL)
+     return UV_ENOMEM;
+@@ -101,7 +101,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
+     goto error;
+ 
+   if (handle->poll_ctx != NULL)
+-    ctx->previous = handle->poll_ctx;
++    ctx->previous = (struct poll_ctx*)handle->poll_ctx;
+   handle->poll_ctx = ctx;
+   uv__handle_start(handle);
+ 
+@@ -119,7 +119,7 @@ int uv_fs_poll_stop(uv_fs_poll_t* handle) {
+   if (!uv_is_active((uv_handle_t*)handle))
+     return 0;
+ 
+-  ctx = handle->poll_ctx;
++  ctx = (struct poll_ctx*)handle->poll_ctx;
+   assert(ctx != NULL);
+   assert(ctx->parent_handle == handle);
+ 
+@@ -144,7 +144,7 @@ int uv_fs_poll_getpath(uv_fs_poll_t* handle, char* buffer, size_t* size) {
+     return UV_EINVAL;
+   }
+ 
+-  ctx = handle->poll_ctx;
++  ctx = (struct poll_ctx*)handle->poll_ctx;
+   assert(ctx != NULL);
+ 
+   required_len = strlen(ctx->path);
+@@ -244,7 +244,7 @@ static void timer_close_cb(uv_handle_t* timer) {
+     if (handle->poll_ctx == NULL && uv__is_closing(handle))
+       uv__make_close_pending((uv_handle_t*)handle);
+   } else {
+-    for (last = handle->poll_ctx, it = last->previous;
++    for (last = (struct poll_ctx*)handle->poll_ctx, it = last->previous;
+          it != ctx;
+          last = it, it = it->previous) {
+       assert(last->previous != NULL);
+diff --git a/src/inet.c b/src/inet.c
+index cd77496846e90e8b8e61c63c10f498f153344fe5..dd94bea3886ca37945fcad7909d765e3700e3c21 100644
+--- a/src/inet.c
++++ b/src/inet.c
+@@ -35,9 +35,9 @@ static int inet_pton6(const char *src, unsigned char *dst);
+ int uv_inet_ntop(int af, const void* src, char* dst, size_t size) {
+   switch (af) {
+   case AF_INET:
+-    return (inet_ntop4(src, dst, size));
++    return (inet_ntop4((const unsigned char*)src, dst, size));
+   case AF_INET6:
+-    return (inet_ntop6(src, dst, size));
++    return (inet_ntop6((const unsigned char*)src, dst, size));
+   default:
+     return UV_EAFNOSUPPORT;
+   }
+@@ -149,10 +149,11 @@ int uv_inet_pton(int af, const char* src, void* dst) {
+ 
+   switch (af) {
+   case AF_INET:
+-    return (inet_pton4(src, dst));
++    return (inet_pton4(src, (unsigned char*)dst));
+   case AF_INET6: {
+     int len;
+-    char tmp[UV__INET6_ADDRSTRLEN], *s, *p;
++    char tmp[UV__INET6_ADDRSTRLEN], *s;
++    const char *p;
+     s = (char*) src;
+     p = strchr(src, '%');
+     if (p != NULL) {
+@@ -163,7 +164,7 @@ int uv_inet_pton(int af, const char* src, void* dst) {
+       memcpy(s, src, len);
+       s[len] = '\0';
+     }
+-    return inet_pton6(s, dst);
++    return inet_pton6(s, (unsigned char*)dst);
+   }
+   default:
+     return UV_EAFNOSUPPORT;
+diff --git a/src/strscpy.c b/src/strscpy.c
+index 20df6fcbed29e9d944c866ddbcd5c09345a426b3..6b4cc3bc741b40b9c2b13d4c06e7090f8083a7ba 100644
+--- a/src/strscpy.c
++++ b/src/strscpy.c
+@@ -27,7 +27,7 @@ ssize_t uv__strscpy(char* d, const char* s, size_t n) {
+ 
+   for (i = 0; i < n; i++)
+     if ('\0' == (d[i] = s[i]))
+-      return i > SSIZE_MAX ? UV_E2BIG : (ssize_t) i;
++      return i > SSIZE_MAX ? (ssize_t) UV_E2BIG : (ssize_t) i;
+ 
+   if (i == 0)
+     return 0;
+diff --git a/src/thread-common.c b/src/thread-common.c
+index c67c0a7dd7279af6c67b7d5d4a623c47bdf3fff2..c0e39b543df229dd8cb8492bb695e61e40911453 100644
+--- a/src/thread-common.c
++++ b/src/thread-common.c
+@@ -49,7 +49,7 @@ int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
+   if (barrier == NULL || count == 0)
+     return UV_EINVAL;
+ 
+-  b = uv__malloc(sizeof(*b));
++  b = (struct _uv_barrier *)uv__malloc(sizeof(*b));
+   if (b == NULL)
+     return UV_ENOMEM;
+ #endif
+diff --git a/src/threadpool.c b/src/threadpool.c
+index dbef67f2f10f1df498f228c21eba2a71ceceee29..f572de5aaf1a1b150e58c7b989949441cac279c4 100644
+--- a/src/threadpool.c
++++ b/src/threadpool.c
+@@ -207,7 +207,7 @@ static void init_threads(void) {
+ 
+   threads = default_threads;
+   if (nthreads > ARRAY_SIZE(default_threads)) {
+-    threads = uv__malloc(nthreads * sizeof(threads[0]));
++    threads = (uv_thread_t*)uv__malloc(nthreads * sizeof(threads[0]));
+     if (threads == NULL) {
+       nthreads = ARRAY_SIZE(default_threads);
+       threads = default_threads;
+diff --git a/src/unix/bsd-ifaddrs.c b/src/unix/bsd-ifaddrs.c
+index 11ca95591fc38244e931fecd9dd4038d3968af7a..c3dd71a1889bfae08cfdf95acda61e6c3472bd2c 100644
+--- a/src/unix/bsd-ifaddrs.c
++++ b/src/unix/bsd-ifaddrs.c
+@@ -92,7 +92,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+   }
+ 
+   /* Make sure the memory is initiallized to zero using calloc() */
+-  *addresses = uv__calloc(*count, sizeof(**addresses));
++  *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
+ 
+   if (*addresses == NULL) {
+     freeifaddrs(addrs);
+diff --git a/src/unix/core.c b/src/unix/core.c
+index 25c5181f370e94983e8a5f797f02f7a8dc207e00..28c036f94f3e76717afa651451969f128c5a573c 100644
+--- a/src/unix/core.c
++++ b/src/unix/core.c
+@@ -855,7 +855,7 @@ static unsigned int next_power_of_two(unsigned int val) {
+ }
+ 
+ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
+-  uv__io_t** watchers;
++  void** watchers;
+   void* fake_watcher_list;
+   void* fake_watcher_count;
+   unsigned int nwatchers;
+@@ -874,8 +874,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
+   }
+ 
+   nwatchers = next_power_of_two(len + 2) - 2;
+-  watchers = uv__reallocf(loop->watchers,
+-                          (nwatchers + 2) * sizeof(loop->watchers[0]));
++  watchers = (void**)
++      uv__reallocf(loop->watchers, (nwatchers + 2) * sizeof(loop->watchers[0]));
+ 
+   if (watchers == NULL)
+     abort();
+@@ -884,7 +884,7 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
+   watchers[nwatchers] = fake_watcher_list;
+   watchers[nwatchers + 1] = fake_watcher_count;
+ 
+-  loop->watchers = watchers;
++  loop->watchers = (uv__io_t**)watchers;
+   loop->nwatchers = nwatchers;
+ }
+ 
+@@ -1216,7 +1216,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) {
+    * is frequently 1024 or 4096, so we can just use that directly. The pwent
+    * will not usually be large. */
+   for (bufsize = 2000;; bufsize *= 2) {
+-    buf = uv__malloc(bufsize);
++    buf = (char*)uv__malloc(bufsize);
+ 
+     if (buf == NULL)
+       return UV_ENOMEM;
+@@ -1242,7 +1242,7 @@ static int uv__getpwuid_r(uv_passwd_t *pwd, uid_t uid) {
+   name_size = strlen(pw.pw_name) + 1;
+   homedir_size = strlen(pw.pw_dir) + 1;
+   shell_size = strlen(pw.pw_shell) + 1;
+-  pwd->username = uv__malloc(name_size + homedir_size + shell_size);
++  pwd->username = (char*)uv__malloc(name_size + homedir_size + shell_size);
+ 
+   if (pwd->username == NULL) {
+     uv__free(buf);
+@@ -1292,7 +1292,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) {
+    * is frequently 1024 or 4096, so we can just use that directly. The pwent
+    * will not usually be large. */
+   for (bufsize = 2000;; bufsize *= 2) {
+-    buf = uv__malloc(bufsize);
++    buf = (char*)uv__malloc(bufsize);
+ 
+     if (buf == NULL)
+       return UV_ENOMEM;
+@@ -1323,7 +1323,7 @@ int uv_os_get_group(uv_group_t* grp, uv_uid_t gid) {
+     members++;
+   }
+ 
+-  gr_mem = uv__malloc(name_size + mem_size);
++  gr_mem = (char*)uv__malloc(name_size + mem_size);
+   if (gr_mem == NULL) {
+     uv__free(buf);
+     return UV_ENOMEM;
+@@ -1380,7 +1380,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
+ 
+   for (i = 0; environ[i] != NULL; i++);
+ 
+-  *envitems = uv__calloc(i, sizeof(**envitems));
++  *envitems = (uv_env_item_s*)uv__calloc(i, sizeof(**envitems));
+ 
+   if (*envitems == NULL)
+     return UV_ENOMEM;
+diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c
+index 5288083ef04fd78d90c34071cc76281adbc310d8..9bd55dd764b845cf8ea441d525b4e136699eb52e 100644
+--- a/src/unix/darwin-proctitle.c
++++ b/src/unix/darwin-proctitle.c
+@@ -128,8 +128,9 @@ int uv__set_process_title(const char* title) {
+   if (pLSSetApplicationInformationItem == NULL)
+     goto out;
+ 
+-  display_name_key = pCFBundleGetDataPointerForName(launch_services_bundle,
+-                                                    S("_kLSDisplayNameKey"));
++  display_name_key = (CFStringRef*)
++      pCFBundleGetDataPointerForName(launch_services_bundle,
++                                     S("_kLSDisplayNameKey"));
+ 
+   if (display_name_key == NULL || *display_name_key == NULL)
+     goto out;
+diff --git a/src/unix/darwin.c b/src/unix/darwin.c
+index 90790d701c4327518d17230c5aa69b9a74112e73..9ee5cd8eb9d02fb8b71986c47fe8a686f0983847 100644
+--- a/src/unix/darwin.c
++++ b/src/unix/darwin.c
+@@ -217,7 +217,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+     return UV_EINVAL;  /* FIXME(bnoordhuis) Translate error. */
+   }
+ 
+-  *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++  *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+   if (!(*cpu_infos)) {
+     vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type);
+     return UV_ENOMEM;
+diff --git a/src/unix/freebsd.c b/src/unix/freebsd.c
+index 191bc8bc213ffddb15c5e04baa66e2a0a8d69a3d..1bd63886b823be6451ac013d94e29885795375b7 100644
+--- a/src/unix/freebsd.c
++++ b/src/unix/freebsd.c
+@@ -220,7 +220,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+   if (sysctlbyname("hw.ncpu", &numcpus, &size, NULL, 0))
+     return UV__ERR(errno);
+ 
+-  *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++  *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+   if (!(*cpu_infos))
+     return UV_ENOMEM;
+ 
+@@ -237,7 +237,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ 
+   size = maxcpus * CPUSTATES * sizeof(long);
+ 
+-  cp_times = uv__malloc(size);
++  cp_times = (long*)uv__malloc(size);
+   if (cp_times == NULL) {
+     uv__free(*cpu_infos);
+     return UV_ENOMEM;
+diff --git a/src/unix/fs.c b/src/unix/fs.c
+index 6b051c124f2fd9b0f72b41d7d7ba9c715e9686e1..e25d02e54dbe93e4b9c22b0140108c99ae2cb4f7 100644
+--- a/src/unix/fs.c
++++ b/src/unix/fs.c
+@@ -140,7 +140,7 @@ extern char *mkdtemp(char *template); /* See issue #740 on AIX < 7 */
+       size_t new_path_len;                                                    \
+       path_len = strlen(path) + 1;                                            \
+       new_path_len = strlen(new_path) + 1;                                    \
+-      req->path = uv__malloc(path_len + new_path_len);                        \
++      req->path = (char*)uv__malloc(path_len + new_path_len);                 \
+       if (req->path == NULL)                                                  \
+         return UV_ENOMEM;                                                     \
+       req->new_path = req->path + path_len;                                   \
+@@ -568,7 +568,7 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
+ static int uv__fs_opendir(uv_fs_t* req) {
+   uv_dir_t* dir;
+ 
+-  dir = uv__malloc(sizeof(*dir));
++  dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
+   if (dir == NULL)
+     goto error;
+ 
+@@ -592,7 +592,7 @@ static int uv__fs_readdir(uv_fs_t* req) {
+   unsigned int dirent_idx;
+   unsigned int i;
+ 
+-  dir = req->ptr;
++  dir = (uv_dir_t*)req->ptr;
+   dirent_idx = 0;
+ 
+   while (dirent_idx < dir->nentries) {
+@@ -634,7 +634,7 @@ error:
+ static int uv__fs_closedir(uv_fs_t* req) {
+   uv_dir_t* dir;
+ 
+-  dir = req->ptr;
++  dir = (uv_dir_t*)req->ptr;
+ 
+   if (dir->dir != NULL) {
+     closedir(dir->dir);
+@@ -663,7 +663,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
+ #endif /* defined(__sun) */
+     return -1;
+ 
+-  stat_fs = uv__malloc(sizeof(*stat_fs));
++  stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
+   if (stat_fs == NULL) {
+     errno = ENOMEM;
+     return -1;
+@@ -727,7 +727,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
+     maxlen = uv__fs_pathmax_size(req->path);
+ #endif
+ 
+-  buf = uv__malloc(maxlen);
++  buf = (char*)uv__malloc(maxlen);
+ 
+   if (buf == NULL) {
+     errno = ENOMEM;
+@@ -747,7 +747,7 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) {
+ 
+   /* Uncommon case: resize to make room for the trailing nul byte. */
+   if (len == maxlen) {
+-    buf = uv__reallocf(buf, len + 1);
++    buf = (char*)uv__reallocf(buf, len + 1);
+ 
+     if (buf == NULL)
+       return -1;
+@@ -770,7 +770,7 @@ static ssize_t uv__fs_realpath(uv_fs_t* req) {
+   ssize_t len;
+ 
+   len = uv__fs_pathmax_size(req->path);
+-  buf = uv__malloc(len + 1);
++  buf = (char*)uv__malloc(len + 1);
+ 
+   if (buf == NULL) {
+     errno = ENOMEM;
+@@ -1984,7 +1984,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req,
+   req->nbufs = nbufs;
+   req->bufs = req->bufsml;
+   if (nbufs > ARRAY_SIZE(req->bufsml))
+-    req->bufs = uv__malloc(nbufs * sizeof(*bufs));
++    req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+ 
+   if (req->bufs == NULL)
+     return UV_ENOMEM;
+@@ -2171,7 +2171,7 @@ int uv_fs_write(uv_loop_t* loop,
+   req->nbufs = nbufs;
+   req->bufs = req->bufsml;
+   if (nbufs > ARRAY_SIZE(req->bufsml))
+-    req->bufs = uv__malloc(nbufs * sizeof(*bufs));
++    req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+ 
+   if (req->bufs == NULL)
+     return UV_ENOMEM;
+diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c
+index df703f3635fc95bab21debc9697dba06a2a44827..c31d08ba37cfd10672ab6a7a8fd38a1c79b952fe 100644
+--- a/src/unix/fsevents.c
++++ b/src/unix/fsevents.c
+@@ -183,7 +183,7 @@ static void (*pFSEventStreamStop)(FSEventStreamRef);
+ static void uv__fsevents_cb(uv_async_t* cb) {
+   uv_fs_event_t* handle;
+ 
+-  handle = cb->data;
++  handle = (uv_fs_event_t*)cb->data;
+ 
+   UV__FSEVENTS_PROCESS(handle, {
+     handle->cb(handle, event->path[0] ? event->path : NULL, event->events, 0);
+@@ -231,10 +231,10 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
+   FSEventStreamEventFlags flags;
+   struct uv__queue head;
+ 
+-  loop = info;
+-  state = loop->cf_state;
++  loop = (uv_loop_t*)info;
++  state = (uv__cf_loop_state_t*)loop->cf_state;
+   assert(state != NULL);
+-  paths = eventPaths;
++  paths = (char**)eventPaths;
+ 
+   /* For each handle */
+   uv_mutex_lock(&state->fsevent_mutex);
+@@ -304,7 +304,7 @@ static void uv__fsevents_event_cb(const FSEventStreamRef streamRef,
+           continue;
+       }
+ 
+-      event = uv__malloc(sizeof(*event) + len);
++      event = (uv__fsevents_event_t*)uv__malloc(sizeof(*event) + len);
+       if (event == NULL)
+         break;
+ 
+@@ -438,7 +438,7 @@ static void uv__fsevents_reschedule(uv__cf_loop_state_t* state,
+   uv_mutex_lock(&state->fsevent_mutex);
+   path_count = state->fsevent_handle_count;
+   if (path_count != 0) {
+-    paths = uv__malloc(sizeof(*paths) * path_count);
++    paths = (CFStringRef*)uv__malloc(sizeof(*paths) * path_count);
+     if (paths == NULL) {
+       uv_mutex_unlock(&state->fsevent_mutex);
+       goto final;
+@@ -594,7 +594,7 @@ static int uv__fsevents_loop_init(uv_loop_t* loop) {
+   if (err)
+     return err;
+ 
+-  state = uv__calloc(1, sizeof(*state));
++  state = (uv__cf_loop_state_t*)uv__calloc(1, sizeof(*state));
+   if (state == NULL)
+     return UV_ENOMEM;
+ 
+@@ -696,7 +696,7 @@ void uv__fsevents_loop_delete(uv_loop_t* loop) {
+   }
+ 
+   /* Destroy state */
+-  state = loop->cf_state;
++  state = (uv__cf_loop_state_t*)loop->cf_state;
+   uv_sem_destroy(&state->fsevent_sem);
+   uv_mutex_destroy(&state->fsevent_mutex);
+   pCFRelease(state->signal_source);
+@@ -710,8 +710,8 @@ static void* uv__cf_loop_runner(void* arg) {
+   uv_loop_t* loop;
+   uv__cf_loop_state_t* state;
+ 
+-  loop = arg;
+-  state = loop->cf_state;
++  loop = (uv_loop_t*)arg;
++  state = (uv__cf_loop_state_t*)loop->cf_state;
+   state->loop = pCFRunLoopGetCurrent();
+ 
+   pCFRunLoopAddSource(state->loop,
+@@ -739,8 +739,8 @@ static void uv__cf_loop_cb(void* arg) {
+   struct uv__queue split_head;
+   uv__cf_loop_signal_t* s;
+ 
+-  loop = arg;
+-  state = loop->cf_state;
++  loop = (uv_loop_t*)arg;
++  state = (uv__cf_loop_state_t*)loop->cf_state;
+ 
+   uv_mutex_lock(&loop->cf_mutex);
+   uv__queue_move(&loop->cf_signals, &split_head);
+@@ -770,7 +770,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
+   uv__cf_loop_signal_t* item;
+   uv__cf_loop_state_t* state;
+ 
+-  item = uv__malloc(sizeof(*item));
++  item = (uv__cf_loop_signal_t*)uv__malloc(sizeof(*item));
+   if (item == NULL)
+     return UV_ENOMEM;
+ 
+@@ -780,7 +780,7 @@ int uv__cf_loop_signal(uv_loop_t* loop,
+   uv_mutex_lock(&loop->cf_mutex);
+   uv__queue_insert_tail(&loop->cf_signals, &item->member);
+ 
+-  state = loop->cf_state;
++  state = (uv__cf_loop_state_t*)loop->cf_state;
+   assert(state != NULL);
+   pCFRunLoopSourceSignal(state->signal_source);
+   pCFRunLoopWakeUp(state->loop);
+@@ -814,7 +814,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
+    * Events will occur in other thread.
+    * Initialize callback for getting them back into event loop's thread
+    */
+-  handle->cf_cb = uv__malloc(sizeof(*handle->cf_cb));
++  handle->cf_cb = (uv_async_t*)uv__malloc(sizeof(*handle->cf_cb));
+   if (handle->cf_cb == NULL) {
+     err = UV_ENOMEM;
+     goto fail_cf_cb_malloc;
+@@ -830,7 +830,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
+     goto fail_cf_mutex_init;
+ 
+   /* Insert handle into the list */
+-  state = handle->loop->cf_state;
++  state = (uv__cf_loop_state_t*)handle->loop->cf_state;
+   uv_mutex_lock(&state->fsevent_mutex);
+   uv__queue_insert_tail(&state->fsevent_handles, &handle->cf_member);
+   state->fsevent_handle_count++;
+@@ -870,7 +870,7 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
+     return UV_EINVAL;
+ 
+   /* Remove handle from  the list */
+-  state = handle->loop->cf_state;
++  state = (uv__cf_loop_state_t*)handle->loop->cf_state;
+   uv_mutex_lock(&state->fsevent_mutex);
+   uv__queue_remove(&handle->cf_member);
+   state->fsevent_handle_count--;
+diff --git a/src/unix/getaddrinfo.c b/src/unix/getaddrinfo.c
+index 77337ace9454e032a392c97cb9aa311f15518956..41dc3909969a643e129847ae3a3252d51feadb27 100644
+--- a/src/unix/getaddrinfo.c
++++ b/src/unix/getaddrinfo.c
+@@ -172,7 +172,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
+   hostname_len = hostname ? strlen(hostname) + 1 : 0;
+   service_len = service ? strlen(service) + 1 : 0;
+   hints_len = hints ? sizeof(*hints) : 0;
+-  buf = uv__malloc(hostname_len + service_len + hints_len);
++  buf = (char*)uv__malloc(hostname_len + service_len + hints_len);
+ 
+   if (buf == NULL)
+     return UV_ENOMEM;
+@@ -190,17 +190,17 @@ int uv_getaddrinfo(uv_loop_t* loop,
+   len = 0;
+ 
+   if (hints) {
+-    req->hints = memcpy(buf + len, hints, sizeof(*hints));
++    req->hints = (struct addrinfo*)memcpy(buf + len, hints, sizeof(*hints));
+     len += sizeof(*hints);
+   }
+ 
+   if (service) {
+-    req->service = memcpy(buf + len, service, service_len);
++    req->service = (char*)memcpy(buf + len, service, service_len);
+     len += service_len;
+   }
+ 
+   if (hostname)
+-    req->hostname = memcpy(buf + len, hostname, hostname_len);
++    req->hostname = (char*)memcpy(buf + len, hostname, hostname_len);
+ 
+   if (cb) {
+     uv__work_submit(loop,
+diff --git a/src/unix/ibmi.c b/src/unix/ibmi.c
+index 837bba6e2fef7b834a8d104d263bef47eaed0950..5e0fa98d104428534e5264a1c6358e3f68c58b82 100644
+--- a/src/unix/ibmi.c
++++ b/src/unix/ibmi.c
+@@ -293,7 +293,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ 
+   numcpus = sysconf(_SC_NPROCESSORS_ONLN);
+ 
+-  *cpu_infos = uv__malloc(numcpus * sizeof(uv_cpu_info_t));
++  *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(uv_cpu_info_t));
+   if (!*cpu_infos) {
+     return UV_ENOMEM;
+   }
+diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c
+index b78242d3be4e3cf6b7b998f56dc65213982d4bc7..28e55aae6c613576ede7024a5c73d746e134d865 100644
+--- a/src/unix/kqueue.c
++++ b/src/unix/kqueue.c
+@@ -299,8 +299,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
+     nevents = 0;
+ 
+     assert(loop->watchers != NULL);
+-    loop->watchers[loop->nwatchers] = (void*) events;
+-    loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
++    loop->watchers[loop->nwatchers] = (uv__io_t*) events;
++    loop->watchers[loop->nwatchers + 1] = (uv__io_t*) (uintptr_t) nfds;
+     for (i = 0; i < nfds; i++) {
+       ev = events + i;
+       fd = ev->ident;
+@@ -322,7 +322,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
+       /* Skip invalidated events, see uv__platform_invalidate_fd */
+       if (fd == -1)
+         continue;
+-      w = loop->watchers[fd];
++      w = (uv__io_t*)loop->watchers[fd];
+ 
+       if (w == NULL) {
+         /* File descriptor that we've stopped watching, disarm it. */
+diff --git a/src/unix/linux.c b/src/unix/linux.c
+index 48b9c2c43e104079d3ccb5d830d1d79f891fb1a3..9173850bd158eaf9c41deca38f9ba84762a027a1 100644
+--- a/src/unix/linux.c
++++ b/src/unix/linux.c
+@@ -456,8 +456,8 @@ static void uv__iou_init(int epollfd,
+   char* sqe;
+   int ringfd;
+ 
+-  sq = MAP_FAILED;
+-  sqe = MAP_FAILED;
++  sq = (char*)MAP_FAILED;
++  sqe = (char*)MAP_FAILED;
+ 
+   if (!uv__use_io_uring())
+     return;
+@@ -496,14 +496,14 @@ static void uv__iou_init(int epollfd,
+   maxlen = sqlen < cqlen ? cqlen : sqlen;
+   sqelen = params.sq_entries * sizeof(struct uv__io_uring_sqe);
+ 
+-  sq = mmap(0,
++  sq = (char*)mmap(0,
+             maxlen,
+             PROT_READ | PROT_WRITE,
+             MAP_SHARED | MAP_POPULATE,
+             ringfd,
+             0);  /* IORING_OFF_SQ_RING */
+ 
+-  sqe = mmap(0,
++  sqe = (char*)mmap(0,
+              sqelen,
+              PROT_READ | PROT_WRITE,
+              MAP_SHARED | MAP_POPULATE,
+@@ -643,7 +643,7 @@ void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
+   int i;
+ 
+   lfields = uv__get_internal_fields(loop);
+-  inv = lfields->inv;
++  inv = (uv__invalidate*)lfields->inv;
+ 
+   /* Invalidate events with same file descriptor */
+   if (inv != NULL)
+@@ -718,7 +718,7 @@ static struct uv__io_uring_sqe* uv__iou_get_sqe(struct uv__iou* iou,
+     return NULL;  /* No room in ring buffer. TODO(bnoordhuis) maybe flush it? */
+ 
+   slot = tail & mask;
+-  sqe = iou->sqe;
++  sqe = (uv__io_uring_sqe*)iou->sqe;
+   sqe = &sqe[slot];
+   memset(sqe, 0, sizeof(*sqe));
+   sqe->user_data = (uintptr_t) req;
+@@ -986,7 +986,7 @@ int uv__iou_fs_statx(uv_loop_t* loop,
+   struct uv__statx* statxbuf;
+   struct uv__iou* iou;
+ 
+-  statxbuf = uv__malloc(sizeof(*statxbuf));
++  statxbuf = (struct uv__statx*)uv__malloc(sizeof(*statxbuf));
+   if (statxbuf == NULL)
+     return 0;
+ 
+@@ -1050,7 +1050,7 @@ static void uv__iou_fs_statx_post(uv_fs_t* req) {
+   uv_stat_t* buf;
+ 
+   buf = &req->statbuf;
+-  statxbuf = req->ptr;
++  statxbuf = (struct uv__statx*)req->ptr;
+   req->ptr = NULL;
+ 
+   if (req->result == 0) {
+@@ -1079,7 +1079,7 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) {
+   tail = atomic_load_explicit((_Atomic uint32_t*) iou->cqtail,
+                               memory_order_acquire);
+   mask = iou->cqmask;
+-  cqe = iou->cqe;
++  cqe = (uv__io_uring_cqe*)iou->cqe;
+   nevents = 0;
+ 
+   for (i = head; i != tail; i++) {
+@@ -1170,7 +1170,7 @@ static void uv__epoll_ctl_prep(int epollfd,
+     pe = &(*events)[slot];
+     *pe = *e;
+ 
+-    sqe = ctl->sqe;
++    sqe = (uv__io_uring_sqe*)ctl->sqe;
+     sqe = &sqe[slot];
+ 
+     memset(sqe, 0, sizeof(*sqe));
+@@ -1226,7 +1226,7 @@ static void uv__epoll_ctl_flush(int epollfd,
+   while (*ctl->cqhead != *ctl->cqtail) {
+     slot = (*ctl->cqhead)++ & ctl->cqmask;
+ 
+-    cqe = ctl->cqe;
++    cqe = (uv__io_uring_cqe*)ctl->cqe;
+     cqe = &cqe[slot];
+ 
+     if (cqe->res == 0)
+@@ -1708,7 +1708,7 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) {
+   snprintf(*models, sizeof(*models), "unknown");
+   maxcpu = 0;
+ 
+-  cpus = uv__calloc(ARRAY_SIZE(*cpus), sizeof(**cpus));
++  cpus = (decltype(cpus))uv__calloc(ARRAY_SIZE(*cpus), sizeof(**cpus));
+   if (cpus == NULL)
+     return UV_ENOMEM;
+ 
+@@ -1764,9 +1764,9 @@ int uv_cpu_info(uv_cpu_info_t** ci, int* count) {
+ 
+     /* arm64: translate CPU part code to model name. */
+     if (*parts) {
+-      p = memmem(parts, sizeof(parts) - 1, p, n + 1);
++      p = (char*)memmem(parts, sizeof(parts) - 1, p, n + 1);
+       if (p == NULL)
+-        p = "unknown";
++        p = const_cast<char*>("unknown");
+       else
+         p += n + 1;
+       n = (int) strcspn(p, "\n");
+@@ -1815,7 +1815,7 @@ nocpuinfo:
+   }
+ 
+   size = n * sizeof(**ci) + sizeof(models);
+-  *ci = uv__malloc(size);
++  *ci = (uv_cpu_info_t*)uv__malloc(size);
+   *count = 0;
+ 
+   if (*ci == NULL) {
+@@ -1824,7 +1824,7 @@ nocpuinfo:
+   }
+ 
+   *count = n;
+-  p = memcpy(*ci + n, models, sizeof(models));
++  p = (char*)memcpy(*ci + n, models, sizeof(models));
+ 
+   i = 0;
+   for (cpu = 0; cpu < maxcpu; cpu++) {
+@@ -1833,19 +1833,19 @@ nocpuinfo:
+ 
+     c = *cpus + cpu;
+ 
+-    (*ci)[i++] = (uv_cpu_info_t) {
++    (*ci)[i++] = uv_cpu_info_t{
+       .model     = p + c->model * sizeof(*model),
+-      .speed     = c->freq / 1000,
++      .speed     = (int)(c->freq / 1000),
+       /* Note: sysconf(_SC_CLK_TCK) is fixed at 100 Hz,
+        * therefore the multiplier is always 1000/100 = 10.
+        */
+-      .cpu_times = (struct uv_cpu_times_s) {
++      .cpu_times = {
+         .user = 10 * c->user,
+         .nice = 10 * c->nice,
+         .sys  = 10 * c->sys,
+         .idle = 10 * c->idle,
+         .irq  = 10 * c->irq,
+-      },
++      }
+     };
+   }
+ 
+@@ -1902,7 +1902,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+   }
+ 
+   /* Make sure the memory is initiallized to zero using calloc() */
+-  *addresses = uv__calloc(*count, sizeof(**addresses));
++  *addresses = (uv_interface_address_t*)uv__calloc(*count, sizeof(**addresses));
+   if (!(*addresses)) {
+     freeifaddrs(addrs);
+     return UV_ENOMEM;
+@@ -2470,12 +2470,12 @@ int uv_fs_event_start(uv_fs_event_t* handle,
+     goto no_insert;
+ 
+   len = strlen(path) + 1;
+-  w = uv__malloc(sizeof(*w) + len);
++  w = (watcher_list*)uv__malloc(sizeof(*w) + len);
+   if (w == NULL)
+     return UV_ENOMEM;
+ 
+   w->wd = wd;
+-  w->path = memcpy(w + 1, path, len);
++  w->path = (char*)memcpy(w + 1, path, len);
+   uv__queue_init(&w->watchers);
+   w->iterating = 0;
+   RB_INSERT(watcher_root, uv__inotify_watchers(loop), w);
+diff --git a/src/unix/loop.c b/src/unix/loop.c
+index a9468e8e19cbede795032980c47eb83aee1e0c68..3babe4d701949ebc69d74f7dedee33c777d89892 100644
+--- a/src/unix/loop.c
++++ b/src/unix/loop.c
+@@ -148,7 +148,7 @@ int uv_loop_fork(uv_loop_t* loop) {
+ 
+   /* Rearm all the watchers that aren't re-queued by the above. */
+   for (i = 0; i < loop->nwatchers; i++) {
+-    w = loop->watchers[i];
++    w = (uv__io_t*)loop->watchers[i];
+     if (w == NULL)
+       continue;
+ 
+diff --git a/src/unix/netbsd.c b/src/unix/netbsd.c
+index fa21e98e41aec8b7d8bc46c299c4c20a7a0c3f0c..4c6d5a24fe896d89e3b2f1db1dc2b1dd7d010aec 100644
+--- a/src/unix/netbsd.c
++++ b/src/unix/netbsd.c
+@@ -211,14 +211,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+     cpuspeed = 0;
+ 
+   size = numcpus * CPUSTATES * sizeof(*cp_times);
+-  cp_times = uv__malloc(size);
++  cp_times = (u_int64_t*)uv__malloc(size);
+   if (cp_times == NULL)
+     return UV_ENOMEM;
+ 
+   if (sysctlbyname("kern.cp_time", cp_times, &size, NULL, 0))
+     return UV__ERR(errno);
+ 
+-  *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++  *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+   if (!(*cpu_infos)) {
+     uv__free(cp_times);
+     uv__free(*cpu_infos);
+diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c
+index 9c863b6c90dad9864cb8341c2b6203c1390a9487..2aa61e2ee3321d91ba84887c7ed6dcfa23d00ccf 100644
+--- a/src/unix/openbsd.c
++++ b/src/unix/openbsd.c
+@@ -72,7 +72,7 @@ int uv_exepath(char* buffer, size_t* size) {
+   mypid = getpid();
+   for (;;) {
+     err = UV_ENOMEM;
+-    argsbuf = uv__reallocf(argsbuf, argsbuf_size);
++    argsbuf = (char**)uv__reallocf(argsbuf, argsbuf_size);
+     if (argsbuf == NULL)
+       goto out;
+     mib[0] = CTL_KERN;
+@@ -202,7 +202,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+   if (sysctl(which, ARRAY_SIZE(which), &numcpus, &size, NULL, 0))
+     return UV__ERR(errno);
+ 
+-  *cpu_infos = uv__malloc(numcpus * sizeof(**cpu_infos));
++  *cpu_infos = (uv_cpu_info_t*)uv__malloc(numcpus * sizeof(**cpu_infos));
+   if (!(*cpu_infos))
+     return UV_ENOMEM;
+ 
+diff --git a/src/unix/pipe.c b/src/unix/pipe.c
+index d332f3518303d6ef1dee1d835c392bb60b935bad..a60b1a0e442bb3c482575da117f30e9f119f55d3 100644
+--- a/src/unix/pipe.c
++++ b/src/unix/pipe.c
+@@ -377,7 +377,7 @@ int uv_pipe_pending_count(uv_pipe_t* handle) {
+   if (handle->queued_fds == NULL)
+     return 1;
+ 
+-  queued_fds = handle->queued_fds;
++  queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
+   return queued_fds->offset + 1;
+ }
+ 
+@@ -414,7 +414,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
+   if (r != UV_ENOBUFS)
+     return r;
+ 
+-  name_buffer = uv__malloc(name_len);
++  name_buffer = (char*)uv__malloc(name_len);
+   if (name_buffer == NULL)
+     return UV_ENOMEM;
+ 
+diff --git a/src/unix/poll.c b/src/unix/poll.c
+index 7a12e2d1488a9d48712439e62c6637b9e1161f69..c21722b2e8eef4d16c523f7319fb57c3167d8dd9 100644
+--- a/src/unix/poll.c
++++ b/src/unix/poll.c
+@@ -117,7 +117,7 @@ int uv_poll_stop(uv_poll_t* handle) {
+ 
+ 
+ int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
+-  uv__io_t** watchers;
++  void** watchers;
+   uv__io_t* w;
+   int events;
+ 
+@@ -125,7 +125,7 @@ int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
+                       UV_PRIORITIZED)) == 0);
+   assert(!uv__is_closing(handle));
+ 
+-  watchers = handle->loop->watchers;
++  watchers = (void**)handle->loop->watchers;
+   w = &handle->io_watcher;
+ 
+   if (uv__fd_exists(handle->loop, w->fd))
+diff --git a/src/unix/posix-poll.c b/src/unix/posix-poll.c
+index 2e016c2fbaed2eeccd78080969a86aff821a4251..b71eee3f01a3f30b3b5efef539194139f258009a 100644
+--- a/src/unix/posix-poll.c
++++ b/src/unix/posix-poll.c
+@@ -61,7 +61,7 @@ static void uv__pollfds_maybe_resize(uv_loop_t* loop) {
+     return;
+ 
+   n = loop->poll_fds_size ? loop->poll_fds_size * 2 : 64;
+-  p = uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
++  p = (struct pollfd*)uv__reallocf(loop->poll_fds, n * sizeof(*loop->poll_fds));
+   if (p == NULL)
+     abort();
+ 
+diff --git a/src/unix/process.c b/src/unix/process.c
+index dd58c18d9b9359fca1a924698c39bd6390dafbe0..2d622c956de6d7b6f8a04be3ecd311f39602b241 100644
+--- a/src/unix/process.c
++++ b/src/unix/process.c
+@@ -423,7 +423,7 @@ static int posix_spawn_can_use_setsid;
+ static void uv__spawn_init_posix_spawn_fncs(void) {
+   /* Try to locate all non-portable functions at runtime */
+   posix_spawn_fncs.file_actions.addchdir_np =
+-    dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
++    (int (*)(void* const*, const char*)) dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");
+ }
+ 
+ 
+@@ -988,7 +988,7 @@ int uv_spawn(uv_loop_t* loop,
+   err = UV_ENOMEM;
+   pipes = pipes_storage;
+   if (stdio_count > (int) ARRAY_SIZE(pipes_storage))
+-    pipes = uv__malloc(stdio_count * sizeof(*pipes));
++    pipes = (int (*)[2])uv__malloc(stdio_count * sizeof(*pipes));
+ 
+   if (pipes == NULL)
+     goto error;
+diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c
+index 9d1f00ddf66e291abd40d0c0052a7f9bd5c03017..8cdec753d003ebe16485db2b47ffb3863a9473ff 100644
+--- a/src/unix/proctitle.c
++++ b/src/unix/proctitle.c
+@@ -65,7 +65,7 @@ char** uv_setup_args(int argc, char** argv) {
+   /* Add space for the argv pointers. */
+   size += (argc + 1) * sizeof(char*);
+ 
+-  new_argv = uv__malloc(size);
++  new_argv = (char**)uv__malloc(size);
+   if (new_argv == NULL)
+     return argv;
+ 
+diff --git a/src/unix/random-sysctl-linux.c b/src/unix/random-sysctl-linux.c
+index 66ba8d74ec22b72d318b91d82365f5b9693feb3c..9ef18df01a51aa6a26ae6d1d9660a819d18604d0 100644
+--- a/src/unix/random-sysctl-linux.c
++++ b/src/unix/random-sysctl-linux.c
+@@ -48,7 +48,7 @@ int uv__random_sysctl(void* buf, size_t buflen) {
+   char* pe;
+   size_t n;
+ 
+-  p = buf;
++  p = (char*)buf;
+   pe = p + buflen;
+ 
+   while (p < pe) {
+diff --git a/src/unix/stream.c b/src/unix/stream.c
+index 28c4d5463c4622725a433b8807e5e7bde580dadd..265ddade7aec129eb9dbf07cde2a16a0e341d1a7 100644
+--- a/src/unix/stream.c
++++ b/src/unix/stream.c
+@@ -123,7 +123,7 @@ static void uv__stream_osx_interrupt_select(uv_stream_t* stream) {
+   uv__stream_select_t* s;
+   int r;
+ 
+-  s = stream->select;
++  s = (uv__stream_select_t*)stream->select;
+   if (s == NULL)
+     return;
+ 
+@@ -152,8 +152,8 @@ static void uv__stream_osx_select(void* arg) {
+   int r;
+   int max_fd;
+ 
+-  stream = arg;
+-  s = stream->select;
++  stream = (uv_stream_t*)arg;
++  s = (uv__stream_select_t*)stream->select;
+   fd = s->fd;
+ 
+   if (fd > s->int_fd)
+@@ -330,7 +330,7 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
+   sread_sz = ROUND_UP(max_fd + 1, sizeof(uint32_t) * NBBY) / NBBY;
+   swrite_sz = sread_sz;
+ 
+-  s = uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
++  s = (uv__stream_select_t*)uv__malloc(sizeof(*s) + sread_sz + swrite_sz);
+   if (s == NULL) {
+     err = UV_ENOMEM;
+     goto failed_malloc;
+@@ -573,7 +573,7 @@ done:
+   if (server->queued_fds != NULL) {
+     uv__stream_queued_fds_t* queued_fds;
+ 
+-    queued_fds = server->queued_fds;
++    queued_fds = (uv__stream_queued_fds_t*)(server->queued_fds);
+ 
+     /* Read first */
+     server->accepted_fd = queued_fds->fds[0];
+@@ -942,11 +942,12 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
+   uv__stream_queued_fds_t* queued_fds;
+   unsigned int queue_size;
+ 
+-  queued_fds = stream->queued_fds;
++  queued_fds = (uv__stream_queued_fds_t*)stream->queued_fds;
+   if (queued_fds == NULL) {
+     queue_size = 8;
+-    queued_fds = uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
+-                            sizeof(*queued_fds));
++    queued_fds = (uv__stream_queued_fds_t*)
++        uv__malloc((queue_size - 1) * sizeof(*queued_fds->fds) +
++                   sizeof(*queued_fds));
+     if (queued_fds == NULL)
+       return UV_ENOMEM;
+     queued_fds->size = queue_size;
+@@ -956,9 +957,9 @@ static int uv__stream_queue_fd(uv_stream_t* stream, int fd) {
+     /* Grow */
+   } else if (queued_fds->size == queued_fds->offset) {
+     queue_size = queued_fds->size + 8;
+-    queued_fds = uv__realloc(queued_fds,
+-                             (queue_size - 1) * sizeof(*queued_fds->fds) +
+-                              sizeof(*queued_fds));
++    queued_fds = (uv__stream_queued_fds_t*)
++        uv__realloc(queued_fds, (queue_size - 1) * sizeof(*queued_fds->fds) +
++                    sizeof(*queued_fds));
+ 
+     /*
+      * Allocation failure, report back.
+@@ -1356,7 +1357,7 @@ int uv_write2(uv_write_t* req,
+ 
+   req->bufs = req->bufsml;
+   if (nbufs > ARRAY_SIZE(req->bufsml))
+-    req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
++    req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
+ 
+   if (req->bufs == NULL)
+     return UV_ENOMEM;
+@@ -1490,7 +1491,7 @@ int uv___stream_fd(const uv_stream_t* handle) {
+          handle->type == UV_TTY ||
+          handle->type == UV_NAMED_PIPE);
+ 
+-  s = handle->select;
++  s = (const uv__stream_select_t*)handle->select;
+   if (s != NULL)
+     return s->fd;
+ 
+@@ -1508,7 +1509,7 @@ void uv__stream_close(uv_stream_t* handle) {
+   if (handle->select != NULL) {
+     uv__stream_select_t* s;
+ 
+-    s = handle->select;
++    s = (uv__stream_select_t*)handle->select;
+ 
+     uv_sem_post(&s->close_sem);
+     uv_sem_post(&s->async_sem);
+@@ -1543,7 +1544,7 @@ void uv__stream_close(uv_stream_t* handle) {
+ 
+   /* Close all queued fds */
+   if (handle->queued_fds != NULL) {
+-    queued_fds = handle->queued_fds;
++    queued_fds = (uv__stream_queued_fds_t*)(handle->queued_fds);
+     for (i = 0; i < queued_fds->offset; i++)
+       uv__close(queued_fds->fds[i]);
+     uv__free(handle->queued_fds);
+diff --git a/src/unix/thread.c b/src/unix/thread.c
+index 4d6f4b8232ec6dc0bd27258a1315340e3e272ae9..531c6211bb4321e5f11031a0644b4e3ab9174396 100644
+--- a/src/unix/thread.c
++++ b/src/unix/thread.c
+@@ -168,8 +168,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
+       abort();
+   }
+ 
+-  f.in = entry;
+-  err = pthread_create(tid, attr, f.out, arg);
++  err = pthread_create(tid, attr, (void*(*)(void*)) (void(*)(void)) entry, arg);
+ 
+   if (attr != NULL)
+     pthread_attr_destroy(attr);
+@@ -540,7 +539,7 @@ static int uv__custom_sem_init(uv_sem_t* sem_, unsigned int value) {
+   int err;
+   uv_semaphore_t* sem;
+ 
+-  sem = uv__malloc(sizeof(*sem));
++  sem = (uv_semaphore_t*)uv__malloc(sizeof(*sem));
+   if (sem == NULL)
+     return UV_ENOMEM;
+ 
+diff --git a/src/unix/udp.c b/src/unix/udp.c
+index c2814512a5f507ceb9e764cdb7c6ff3d36e77974..cbee16b22a36b1c82e74f6a81c3811052e9b8482 100644
+--- a/src/unix/udp.c
++++ b/src/unix/udp.c
+@@ -191,11 +191,11 @@ static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {
+       if (msgs[k].msg_hdr.msg_flags & MSG_TRUNC)
+         flags |= UV_UDP_PARTIAL;
+ 
+-      chunk_buf = uv_buf_init(iov[k].iov_base, iov[k].iov_len);
++      chunk_buf = uv_buf_init((char*) iov[k].iov_base, iov[k].iov_len);
+       handle->recv_cb(handle,
+                       msgs[k].msg_len,
+                       &chunk_buf,
+-                      msgs[k].msg_hdr.msg_name,
++                      (const sockaddr*) msgs[k].msg_hdr.msg_name,
+                       flags);
+     }
+ 
+@@ -245,7 +245,7 @@ static void uv__udp_recvmsg(uv_udp_t* handle) {
+     memset(&peer, 0, sizeof(peer));
+     h.msg_name = &peer;
+     h.msg_namelen = sizeof(peer);
+-    h.msg_iov = (void*) &buf;
++    h.msg_iov = (iovec*) &buf;
+     h.msg_iovlen = 1;
+ 
+     do {
+@@ -719,7 +719,7 @@ int uv__udp_send(uv_udp_send_t* req,
+ 
+   req->bufs = req->bufsml;
+   if (nbufs > ARRAY_SIZE(req->bufsml))
+-    req->bufs = uv__malloc(nbufs * sizeof(bufs[0]));
++    req->bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(bufs[0]));
+ 
+   if (req->bufs == NULL) {
+     uv__req_unregister(handle->loop, req);
+diff --git a/src/uv-common.c b/src/uv-common.c
+index 916f3f4e00664ab47f94d2a6ee7c6a9ef0461389..c04f93596ab1f730576256d86e216ccb7f258b72 100644
+--- a/src/uv-common.c
++++ b/src/uv-common.c
+@@ -54,10 +54,10 @@ static uv__allocator_t uv__allocator = {
+ 
+ char* uv__strdup(const char* s) {
+   size_t len = strlen(s) + 1;
+-  char* m = uv__malloc(len);
++  char* m = (char*)uv__malloc(len);
+   if (m == NULL)
+     return NULL;
+-  return memcpy(m, s, len);
++  return (char*)memcpy(m, s, len);
+ }
+ 
+ char* uv__strndup(const char* s, size_t n) {
+@@ -65,11 +65,11 @@ char* uv__strndup(const char* s, size_t n) {
+   size_t len = strlen(s);
+   if (n < len)
+     len = n;
+-  m = uv__malloc(len + 1);
++  m = (char*)uv__malloc(len + 1);
+   if (m == NULL)
+     return NULL;
+   m[len] = '\0';
+-  return memcpy(m, s, len);
++  return (char*)memcpy(m, s, len);
+ }
+ 
+ void* uv__malloc(size_t size) {
+@@ -688,7 +688,7 @@ void uv__fs_scandir_cleanup(uv_fs_t* req) {
+   unsigned int n;
+ 
+   if (req->result >= 0) {
+-    dents = req->ptr;
++    dents = (uv__dirent_t**)(req->ptr);
+     nbufs = uv__get_nbufs(req);
+ 
+     i = 0;
+@@ -721,7 +721,7 @@ int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) {
+   nbufs = uv__get_nbufs(req);
+   assert(nbufs);
+ 
+-  dents = req->ptr;
++  dents = (uv__dirent_t**)(req->ptr);
+ 
+   /* Free previous entity */
+   if (*nbufs > 0)
+@@ -786,7 +786,7 @@ void uv__fs_readdir_cleanup(uv_fs_t* req) {
+   if (req->ptr == NULL)
+     return;
+ 
+-  dir = req->ptr;
++  dir = (uv_dir_t*)req->ptr;
+   dirents = dir->dirents;
+   req->ptr = NULL;
+ 
+@@ -832,7 +832,7 @@ uv_loop_t* uv_default_loop(void) {
+ uv_loop_t* uv_loop_new(void) {
+   uv_loop_t* loop;
+ 
+-  loop = uv__malloc(sizeof(*loop));
++  loop = (uv_loop_t*)uv__malloc(sizeof(*loop));
+   if (loop == NULL)
+     return NULL;
+ 
+diff --git a/src/win/core.c b/src/win/core.c
+index e9885a0f1ff3890a8d957c8793e22b01cedc0e97..87ade7ad65243ee3ff940320f84e1960390300e1 100644
+--- a/src/win/core.c
++++ b/src/win/core.c
+@@ -98,7 +98,8 @@ static int uv__loops_add(uv_loop_t* loop) {
+ 
+   if (uv__loops_size == uv__loops_capacity) {
+     new_capacity = uv__loops_capacity + UV__LOOPS_CHUNK_SIZE;
+-    new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
++    new_loops = (uv_loop_t**)
++        uv__realloc(uv__loops, sizeof(uv_loop_t*) * new_capacity);
+     if (!new_loops)
+       goto failed_loops_realloc;
+     uv__loops = new_loops;
+@@ -152,7 +153,8 @@ static void uv__loops_remove(uv_loop_t* loop) {
+   smaller_capacity = uv__loops_capacity / 2;
+   if (uv__loops_size >= smaller_capacity)
+     goto loop_removed;
+-  new_loops = uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
++  new_loops = (uv_loop_t**)
++      uv__realloc(uv__loops, sizeof(uv_loop_t*) * smaller_capacity);
+   if (!new_loops)
+     goto loop_removed;
+   uv__loops = new_loops;
+@@ -264,7 +266,7 @@ int uv_loop_init(uv_loop_t* loop) {
+ 
+   loop->endgame_handles = NULL;
+ 
+-  loop->timer_heap = timer_heap = uv__malloc(sizeof(*timer_heap));
++  loop->timer_heap = timer_heap = (heap*)uv__malloc(sizeof(*timer_heap));
+   if (timer_heap == NULL) {
+     err = UV_ENOMEM;
+     goto fail_timers_alloc;
+diff --git a/src/win/fs-event.c b/src/win/fs-event.c
+index 6758c7c78bc1d6a5316a8ae7dc2d1e23cd0f32bc..150467313d576bfe2966b55f3d8cffa23cbb8ea3 100644
+--- a/src/win/fs-event.c
++++ b/src/win/fs-event.c
+@@ -73,7 +73,7 @@ static void uv__relative_path(const WCHAR* filename,
+   if (dirlen > 0 && dir[dirlen - 1] == '\\')
+     dirlen--;
+   relpathlen = filenamelen - dirlen - 1;
+-  *relpath = uv__malloc((relpathlen + 1) * sizeof(WCHAR));
++  *relpath = (WCHAR*)uv__malloc((relpathlen + 1) * sizeof(WCHAR));
+   if (!*relpath)
+     uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+   wcsncpy(*relpath, filename + dirlen + 1, relpathlen);
+@@ -242,7 +242,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
+     if (short_path_buffer_len == 0) {
+       goto short_path_done;
+     }
+-    short_path_buffer = uv__malloc(short_path_buffer_len * sizeof(WCHAR));
++    short_path_buffer = (WCHAR*)uv__malloc(short_path_buffer_len * sizeof(WCHAR));
+     if (short_path_buffer == NULL) {
+       goto short_path_done;
+     }
+diff --git a/src/win/fs-fd-hash-inl.h b/src/win/fs-fd-hash-inl.h
+index 0b532af12d4371c2311bd50a66913287a0716f43..703a8d8f87de1089ac8b18bd817d416d48dc442e 100644
+--- a/src/win/fs-fd-hash-inl.h
++++ b/src/win/fs-fd-hash-inl.h
+@@ -146,7 +146,7 @@ INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) {
+ 
+     if (bucket_ptr->size != 0 && i == 0) {
+       struct uv__fd_hash_entry_group_s* new_group_ptr =
+-        uv__malloc(sizeof(*new_group_ptr));
++        (struct uv__fd_hash_entry_group_s*)uv__malloc(sizeof(*new_group_ptr));
+       if (new_group_ptr == NULL) {
+         uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+       }
+diff --git a/src/win/fs.c b/src/win/fs.c
+index fc209c54f470edaa031009979061cff071cbf66d..328c8f2e0513562b53c948ffea59d0841e14b264 100644
+--- a/src/win/fs.c
++++ b/src/win/fs.c
+@@ -258,7 +258,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
+     return 0;
+   }
+ 
+-  buf = uv__malloc(buf_sz);
++  buf = (WCHAR *)uv__malloc(buf_sz);
+   if (buf == NULL) {
+     return ERROR_OUTOFMEMORY;
+   }
+@@ -376,7 +376,7 @@ static int fs__wide_to_wtf8(WCHAR* w_source_ptr,
+     return 0;
+ 
+   if (*target_ptr == NULL) {
+-    target = uv__malloc(target_len + 1);
++    target = (char *)uv__malloc(target_len + 1);
+     if (target == NULL) {
+       SetLastError(ERROR_OUTOFMEMORY);
+       return -1;
+@@ -1575,7 +1575,7 @@ void fs__scandir(uv_fs_t* req) {
+       if (dirents_used >= dirents_size) {
+         size_t new_dirents_size =
+             dirents_size == 0 ? dirents_initial_size : dirents_size << 1;
+-        uv__dirent_t** new_dirents =
++        uv__dirent_t** new_dirents = (uv__dirent_t**)
+             uv__realloc(dirents, new_dirents_size * sizeof *dirents);
+ 
+         if (new_dirents == NULL)
+@@ -1589,7 +1589,7 @@ void fs__scandir(uv_fs_t* req) {
+        * includes room for the first character of the filename, but `utf8_len`
+        * doesn't count the NULL terminator at this point.
+        */
+-      dirent = uv__malloc(sizeof *dirent + wtf8_len);
++      dirent = (uv__dirent_t*)uv__malloc(sizeof *dirent + wtf8_len);
+       if (dirent == NULL)
+         goto out_of_memory_error;
+ 
+@@ -1691,7 +1691,7 @@ void fs__opendir(uv_fs_t* req) {
+     goto error;
+   }
+ 
+-  dir = uv__malloc(sizeof(*dir));
++  dir = (uv_dir_t*)uv__malloc(sizeof(*dir));
+   if (dir == NULL) {
+     SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+     goto error;
+@@ -1706,7 +1706,7 @@ void fs__opendir(uv_fs_t* req) {
+   else
+     fmt = L"%s\\*";
+ 
+-  find_path = uv__malloc(sizeof(WCHAR) * (len + 4));
++  find_path = (WCHAR*)uv__malloc(sizeof(WCHAR) * (len + 4));
+   if (find_path == NULL) {
+     SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+     goto error;
+@@ -1743,7 +1743,7 @@ void fs__readdir(uv_fs_t* req) {
+   int r;
+ 
+   req->flags |= UV_FS_FREE_PTR;
+-  dir = req->ptr;
++  dir = (uv_dir_t*)req->ptr;
+   dirents = dir->dirents;
+   memset(dirents, 0, dir->nentries * sizeof(*dir->dirents));
+   find_data = &dir->find_data;
+@@ -1800,7 +1800,7 @@ error:
+ void fs__closedir(uv_fs_t* req) {
+   uv_dir_t* dir;
+ 
+-  dir = req->ptr;
++  dir = (uv_dir_t*)req->ptr;
+   FindClose(dir->dir_handle);
+   uv__free(req->ptr);
+   SET_REQ_RESULT(req, 0);
+@@ -2791,7 +2791,7 @@ static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) {
+     return -1;
+   }
+ 
+-  w_realpath_buf = uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
++  w_realpath_buf = (WCHAR*)uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
+   if (w_realpath_buf == NULL) {
+     SetLastError(ERROR_OUTOFMEMORY);
+     return -1;
+@@ -2904,7 +2904,7 @@ retry_get_disk_free_space:
+     }
+ 
+     len = MAX_PATH + 1;
+-    pathw = uv__malloc(len * sizeof(*pathw));
++    pathw = (WCHAR*)uv__malloc(len * sizeof(*pathw));
+     if (pathw == NULL) {
+       SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+       return;
+@@ -2920,7 +2920,7 @@ retry_get_full_path_name:
+       return;
+     } else if (ret > len) {
+       len = ret;
+-      pathw = uv__reallocf(pathw, len * sizeof(*pathw));
++      pathw = (WCHAR*)uv__reallocf(pathw, len * sizeof(*pathw));
+       if (pathw == NULL) {
+         SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+         return;
+@@ -2936,7 +2936,7 @@ retry_get_full_path_name:
+     uv__free(pathw);
+   }
+ 
+-  stat_fs = uv__malloc(sizeof(*stat_fs));
++  stat_fs = (uv_statfs_t*)uv__malloc(sizeof(*stat_fs));
+   if (stat_fs == NULL) {
+     SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+     return;
+@@ -3095,7 +3095,7 @@ int uv_fs_read(uv_loop_t* loop,
+   req->fs.info.nbufs = nbufs;
+   req->fs.info.bufs = req->fs.info.bufsml;
+   if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
+-    req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
++    req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+ 
+   if (req->fs.info.bufs == NULL) {
+     SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+@@ -3128,7 +3128,7 @@ int uv_fs_write(uv_loop_t* loop,
+   req->fs.info.nbufs = nbufs;
+   req->fs.info.bufs = req->fs.info.bufsml;
+   if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
+-    req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
++    req->fs.info.bufs = (uv_buf_t*)uv__malloc(nbufs * sizeof(*bufs));
+ 
+   if (req->fs.info.bufs == NULL) {
+     SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
+diff --git a/src/win/pipe.c b/src/win/pipe.c
+index f0cac3822564e14052feb5e1934f54c57c78160d..c1739efe82b8755999145860b4da6b50c73518a2 100644
+--- a/src/win/pipe.c
++++ b/src/win/pipe.c
+@@ -756,7 +756,7 @@ int uv_pipe_bind2(uv_pipe_t* handle,
+ 
+   /* Convert name to UTF16. */
+   nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR);
+-  handle->name = uv__malloc(nameSize);
++  handle->name = (WCHAR*)uv__malloc(nameSize);
+   if (!handle->name) {
+     uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+   }
+@@ -906,7 +906,7 @@ int uv_pipe_connect2(uv_connect_t* req,
+ 
+   /* Convert name to UTF16. */
+   nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0) * sizeof(WCHAR);
+-  handle->name = uv__malloc(nameSize);
++  handle->name = (WCHAR*)uv__malloc(nameSize);
+   if (!handle->name) {
+     uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+   }
+@@ -924,7 +924,7 @@ int uv_pipe_connect2(uv_connect_t* req,
+   pipeHandle = open_named_pipe(handle->name, &duplex_flags);
+   if (pipeHandle == INVALID_HANDLE_VALUE) {
+     if (GetLastError() == ERROR_PIPE_BUSY) {
+-      req->u.connect.name = uv__malloc(nameSize);
++      req->u.connect.name = (WCHAR *)uv__malloc(nameSize);
+       if (!req->u.connect.name) {
+         uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+       }
+@@ -1528,7 +1528,7 @@ static int uv__build_coalesced_write_req(uv_write_t* user_req,
+                        data_length;                  /* (c) */
+ 
+   /* Allocate buffer. */
+-  heap_buffer = uv__malloc(heap_buffer_length);
++  heap_buffer = (char*)uv__malloc(heap_buffer_length);
+   if (heap_buffer == NULL)
+     return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
+ 
+@@ -1777,7 +1777,7 @@ int uv__pipe_write_ipc(uv_loop_t* loop,
+     bufs = stack_bufs;
+   } else {
+     /* Use heap-allocated buffer array. */
+-    bufs = uv__calloc(buf_count, sizeof(uv_buf_t));
++    bufs = (uv_buf_t*)uv__calloc(buf_count, sizeof(uv_buf_t));
+     if (bufs == NULL)
+       return ERROR_NOT_ENOUGH_MEMORY; /* Maps to UV_ENOMEM. */
+   }
+@@ -2514,7 +2514,7 @@ static int uv__pipe_getname(const uv_pipe_t* handle, char* buffer, size_t* size)
+                                       FileNameInformation);
+   if (nt_status == STATUS_BUFFER_OVERFLOW) {
+     name_size = sizeof(*name_info) + tmp_name_info.FileNameLength;
+-    name_info = uv__malloc(name_size);
++    name_info = (FILE_NAME_INFORMATION*)uv__malloc(name_size);
+     if (!name_info) {
+       *size = 0;
+       err = UV_ENOMEM;
+diff --git a/src/win/process.c b/src/win/process.c
+index ed44adc67c6d52785a199206d9ba0357e2d0b045..b383e8b405db56d413985b38df216d09c58ec4a0 100644
+--- a/src/win/process.c
++++ b/src/win/process.c
+@@ -615,8 +615,8 @@ error:
+ 
+ 
+ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
+-  wchar_t* a_eq;
+-  wchar_t* b_eq;
++  const wchar_t* a_eq;
++  const wchar_t* b_eq;
+   wchar_t* A;
+   wchar_t* B;
+   int nb;
+@@ -633,8 +633,8 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
+   assert(b_eq);
+   nb = b_eq - b;
+ 
+-  A = alloca((na+1) * sizeof(wchar_t));
+-  B = alloca((nb+1) * sizeof(wchar_t));
++  A = (wchar_t*)alloca((na+1) * sizeof(wchar_t));
++  B = (wchar_t*)alloca((nb+1) * sizeof(wchar_t));
+ 
+   r = LCMapStringW(LOCALE_INVARIANT, LCMAP_UPPERCASE, a, na, A, na);
+   assert(r==na);
+@@ -717,7 +717,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
+   if (dst_copy == NULL && env_len > 0) {
+     return ERROR_OUTOFMEMORY;
+   }
+-  env_copy = alloca(env_block_count * sizeof(WCHAR*));
++  env_copy = (WCHAR**)alloca(env_block_count * sizeof(WCHAR*));
+ 
+   ptr = dst_copy;
+   ptr_copy = env_copy;
+@@ -771,7 +771,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
+   }
+ 
+   /* final pass: copy, in sort order, and inserting required variables */
+-  dst = uv__malloc((1+env_len) * sizeof(WCHAR));
++  dst = (WCHAR*)uv__malloc((1+env_len) * sizeof(WCHAR));
+   if (!dst) {
+     uv__free(dst_copy);
+     return ERROR_OUTOFMEMORY;
+diff --git a/src/win/tcp.c b/src/win/tcp.c
+index 187f36e2a61c870b0d16e17e9d4a9e1161ba8851..d8da4d941a51b0625fc0c072342ec4edf74c0ea3 100644
+--- a/src/win/tcp.c
++++ b/src/win/tcp.c
+@@ -585,7 +585,7 @@ int uv__tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
+ 
+   if (handle->tcp.serv.accept_reqs == NULL) {
+     handle->tcp.serv.accept_reqs =
+-      uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
++      (uv_tcp_accept_t*)uv__malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
+     if (!handle->tcp.serv.accept_reqs) {
+       uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
+     }
+diff --git a/src/win/thread.c b/src/win/thread.c
+index 57c25e8f5a861c9d8a4c402c260d3ac235200423..57f1698f595e2410a51044f7f228b5a235206819 100644
+--- a/src/win/thread.c
++++ b/src/win/thread.c
+@@ -98,7 +98,7 @@ static UINT __stdcall uv__thread_start(void* arg) {
+   struct thread_ctx *ctx_p;
+   struct thread_ctx ctx;
+ 
+-  ctx_p = arg;
++  ctx_p = (struct thread_ctx*)arg;
+   ctx = *ctx_p;
+   uv__free(ctx_p);
+ 
+@@ -141,7 +141,7 @@ int uv_thread_create_ex(uv_thread_t* tid,
+       return UV_EINVAL;
+   }
+ 
+-  ctx = uv__malloc(sizeof(*ctx));
++  ctx = (struct thread_ctx*)uv__malloc(sizeof(*ctx));
+   if (ctx == NULL)
+     return UV_ENOMEM;
+ 
+diff --git a/src/win/util.c b/src/win/util.c
+index f6ec79cd57b5010ed5fd6829d952bcdacc8b7671..1cfd7b2caf0d4ad1a6a66df9406c21f4e2b69b04 100644
+--- a/src/win/util.c
++++ b/src/win/util.c
+@@ -160,7 +160,7 @@ static int uv__cwd(WCHAR** buf, DWORD *len) {
+       return uv_translate_sys_error(GetLastError());
+ 
+     /* |t| is the size of the buffer _including_ nul. */
+-    p = uv__malloc(t * sizeof(*p));
++    p = (WCHAR *)uv__malloc(t * sizeof(*p));
+     if (p == NULL)
+       return UV_ENOMEM;
+ 
+@@ -265,7 +265,7 @@ int uv_chdir(const char* dir) {
+   if (utf16_len == 0) {
+     return uv_translate_sys_error(GetLastError());
+   }
+-  utf16_buffer = uv__malloc(utf16_len * sizeof(WCHAR));
++  utf16_buffer = (WCHAR*)uv__malloc(utf16_len * sizeof(WCHAR));
+   if (utf16_buffer == NULL) {
+     return UV_ENOMEM;
+   }
+@@ -623,14 +623,14 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
+   GetSystemInfo(&system_info);
+   cpu_count = system_info.dwNumberOfProcessors;
+ 
+-  cpu_infos = uv__calloc(cpu_count, sizeof *cpu_infos);
++  cpu_infos = (uv_cpu_info_t*)uv__calloc(cpu_count, sizeof *cpu_infos);
+   if (cpu_infos == NULL) {
+     err = ERROR_OUTOFMEMORY;
+     goto error;
+   }
+ 
+   sppi_size = cpu_count * sizeof(*sppi);
+-  sppi = uv__malloc(sppi_size);
++  sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)uv__malloc(sppi_size);
+   if (sppi == NULL) {
+     err = ERROR_OUTOFMEMORY;
+     goto error;
+@@ -774,7 +774,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
+       case ERROR_BUFFER_OVERFLOW:
+         /* This happens when win_address_buf is NULL or too small to hold all
+          * adapters. */
+-        win_address_buf = uv__malloc(win_address_buf_size);
++        win_address_buf =
++            (IP_ADAPTER_ADDRESSES*)uv__malloc(win_address_buf_size);
+         if (win_address_buf == NULL)
+           return UV_ENOMEM;
+ 
+@@ -782,7 +783,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
+ 
+       case ERROR_NO_DATA: {
+         /* No adapters were found. */
+-        uv_address_buf = uv__malloc(1);
++        uv_address_buf = (uv_interface_address_t*)uv__malloc(1);
+         if (uv_address_buf == NULL)
+           return UV_ENOMEM;
+ 
+@@ -859,7 +860,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
+   }
+ 
+   /* Allocate space to store interface data plus adapter names. */
+-  uv_address_buf = uv__malloc(uv_address_buf_size);
++  uv_address_buf = (uv_interface_address_t*)uv__malloc(uv_address_buf_size);
+   if (uv_address_buf == NULL) {
+     uv__free(win_address_buf);
+     return UV_ENOMEM;
+@@ -1074,7 +1075,7 @@ int uv_os_tmpdir(char* buffer, size_t* size) {
+   }
+   /* Include space for terminating null char. */
+   len += 1;
+-  path = uv__malloc(len * sizeof(wchar_t));
++  path = (wchar_t*)uv__malloc(len * sizeof(wchar_t));
+   if (path == NULL) {
+     return UV_ENOMEM;
+   }
+@@ -1153,7 +1154,7 @@ int uv__convert_utf16_to_utf8(const WCHAR* utf16, int utf16len, char** utf8) {
+   /* Allocate the destination buffer adding an extra byte for the terminating
+    * NULL. If utf16len is not -1 WideCharToMultiByte will not add it, so
+    * we do it ourselves always, just in case. */
+-  *utf8 = uv__malloc(bufsize + 1);
++  *utf8 = (char*)uv__malloc(bufsize + 1);
+ 
+   if (*utf8 == NULL)
+     return UV_ENOMEM;
+@@ -1201,7 +1202,7 @@ int uv__convert_utf8_to_utf16(const char* utf8, int utf8len, WCHAR** utf16) {
+   /* Allocate the destination buffer adding an extra byte for the terminating
+    * NULL. If utf8len is not -1 MultiByteToWideChar will not add it, so
+    * we do it ourselves always, just in case. */
+-  *utf16 = uv__malloc(sizeof(WCHAR) * (bufsize + 1));
++  *utf16 = (WCHAR*)uv__malloc(sizeof(WCHAR) * (bufsize + 1));
+ 
+   if (*utf16 == NULL)
+     return UV_ENOMEM;
+@@ -1242,7 +1243,7 @@ static int uv__getpwuid_r(uv_passwd_t* pwd) {
+     return uv_translate_sys_error(r);
+   }
+ 
+-  path = uv__malloc(bufsize * sizeof(wchar_t));
++  path = (wchar_t*)uv__malloc(bufsize * sizeof(wchar_t));
+   if (path == NULL) {
+     CloseHandle(token);
+     return UV_ENOMEM;
+@@ -1323,7 +1324,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
+ 
+   for (penv = env, i = 0; *penv != L'\0'; penv += wcslen(penv) + 1, i++);
+ 
+-  *envitems = uv__calloc(i, sizeof(**envitems));
++  *envitems = (uv_env_item_t*)uv__calloc(i, sizeof(**envitems));
+   if (*envitems == NULL) {
+     FreeEnvironmentStringsW(env);
+     return UV_ENOMEM;
+@@ -1413,7 +1414,7 @@ int uv_os_getenv(const char* name, char* buffer, size_t* size) {
+       uv__free(var);
+ 
+     varlen = 1 + len;
+-    var = uv__malloc(varlen * sizeof(*var));
++    var = (wchar_t*)uv__malloc(varlen * sizeof(*var));
+ 
+     if (var == NULL) {
+       r = UV_ENOMEM;