lfreist / hwinfo

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)
MIT License
433 stars 74 forks source link

Refactor variable type in CPU utility percentage methods #55

Closed troldal closed 11 months ago

troldal commented 11 months ago

In the CPU class methods currentUtility_Percentage and currentThreadUtility_Percentage, the type of the query variable was changed from std::string& to const std::string&. This was done to prevent inadvertent modification of the query string in those methods, improving code safety. The 'const int&' parameter in currentThreadUtility_Percentage method was also refactored to 'int' for simplicity since integers are cheap to copy.

troldal commented 11 months ago

With this PR, the project builds (and runs) without any errors on MSVC and clang-cl on Windows, as well as gcc on Ubuntu (using WSL). I haven't tested on my Mac yet, but I foresee no problems.

troldal commented 11 months ago

Done. There are now some warnings on the MSVC build, but it works fine.