evpo / EncryptPad

Minimalist secure text editor and binary encryptor that implements RFC 4880 Open PGP format: symmetrically encrypted, compressed and integrity protected. The editor can protect files with passwords, key files or both.
https://evpo.net/encryptpad
Other
433 stars 64 forks source link

More compiler warnings (if you want to silence them) #90

Closed kekePower closed 4 years ago

kekePower commented 4 years ago

Using gcc 9.3 and Qt5 5.14.1

src/lib/logger_init.cpp: In function ‘void EncryptMsg::InitLogger(const string&)’:
src/lib/logger_init.cpp:15:9: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
   15 |         LOG_INFO << "Log instance started";
      |         ^~~~~~~~
src/lib/state_handlers.cpp: In function ‘void EncryptMsg::HeaderOnEnter(LightStateMachine::StateMachineContext&)’:
src/lib/state_handlers.cpp:87:21: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
   87 |                     LOG_DEBUG << "Header: " << GetPacketSpec(reader.GetPacketHeader().packet_type).packet_name;
      |                     ^~~~~~~~~
src/lib/state_handlers.cpp: In function ‘void EncryptMsg::PacketOnEnter(LightStateMachine::StateMachineContext&)’:
src/lib/state_handlers.cpp:131:9: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]
  131 |         LOG_DEBUG << "Packet: " << GetPacketSpec(*packet_chain_it).packet_name;
      |         ^~~~~~~~~
../../qt_ui/mainwindow.cpp: In member function ‘void MainWindow::createNewKey()’:
../../qt_ui/mainwindow.cpp:632:23: warning: catching polymorphic type ‘class EncryptPad::IoException’ by value [-Wcatch-value=]
  632 |     catch(EncryptPad::IoException)
      |                       ^~~~~~~~~~~
../../qt_ui/mainwindow.cpp: In member function ‘void MainWindow::onUpdatedPreferences()’:
../../qt_ui/mainwindow.cpp:1128:70: warning: ‘int QFontMetrics::width(QChar) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations]
 1128 |     textEdit->setTabStopWidth(preferences.tabSize * metrics.width(' '));
      |                                                                      ^
In file included from /usr/include/qt5/QtGui/QtGui:26,
                 from ../../qt_ui/mainwindow.cpp:20:
/usr/include/qt5/QtGui/qfontmetrics.h:110:9: note: declared here
  110 |     int width(QChar) const;
      |         ^~~~~
../../qt_ui/mainwindow.cpp:1128:71: warning: ‘void QPlainTextEdit::setTabStopWidth(int)’ is deprecated [-Wdeprecated-declarations]
 1128 |     textEdit->setTabStopWidth(preferences.tabSize * metrics.width(' '));
      |                                                                       ^
In file included from /usr/include/qt5/QtWidgets/QtWidgets:202,
                 from ../../qt_ui/mainwindow.cpp:21:
/usr/include/qt5/QtWidgets/qplaintextedit.h:179:24: note: declared here
  179 |     QT_DEPRECATED void setTabStopWidth(int width);
      |                        ^~~~~~~~~~~~~~~
evpo commented 4 years ago

Most have been fixed now. The two Qt warnings are a bit too early for me. My latest openSuse Leap 15.1 uses Qt 5.9. I will fix them when they move to Qt 5.10. I am closing for now.