diff options
author | Gerald Combs <gerald@wireshark.org> | 2020-09-04 15:15:05 -0700 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2020-09-05 07:41:29 +0000 |
commit | 7ab6440416622965513ee6e65f46ecdabefc6bdd (patch) | |
tree | f4286e9ca294cac1664e04ba9d6763b3e53a5b89 /ui | |
parent | a46b62fcab53a42ce09764b03cccf4bd2136931d (diff) |
Tools: Clean up checkAPI and add ui/qt.
Remove the --check-addtext and --build flags. They were used for
checkAddTextCalls, which was removed in e2735ecfdd.
Add the sources in ui/qt except for qcustomplot.{cpp,h}. Fix issues in
main.cpp, rtp_audio_stream.cpp, and wireshark_zip_helper.cpp.
Rename "index"es in packet-usb-hid.c.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/CMakeLists.txt | 34 | ||||
-rw-r--r-- | ui/qt/main.cpp | 4 | ||||
-rw-r--r-- | ui/qt/rtp_audio_stream.cpp | 2 | ||||
-rw-r--r-- | ui/qt/utils/wireshark_zip_helper.cpp | 16 |
4 files changed, 43 insertions, 13 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt index a159e0afe9..ff0efeae16 100644 --- a/ui/qt/CMakeLists.txt +++ b/ui/qt/CMakeLists.txt @@ -40,7 +40,6 @@ set(WIRESHARK_WIDGET_HEADERS widgets/pref_module_view.h widgets/packet_list_header.h widgets/profile_tree_view.h - widgets/qcustomplot.h widgets/range_syntax_lineedit.h widgets/splash_overlay.h widgets/stock_icon_tool_button.h @@ -50,6 +49,10 @@ set(WIRESHARK_WIDGET_HEADERS widgets/wireless_timeline.h ) +set(WIRESHARK_3RD_PARTY_WIDGET_HEADERS + widgets/qcustomplot.h +) + set(WIRESHARK_MANAGER_HEADERS manager/preference_manager.h manager/wireshark_preference.h @@ -277,7 +280,6 @@ set(WIRESHARK_WIDGET_SRCS widgets/packet_list_header.cpp widgets/pref_module_view.cpp widgets/profile_tree_view.cpp - widgets/qcustomplot.cpp widgets/range_syntax_lineedit.cpp widgets/splash_overlay.cpp widgets/stock_icon_tool_button.cpp @@ -287,6 +289,10 @@ set(WIRESHARK_WIDGET_SRCS widgets/wireshark_file_dialog.cpp ) +set(WIRESHARK_3RD_PARTY_WIDGET_SRCS + widgets/qcustomplot.cpp +) + set(WIRESHARK_MANAGER_SRCS manager/preference_manager.cpp manager/wireshark_preference.cpp @@ -681,12 +687,14 @@ add_library(qtui OBJECT #Included so that Visual Studio can properly put header files in solution ${WIRESHARK_QT_HEADERS} ${WIRESHARK_WIDGET_HEADERS} + ${WIRESHARK_3RD_PARTY_WIDGET_HEADERS} ${WIRESHARK_MANAGER_HEADERS} ${WIRESHARK_UTILS_HEADERS} ${WIRESHARK_MODEL_HEADERS} ${WIRESHARK_QT_SRC} ${WIRESHARK_WIDGET_SRCS} + ${WIRESHARK_3RD_PARTY_WIDGET_SRCS} ${WIRESHARK_MANAGER_SRCS} ${WIRESHARK_UTILS_SRCS} ${WIRESHARK_MODEL_SRCS} @@ -722,6 +730,28 @@ set_target_properties(qtui PROPERTIES AUTOGEN_TARGET_DEPENDS "${WIRESHARK_QT_QM}" ) +CHECKAPI( + NAME + ui-qt + SWITCHES + --nocheck-shadow + SOURCES + # QCustomPlot (WIRESHARK_3RD_PARTY_WIDGET_{HEADERS,SRCS}) uses + # prohibited APIs. + ${WIRESHARK_QT_HEADERS} + ${WIRESHARK_WIDGET_HEADERS} + ${WIRESHARK_MANAGER_HEADERS} + ${WIRESHARK_UTILS_HEADERS} + ${WIRESHARK_MODEL_HEADERS} + + ${WIRESHARK_QT_SRC} + ${WIRESHARK_WIDGET_SRCS} + ${WIRESHARK_MANAGER_SRCS} + ${WIRESHARK_UTILS_SRCS} + ${WIRESHARK_MODEL_SRCS} + ${WIRESHARK_QT_TAP_SRC} +) + # # Editor modelines - https://www.wireshark.org/tools/modelines.html # diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 6a275dcf61..489c1d3ccf 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -522,7 +522,7 @@ int main(int argc, char *qt_argv[]) if (create_profiles_dir(&rf_path) == -1) { simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "Could not create profiles directory\n\"%s\": %s.", - rf_path, strerror(errno)); + rf_path, g_strerror(errno)); g_free (rf_path); } @@ -534,7 +534,7 @@ int main(int argc, char *qt_argv[]) if (!recent_read_static(&rf_path, &rf_open_errno)) { simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, "Could not open common recent file\n\"%s\": %s.", - rf_path, strerror(rf_open_errno)); + rf_path, g_strerror(rf_open_errno)); g_free(rf_path); } diff --git a/ui/qt/rtp_audio_stream.cpp b/ui/qt/rtp_audio_stream.cpp index 5f33b90d82..e362851e1d 100644 --- a/ui/qt/rtp_audio_stream.cpp +++ b/ui/qt/rtp_audio_stream.cpp @@ -662,7 +662,7 @@ void RtpAudioStream::writeSilence(qint64 samples) qint64 silence_bytes = samples * sample_bytes_; char *silence_buff = (char *) g_malloc0(silence_bytes); - RTP_STREAM_DEBUG("Writing %llu silence samples", samples); + RTP_STREAM_DEBUG("Writing " G_GUINT64_FORMAT " silence samples", samples); if (audio_stereo_) { // Silence for left and right channel tempfile_->write(silence_buff, silence_bytes); diff --git a/ui/qt/utils/wireshark_zip_helper.cpp b/ui/qt/utils/wireshark_zip_helper.cpp index 627aa9d82d..d146f1259c 100644 --- a/ui/qt/utils/wireshark_zip_helper.cpp +++ b/ui/qt/utils/wireshark_zip_helper.cpp @@ -127,16 +127,16 @@ bool WiresharkZipHelper::unzip(QString zipFile, QString directory, bool (*fileCh err = unzOpenCurrentFile(uf); if (err == UNZ_OK) { - char * buf = static_cast<char *>(malloc(IO_BUF_SIZE)); if (file.open(QIODevice::WriteOnly)) { - while ((err = unzReadCurrentFile(uf, buf, IO_BUF_SIZE)) != UNZ_EOF) - file.write(buf, err); + QByteArray buf; + buf.resize(IO_BUF_SIZE); + while ((err = unzReadCurrentFile(uf, buf.data(), buf.size())) != UNZ_EOF) + file.write(buf.constData(), err); file.close(); } unzCloseCurrentFile(uf); - free(buf); files++; } @@ -215,16 +215,16 @@ void WiresharkZipHelper::addFileToZip(zipFile zf, QString filepath, QString file if (fh.open(QIODevice::ReadOnly)) { - char * buf = static_cast<char *>(malloc(IO_BUF_SIZE)); + QByteArray buf; + buf.resize(IO_BUF_SIZE); while (! fh.atEnd() && err == ZIP_OK) { - qint64 bytesIn = fh.read(buf, IO_BUF_SIZE); - if (bytesIn > 0 && bytesIn <= IO_BUF_SIZE) + qint64 bytesIn = fh.read(buf.data(), buf.size()); + if (bytesIn > 0 && bytesIn <= buf.size()) { err = zipWriteInFileInZip(zf, buf, (unsigned int) bytesIn); } } - free(buf); fh.close(); } |