JDimproved / JDim

2ch browser for linux
https://jdimproved.github.io/JDim/
GNU General Public License v2.0
44 stars 11 forks source link

Fix compiler warnings for -Wenum-float-conversion #1284

Closed ma8ma closed 8 months ago

ma8ma commented 8 months ago

無名列挙型の値がdobule型の変数と算術演算しているとコンパイラーの警告で指摘されたためconstexpr定数に変更して修正します。

clang-17のレポート

src/image/imageadmin.cpp:978:41: warning: compound assignment of floating-point type 'double' from enumeration type '(unnamed enum at ../src/global.h:10:1)' [-Wenum-float-conversion]
  978 |         if( scroll == SCROLL_LEFT ) pos -= ICON_SIZE;
      |                                     ~~~ ^  ~~~~~~~~~
src/image/imageadmin.cpp:979:18: warning: compound assignment of floating-point type 'double' from enumeration type '(unnamed enum at ../src/global.h:10:1)' [-Wenum-float-conversion]
  979 |         else pos += ICON_SIZE;
      |              ~~~ ^  ~~~~~~~~~
src/article/drawareabase.cpp:2305:47: warning: arithmetic between enumeration type '(unnamed enum at /home/ma8ma/var/repos/JDim/weverythingclang17-unity/../src/article/drawareabase.cpp:57:1)' and floating-point type 'double' [-Wenum-float-conversion]
 2305 |     constexpr const double r = AUTOSCR_CIRCLE / 2.0;
      |                                ~~~~~~~~~~~~~~ ^ ~~~