diff options
| author | 2018-11-28 23:34:04 -0500 | |
|---|---|---|
| committer | 2018-11-28 23:34:04 -0500 | |
| commit | 73ffd3b5c5c595c79b7830834890e6adc34360b4 (patch) | |
| tree | d61a2a34ee15d57f4ee870d4b0b757c53b1a5c7e /src/modules | |
| parent | Use override where possible and remove unnecessary usages of the virtual keyw... (diff) | |
| download | KVIrc-73ffd3b5c5c595c79b7830834890e6adc34360b4.tar.gz KVIrc-73ffd3b5c5c595c79b7830834890e6adc34360b4.tar.bz2 KVIrc-73ffd3b5c5c595c79b7830834890e6adc34360b4.zip | |
Remove C-style typedef structs
Diffstat (limited to 'src/modules')
22 files changed, 61 insertions, 65 deletions
diff --git a/src/modules/dcc/DccFileTransfer.h b/src/modules/dcc/DccFileTransfer.h index 29ea3abcb..7124f8777 100644 --- a/src/modules/dcc/DccFileTransfer.h +++ b/src/modules/dcc/DccFileTransfer.h @@ -51,7 +51,7 @@ class DccFileTransfer; class DccMarshal; class QMenu; -typedef struct _KviDccSendThreadOptions +struct KviDccSendThreadOptions { KviCString szFileName; quint64 uStartPosition; @@ -61,7 +61,7 @@ typedef struct _KviDccSendThreadOptions bool bNoAcks; bool bIsTdcc; unsigned int uMaxBandwidth; -} KviDccSendThreadOptions; +}; class DccSendThread : public DccThread { @@ -99,7 +99,7 @@ protected: virtual void run(); }; -typedef struct _KviDccRecvThreadOptions +struct KviDccRecvThreadOptions { bool bResume; KviCString szFileName; @@ -110,7 +110,7 @@ typedef struct _KviDccRecvThreadOptions bool bNoAcks; bool bIsTdcc; unsigned int uMaxBandwidth; -} KviDccRecvThreadOptions; +}; class DccRecvThread : public DccThread { diff --git a/src/modules/dcc/DccThread.h b/src/modules/dcc/DccThread.h index 25f6fc4fd..14cd96929 100644 --- a/src/modules/dcc/DccThread.h +++ b/src/modules/dcc/DccThread.h @@ -46,11 +46,11 @@ // KviThreadDataEvent<int> #define KVI_DCC_THREAD_EVENT_ACTION (KVI_THREAD_USER_EVENT_BASE + 5) -typedef struct _KviDccThreadIncomingData +struct KviDccThreadIncomingData { int iLen; char * buffer; -} KviDccThreadIncomingData; +}; class DccThread : public KviSensitiveThread { diff --git a/src/modules/dcc/DccVideoWindow.h b/src/modules/dcc/DccVideoWindow.h index 080e652e6..1210dcc8b 100644 --- a/src/modules/dcc/DccVideoWindow.h +++ b/src/modules/dcc/DccVideoWindow.h @@ -64,11 +64,11 @@ extern bool kvi_dcc_video_is_valid_codec(const char * codecName); #define KVI_DCC_VIDEO_THREAD_ACTION_STOP_PLAYING 3 #define KVI_DCC_VIDEO_THREAD_ACTION_GRAB_FRAME 4 -typedef struct _KviDccVideoThreadOptions +struct KviDccVideoThreadOptions { QString szVideoDevice; DccVideoCodec * pCodec; -} KviDccVideoThreadOptions; +}; class DccVideoThread : public DccThread { diff --git a/src/modules/dcc/DccVoiceAdpcmCodec.h b/src/modules/dcc/DccVoiceAdpcmCodec.h index e437c18b5..8015bd052 100644 --- a/src/modules/dcc/DccVoiceAdpcmCodec.h +++ b/src/modules/dcc/DccVoiceAdpcmCodec.h @@ -47,11 +47,11 @@ #include "DccVoiceCodec.h" -typedef struct adpcm_state +struct ADPCM_state { short valprev; /* Previous output value */ char index; /* HelpIndex into stepsize table */ -} ADPCM_state; +}; class DccVoiceAdpcmCodec : public DccVoiceCodec { diff --git a/src/modules/dcc/DccVoiceWindow.h b/src/modules/dcc/DccVoiceWindow.h index 59d30ecaa..5c2139245 100644 --- a/src/modules/dcc/DccVoiceWindow.h +++ b/src/modules/dcc/DccVoiceWindow.h @@ -51,14 +51,14 @@ extern bool kvi_dcc_voice_is_valid_codec(const char * codecName); #define KVI_DCC_VOICE_THREAD_ACTION_START_PLAYING 2 #define KVI_DCC_VOICE_THREAD_ACTION_STOP_PLAYING 3 -typedef struct _KviDccVoiceThreadOptions +struct KviDccVoiceThreadOptions { bool bForceHalfDuplex; int iPreBufferSize; int iSampleRate; KviCString szSoundDevice; DccVoiceCodec * pCodec; -} KviDccVoiceThreadOptions; +}; class DccVoiceThread : public DccThread { diff --git a/src/modules/dcc/requests.cpp b/src/modules/dcc/requests.cpp index f33b1fae1..7440c58ad 100644 --- a/src/modules/dcc/requests.cpp +++ b/src/modules/dcc/requests.cpp @@ -1176,11 +1176,11 @@ static void dccModuleParseDccList(KviDccRequest *) } using dccParseProc = void (*)(KviDccRequest *); -typedef struct _dccParseProcEntry +struct dccParseProcEntry { const char * type; dccParseProc proc; -} dccParseProcEntry; +}; #define KVI_NUM_KNOWN_DCC_TYPES 28 diff --git a/src/modules/language/detector.cpp b/src/modules/language/detector.cpp index e51aa5f66..9e5694972 100644 --- a/src/modules/language/detector.cpp +++ b/src/modules/language/detector.cpp @@ -35,19 +35,19 @@ namespace { // CORE DEFS // -typedef struct _DetectorNGram +struct DetectorNGram { const unsigned char * szNGram; double dScore; -} DetectorNGram; +}; -typedef struct _DetectorDescriptor +struct DetectorDescriptor { const char * szLanguage; const char * szEncoding; double single_char_data[256]; DetectorNGram * ngram_hash[256]; -} DetectorDescriptor; +}; static DetectorNGram X[] = { { nullptr, 0 } }; diff --git a/src/modules/language/detector.h b/src/modules/language/detector.h index 7ed71bb6c..b11200904 100644 --- a/src/modules/language/detector.h +++ b/src/modules/language/detector.h @@ -27,18 +27,18 @@ #define DLE_NUM_BEST_MATCHES 4 #define DLE_STRICT_UTF8_CHECKING 1 -typedef struct _LanguageAndEncodingMatch +struct LanguageAndEncodingMatch { const char * szLanguage; const char * szEncoding; double dScore; -} LanguageAndEncodingMatch; +}; -typedef struct _LanguageAndEncodingResult +struct LanguageAndEncodingResult { LanguageAndEncodingMatch match[DLE_NUM_BEST_MATCHES]; // the first best matches double dAccuracy; // accuracy score: from 0 to 100 -} LanguageAndEncodingResult; +}; void detect_language_and_encoding(const char * data, LanguageAndEncodingResult * retBuffer, int iFlags); diff --git a/src/modules/language/detector/build_detector.pl b/src/modules/language/detector/build_detector.pl index 389e869d2..f78241814 100755 --- a/src/modules/language/detector/build_detector.pl +++ b/src/modules/language/detector/build_detector.pl @@ -107,19 +107,19 @@ print OUTPUT "////////////////////////////////////////////////////////////////// print OUTPUT "// CORE DEFS\n"; print OUTPUT "///////////////////////////////////////////////////////////////////////////////\n"; print OUTPUT "\n"; -print OUTPUT "typedef struct _DetectorNGram\n"; +print OUTPUT "struct DetectorNGram\n"; print OUTPUT "{\n"; print OUTPUT " const unsigned char * szNGram;\n"; print OUTPUT " ".$g_dataTypeName." dScore;\n"; -print OUTPUT "} DetectorNGram;\n"; +print OUTPUT "};\n"; print OUTPUT "\n"; -print OUTPUT "typedef struct _DetectorDescriptor\n"; +print OUTPUT "struct DetectorDescriptor\n"; print OUTPUT "{\n"; print OUTPUT " const char * szLanguage;\n"; print OUTPUT " const char * szEncoding;\n"; print OUTPUT " ".$g_dataTypeName." single_char_data[256];\n"; print OUTPUT " DetectorNGram * ngram_hash[256];\n"; -print OUTPUT "} DetectorDescriptor;\n"; +print OUTPUT "};\n"; print OUTPUT "\n"; print OUTPUT "static DetectorNGram X[] = { { 0, 0 } };\n"; print OUTPUT "\n"; diff --git a/src/modules/links/LinksWindow.h b/src/modules/links/LinksWindow.h index b7456f5d2..4cf166adb 100644 --- a/src/modules/links/LinksWindow.h +++ b/src/modules/links/LinksWindow.h @@ -40,13 +40,13 @@ class KviThemedLabel; -typedef struct _KviLink +struct KviLink { KviCString host; KviCString parent; int hops; KviCString description; -} KviLink; +}; class LinksListView : public KviThemedTreeWidget { diff --git a/src/modules/logview/LogFile.h b/src/modules/logview/LogFile.h index 53281af8a..9b4984aa7 100644 --- a/src/modules/logview/LogFile.h +++ b/src/modules/logview/LogFile.h @@ -37,16 +37,15 @@ class QString; /** -* \typedef LogFileData * \struct _LogFileData * \brief A struct that contains the data of a log */ -typedef struct _LogFileData +struct LogFileData { QString szName; /**< the name of the log */ QString szType; /**< the type of the log */ QString szFile; /**< the name of the exported log */ -} LogFileData; +}; /** * \class LogFile diff --git a/src/modules/mediaplayer/MpMp3.h b/src/modules/mediaplayer/MpMp3.h index 6d534e625..5051f14a8 100644 --- a/src/modules/mediaplayer/MpMp3.h +++ b/src/modules/mediaplayer/MpMp3.h @@ -66,7 +66,7 @@ enum VBR_REPORT VBR_MEDIAN }; -typedef struct +struct mp3header { unsigned int sync; unsigned int version; @@ -81,9 +81,9 @@ typedef struct unsigned int copyright; unsigned int original; unsigned int emphasis; -} mp3header; +}; -typedef struct +struct id3tag { char title[31]; char artist[31]; @@ -92,9 +92,9 @@ typedef struct char comment[31]; unsigned char track[1]; unsigned char genre[1]; -} id3tag; +}; -typedef struct +struct mp3info { QString filename; FILE * file; @@ -108,7 +108,7 @@ typedef struct int seconds; int frames; int badframes; -} mp3info; +}; // mode field: // 00 - Stereo diff --git a/src/modules/mediaplayer/winamp.cpp b/src/modules/mediaplayer/winamp.cpp index bf8b29138..4bb67b8e5 100644 --- a/src/modules/mediaplayer/winamp.cpp +++ b/src/modules/mediaplayer/winamp.cpp @@ -31,7 +31,7 @@ // This stuff is compiled only on windows, as a separate dll module -typedef struct +struct winampGeneralPurposePlugin { int version; char * description; @@ -40,7 +40,7 @@ typedef struct void (*quit)(); HWND hwndParent; HINSTANCE hDllInstance; -} winampGeneralPurposePlugin; +}; #define GPPHDR_VER 0x10 diff --git a/src/modules/my/Idle_win.cpp b/src/modules/my/Idle_win.cpp index fe440e9bc..c7dd5004b 100644 --- a/src/modules/my/Idle_win.cpp +++ b/src/modules/my/Idle_win.cpp @@ -24,11 +24,12 @@ #include <QLibrary> -typedef struct tagLASTINPUTINFO +struct LASTINPUTINFO { UINT cbSize; DWORD dwTime; -} LASTINPUTINFO, *PLASTINPUTINFO; +}; +using PLASTINPUTINFO = LASTINPUTINFO *; class IdlePlatform::Private { diff --git a/src/modules/options/OptionsInstanceManager.h b/src/modules/options/OptionsInstanceManager.h index 6f52d928d..0abe1d811 100644 --- a/src/modules/options/OptionsInstanceManager.h +++ b/src/modules/options/OptionsInstanceManager.h @@ -39,9 +39,7 @@ #include "KviQString.h" #include "KviIconManager.h" -typedef struct _OptionsWidgetInstanceEntry OptionsWidgetInstanceEntry; - -typedef struct _OptionsWidgetInstanceEntry +struct OptionsWidgetInstanceEntry { KviOptionsWidget * (*createProc)(QWidget *); KviOptionsWidget * pWidget; // singleton @@ -57,7 +55,7 @@ typedef struct _OptionsWidgetInstanceEntry bool bIsNotContained; KviPointerList<OptionsWidgetInstanceEntry> * pChildList; bool bDoInsert; // a helper for OptionsDialog::fillListView() -} OptionsWidgetInstanceEntry; +}; class OptionsInstanceManager : public QObject { diff --git a/src/modules/options/mkcreateinstanceproc.sh b/src/modules/options/mkcreateinstanceproc.sh index 1bd42fb2e..858f6cd63 100755 --- a/src/modules/options/mkcreateinstanceproc.sh +++ b/src/modules/options/mkcreateinstanceproc.sh @@ -54,10 +54,8 @@ cat >> OptionsInstanceManager.h <<EOF #include "KviQString.h" #include "KviIconManager.h" -typedef struct _OptionsWidgetInstanceEntry OptionsWidgetInstanceEntry; - -typedef struct _OptionsWidgetInstanceEntry +struct OptionsWidgetInstanceEntry { KviOptionsWidget * (*createProc)(QWidget *); KviOptionsWidget * pWidget; // singleton @@ -73,7 +71,7 @@ typedef struct _OptionsWidgetInstanceEntry bool bIsNotContained; KviPointerList<OptionsWidgetInstanceEntry> * pChildList; bool bDoInsert; // a helper for OptionsDialog::fillListView() -} OptionsWidgetInstanceEntry; +}; class OptionsInstanceManager : public QObject diff --git a/src/modules/perlcore/perlcoreinterface.h b/src/modules/perlcore/perlcoreinterface.h index 3f904345a..bfaf089f9 100644 --- a/src/modules/perlcore/perlcoreinterface.h +++ b/src/modules/perlcore/perlcoreinterface.h @@ -32,7 +32,7 @@ #define KVI_PERLCORECTRLCOMMAND_EXECUTE "execute" -typedef struct _KviPerlCoreCtrlCommand_execute +struct KviPerlCoreCtrlCommand_execute { unsigned int uSize; KviKvsRunTimeContext * pKvsContext; @@ -44,14 +44,14 @@ typedef struct _KviPerlCoreCtrlCommand_execute QStringList lWarnings; QStringList lArgs; bool bQuiet; -} KviPerlCoreCtrlCommand_execute; +}; #define KVI_PERLCORECTRLCOMMAND_DESTROY "destroy" -typedef struct _KviPerlCoreCtrlCommand_destroy +struct KviPerlCoreCtrlCommand_destroy { unsigned int uSize; QString szContext; -} KviPerlCoreCtrlCommand_destroy; +}; #endif // !_PERLCOREINTERFACE_H_ diff --git a/src/modules/pythoncore/pythoncoreinterface.h b/src/modules/pythoncore/pythoncoreinterface.h index 26b42aa1a..5dae39698 100644 --- a/src/modules/pythoncore/pythoncoreinterface.h +++ b/src/modules/pythoncore/pythoncoreinterface.h @@ -32,7 +32,7 @@ #define KVI_PYTHONCORECTRLCOMMAND_EXECUTE "execute" -typedef struct _KviPythonCoreCtrlCommand_execute +struct KviPythonCoreCtrlCommand_execute { unsigned int uSize; KviKvsRunTimeContext * pKvsContext; @@ -44,14 +44,14 @@ typedef struct _KviPythonCoreCtrlCommand_execute QStringList lWarnings; QStringList lArgs; bool bQuiet; -} KviPythonCoreCtrlCommand_execute; +}; #define KVI_PYTHONCORECTRLCOMMAND_DESTROY "destroy" -typedef struct _KviPythonCoreCtrlCommand_destroy +struct KviPythonCoreCtrlCommand_destroy { unsigned int uSize; QString szContext; -} KviPythonCoreCtrlCommand_destroy; +}; #endif // !_PYTHONCOREINTERFACE_H_ diff --git a/src/modules/reguser/RegisteredUsersDialog.cpp b/src/modules/reguser/RegisteredUsersDialog.cpp index d13560d5a..5f51decd6 100644 --- a/src/modules/reguser/RegisteredUsersDialog.cpp +++ b/src/modules/reguser/RegisteredUsersDialog.cpp @@ -697,12 +697,12 @@ void RegisteredUsersDialog::selectionChanged() #define KVI_REGUSER_DB_FILE_MAGIC 0x5334DBDB #define KVI_REGUSER_DB_FILE_VERSION 1 -typedef struct _KviReguserDbFileHeader +struct KviReguserDbFileHeader { kvi_u32_t magic; kvi_u32_t version; kvi_u32_t nentries; -} KviReguserDbFileHeader; +}; void RegisteredUsersDialog::exportClicked() { diff --git a/src/modules/spaste/libkvispaste.h b/src/modules/spaste/libkvispaste.h index bdd9da8a2..ab2309524 100644 --- a/src/modules/spaste/libkvispaste.h +++ b/src/modules/spaste/libkvispaste.h @@ -27,10 +27,10 @@ #include "KviWindow.h" -typedef struct _SPasteThreadData +struct SPasteThreadData { QString * strData; KviWindow * win; -} SPasteThreadData; +}; #endif diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index 279c414cd..81144088b 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -54,11 +54,11 @@ extern KVIRC_API QPixmap * g_pShadedChildGlobalDesktopBackground; #endif -typedef struct _UrlDlgList +struct UrlDlgList { UrlDialog * dlg; int menu_id; -} UrlDlgList; +}; const char * g_pUrlListFilename = "/list.kviurl"; const char * g_pBanListFilename = "/list.kviban"; diff --git a/src/modules/url/libkviurl.h b/src/modules/url/libkviurl.h index 36c4628aa..59220f27b 100644 --- a/src/modules/url/libkviurl.h +++ b/src/modules/url/libkviurl.h @@ -48,13 +48,13 @@ #include <unordered_set> #include <vector> -typedef struct _KviUrl +struct KviUrl { QString url; QString window; int count; QString timestamp; -} KviUrl; +}; class UrlDialogTreeWidget : public QTreeWidget { |
