Fix signed/unsigned comparisons, fix potential division by 0
Squash unused parameter warning
Use provided buffer size
Clean unused variables and parameters
Remove unused variable
Comment out unused parameter
Use a #define to squash the 'function defined but not used' warning
Don't use C++17 functions, as this breaks Windows cross-compilation