From: Włodzimierz Skiba Date: Wed, 6 Oct 2004 20:54:57 +0000 (+0000) Subject: Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/925e9792d32e353233985f53a4845f154e455a58 Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW and DMC. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index dbae3482f0..053dab084b 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -654,7 +654,7 @@ bool DatabaseDemoApp::OnInit() // WARNING: Be certain that you do not free this handle // directly with SQLFreeEnv(). Use either the // method ::FreeHenv() or delete the DbConnectInf. - DbConnectInf = new wxDbConnectInf(NULL, params.ODBCSource, params.UserName, + DbConnectInf = new wxDbConnectInf(NULL, params.ODBCSource, params.UserName, params.Password, params.DirPath); if (!DbConnectInf || !DbConnectInf->GetHenv()) @@ -963,7 +963,7 @@ void DatabaseDemoFrame::BuildEditorDialog() wxMessageBox(wxT("Unable to initialize the editor dialog for some reason"),wxT("Error..."),wxOK | wxICON_EXCLAMATION); Close(); } - } + } else { wxMessageBox(wxT("Unable to create the editor dialog for some reason"),wxT("Error..."),wxOK | wxICON_EXCLAMATION); @@ -985,24 +985,24 @@ void DatabaseDemoFrame::BuildParameterDialog(wxWindow *parent) * Constructor note: If no wxDb object is passed in, a new connection to the database * is created for this instance of Ccontact. This can be a slow process depending * on the database engine being used, and some database engines have a limit on the - * number of connections (either hard limits, or license restricted) so care should - * be used to use as few connections as is necessary. + * number of connections (either hard limits, or license restricted) so care should + * be used to use as few connections as is necessary. * - * IMPORTANT: Objects which share a wxDb pointer are ALL acted upon whenever a member - * function of pDb is called (i.e. CommitTrans() or RollbackTrans(), so if modifying + * IMPORTANT: Objects which share a wxDb pointer are ALL acted upon whenever a member + * function of pDb is called (i.e. CommitTrans() or RollbackTrans(), so if modifying * or creating a table objects which use the same pDb, know that all the objects * will be committed or rolled back when any of the objects has this function call made. */ Ccontact::Ccontact (wxDb *pwxDb) : wxDbTable(pwxDb ? pwxDb : wxDbGetConnection(wxGetApp().DbConnectInf), - CONTACT_TABLE_NAME, CONTACT_NO_COLS, wxT(""), + CONTACT_TABLE_NAME, CONTACT_NO_COLS, wxEmptyString, !wxDB_QUERY_ONLY, wxGetApp().DbConnectInf->GetDefaultDir()) { // This is used to represent whether the database connection should be released // when this instance of the object is deleted. If using the same connection - // for multiple instance of database objects, then the connection should only be + // for multiple instance of database objects, then the connection should only be // released when the last database instance using the connection is deleted freeDbConn = !pwxDb; - + if (GetDb()) GetDb()->SetSqlLogging(sqlLogON); @@ -1053,7 +1053,7 @@ Ccontact::~Ccontact() /* * Handles setting up all the connections for the interface from the wxDbTable - * functions to interface to the data structure used to store records in + * functions to interface to the data structure used to store records in * memory, and for all the column definitions that define the table structure */ void Ccontact::SetupColumns() @@ -1080,7 +1080,7 @@ void Ccontact::SetupColumns() bool Ccontact::CreateIndexes(bool recreate) { - // This index could easily be accomplished with an "orderBy" clause, + // This index could easily be accomplished with an "orderBy" clause, // but is done to show how to construct a non-primary index. wxString indexName; wxDbIdxDef idxDef[2]; @@ -1134,12 +1134,12 @@ bool Ccontact::FetchByName(const wxString &name) * An instance of Ccontact is created - "Contact" - which is used to hold the Ccontact * object that is currently being worked with. */ - + BEGIN_EVENT_TABLE(CeditorDlg, wxPanel) EVT_BUTTON(wxID_ANY, CeditorDlg::OnButton) EVT_CLOSE(CeditorDlg::OnCloseWindow) END_EVENT_TABLE() - + CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 0, 0, 537, 480) { // Since the ::OnCommand() function is overridden, this prevents the widget @@ -1180,7 +1180,7 @@ void CeditorDlg::OnButton(wxCommandEvent &event) void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) { wxString widgetName; - + widgetName = win.GetName(); if (!widgetPtrsSet) @@ -1221,10 +1221,10 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) if (Ok && wxGetApp().Contact->Delete()) { - // NOTE: Deletions are not finalized until a CommitTrans() is performed. - // If the commit were not performed, the program will continue to + // NOTE: Deletions are not finalized until a CommitTrans() is performed. + // If the commit were not performed, the program will continue to // show the table contents as if they were deleted until this instance - // of Ccontact is deleted. If the Commit wasn't performed, the + // of Ccontact is deleted. If the Commit wasn't performed, the // database will automatically Rollback the changes when the database // connection is terminated wxGetApp().Contact->GetDb()->CommitTrans(); @@ -1300,7 +1300,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) tStr = wxT("ODBC error during Query()\n\n"); wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__), wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION); - + SetMode(mView); return; } @@ -1352,7 +1352,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) wxGetApp().Contact->whereStr = wxT("NAME = (SELECT MIN(NAME) FROM "); wxGetApp().Contact->whereStr += CONTACT_TABLE_NAME; } - + // Append the query where string (if there is one) wxGetApp().Contact->qryWhereStr = qryWhere; if (wxStrlen(qryWhere)) @@ -1470,7 +1470,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) bool CeditorDlg::Initialize() { - // Create the data structure and a new database connection. + // Create the data structure and a new database connection. // (As there is not a pDb being passed in the constructor, a new database // connection is created) wxGetApp().Contact = new Ccontact(); @@ -1481,10 +1481,10 @@ bool CeditorDlg::Initialize() return false; } - // Check if the table exists or not. If it doesn't, ask the user if they want to + // Check if the table exists or not. If it doesn't, ask the user if they want to // create the table. Continue trying to create the table until it exists, or user aborts - while (!wxGetApp().Contact->GetDb()->TableExists((wxChar *)CONTACT_TABLE_NAME, - wxGetApp().DbConnectInf->GetUserID(), + while (!wxGetApp().Contact->GetDb()->TableExists((wxChar *)CONTACT_TABLE_NAME, + wxGetApp().DbConnectInf->GetUserID(), wxGetApp().DbConnectInf->GetDefaultDir())) { wxString tStr; @@ -1522,7 +1522,7 @@ bool CeditorDlg::Initialize() wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__), wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION); } - else + else #endif if (!wxGetApp().Contact->GetDb()->TableExists(CONTACT_TABLE_NAME, wxGetApp().Contact->GetDb()->GetUsername(), @@ -1593,14 +1593,14 @@ bool CeditorDlg::Initialize() pDataTypesBtn = new wxButton(this, EDITOR_DIALOG_DATATYPES, wxT("Data&types"), wxPoint(430, 337), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DataTypesBtn")); pDbDiagsBtn = new wxButton(this, EDITOR_DIALOG_DB_DIAGS, wxT("DB Dia&gs"), wxPoint(430, 387), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DbDiagsBtn")); - // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to + // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to // handle all widget processing widgetPtrsSet = true; - // Setup the orderBy and where clauses to return back a single record as the result set, + // Setup the orderBy and where clauses to return back a single record as the result set, // as there will only be one record being shown on the dialog at a time, this optimizes // network traffic by only returning a one row result - + wxGetApp().Contact->SetOrderByClause(wxT("NAME")); // field name to sort by // The wxString "whereStr" is not a member of the wxDbTable object, it is a member variable @@ -1608,9 +1608,9 @@ bool CeditorDlg::Initialize() // length string, and then after the string is built, the wxDbTable member variable "where" is // assigned the pointer to the constructed string. // - // The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s" + // The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s" // to achieve a single row (in this case the first name in alphabetical order). - + if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES && wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL) { @@ -1622,8 +1622,8 @@ bool CeditorDlg::Initialize() else wxGetApp().Contact->SetWhereClause(wxT("")); - // Perform the Query to get the result set. - // NOTE: If there are no rows returned, that is a valid result, so Query() would return true. + // Perform the Query to get the result set. + // NOTE: If there are no rows returned, that is a valid result, so Query() would return true. // Only if there is a database error will Query() come back as false if (!wxGetApp().Contact->Query()) { @@ -1636,8 +1636,8 @@ bool CeditorDlg::Initialize() // Since Query succeeded, now get the row that was returned if (!wxGetApp().Contact->GetNext()) - // If the GetNext() failed at this point, then there are no rows to retrieve, - // so clear the values in the members of "Contact" so that PutData() blanks the + // If the GetNext() failed at this point, then there are no rows to retrieve, + // so clear the values in the members of "Contact" so that PutData() blanks the // widgets on the dialog wxGetApp().Contact->Initialize(); /* @@ -1817,9 +1817,9 @@ bool CeditorDlg::GetData() if (!invalid) { - wxGetApp().Contact->JoinDate.month = mm; - wxGetApp().Contact->JoinDate.day = dd; - wxGetApp().Contact->JoinDate.year = yyyy; + wxGetApp().Contact->JoinDate.month = (SQLUSMALLINT)mm; + wxGetApp().Contact->JoinDate.day = (SQLUSMALLINT)dd; + wxGetApp().Contact->JoinDate.year = (SQLSMALLINT)yyyy; } else { @@ -1836,7 +1836,7 @@ bool CeditorDlg::GetData() wxStrcpy(wxGetApp().Contact->Country,pCountryTxt->GetValue()); wxStrcpy(wxGetApp().Contact->PostalCode,pPostalCodeTxt->GetValue()); - wxGetApp().Contact->Contributions = wxAtoi(pContribTxt->GetValue()); + wxGetApp().Contact->Contributions = (UCHAR)wxAtoi(pContribTxt->GetValue()); wxGetApp().Contact->LinesOfCode = wxAtol(pLinesTxt->GetValue()); wxGetApp().Contact->NativeLanguage = (enum Language) pNativeLangChoice->GetSelection(); @@ -1870,7 +1870,7 @@ bool CeditorDlg::Save() if (mode == mCreate) { - RETCODE result = wxGetApp().Contact->Insert(); + RETCODE result = (RETCODE)wxGetApp().Contact->Insert(); failed = (result != DB_SUCCESS); if (failed) @@ -2054,7 +2054,7 @@ CparameterDlg::CparameterDlg(wxWindow *parent) : wxDialog (parent, PARAMETER_DIA pParamSaveBtn = new wxButton(this, PARAMETER_DIALOG_SAVE, wxT("&Save"), wxPoint(310, 21), wxSize( 70, 35), 0, wxDefaultValidator, wxT("ParamSaveBtn")); pParamCancelBtn = new wxButton(this, PARAMETER_DIALOG_CANCEL, wxT("C&ancel"), wxPoint(310, 66), wxSize( 70, 35), 0, wxDefaultValidator, wxT("ParamCancelBtn")); - // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to + // Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to // handle all widget processing widgetPtrsSet = true; @@ -2074,13 +2074,13 @@ void CparameterDlg::OnCloseWindow(wxCloseEvent& event) if (!saved) { bool Ok = (wxMessageBox(wxT("No changes have been saved.\n\nAre you sure you wish exit the parameter screen?"),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES); - + if (!Ok) { event.Veto(); return; } - + wxGetApp().params = savedParamSettings; } @@ -2107,7 +2107,7 @@ void CparameterDlg::OnButton( wxCommandEvent &event ) void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event)) { wxString widgetName; - + widgetName = win.GetName(); if (!widgetPtrsSet) @@ -2172,7 +2172,7 @@ bool CparameterDlg::GetData() } else return false; - + tStr = pParamUserNameTxt->GetValue(); if (tStr.Length() > (sizeof(wxGetApp().params.UserName)-1)) { @@ -2248,9 +2248,9 @@ BEGIN_EVENT_TABLE(CqueryDlg, wxDialog) EVT_CLOSE(CqueryDlg::OnCloseWindow) END_EVENT_TABLE() - + // CqueryDlg() constructor -CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], +CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg) : wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxDefaultPosition, wxSize(480, 360)) { @@ -2363,11 +2363,6 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], } // CqueryDlg() constructor -CqueryDlg::~CqueryDlg() -{ -} // CqueryDlg::~CqueryDlg() destructor - - void CqueryDlg::OnButton(wxCommandEvent &event) { wxWindow *win = (wxWindow*) event.GetEventObject(); @@ -2630,10 +2625,10 @@ void CqueryDlg::ProcessAddBtn() // Build the expression and append it to the where clause window wxString s = pQueryCol1Choice->GetStringSelection(); - + if (pQueryNotCheck->GetValue() && (oper != qryOpEQ)) s += wxT(" NOT"); - + switch(oper) { case qryOpEQ: @@ -2712,8 +2707,8 @@ void CqueryDlg::ProcessCountBtn() if (!dbTable) // wxDbTable object needs to be created and opened { - dbTable = new wxDbTable(pDB, masterTableName, 0, wxT(""), - !wxDB_QUERY_ONLY, + dbTable = new wxDbTable(pDB, masterTableName, 0, wxEmptyString, + !wxDB_QUERY_ONLY, wxGetApp().DbConnectInf->GetDefaultDir()); if (!dbTable) { @@ -3155,13 +3150,13 @@ bool DbGridFrame::Initialize() grid->RegisterDataType(wxGRID_VALUE_CHOICEINT, new wxGridCellEnumRenderer, new wxGridCellEnumEditor); - - wxString NativeLangChoice( wxString::Format(wxT("%s:%s,%s,%s,%s,%s"),wxGRID_VALUE_CHOICEINT, + + wxString NativeLangChoice( wxString::Format(wxT("%s:%s,%s,%s,%s,%s"),wxGRID_VALUE_CHOICEINT, wxT("English"), wxT("French"), wxT("German"), wxT("Spanish"), - wxT("Other") )); + wxT("Other") )); #endif // Columns must match the sequence specified in SetColDef() calls @@ -3179,7 +3174,7 @@ bool DbGridFrame::Initialize() new wxDbGridColInfo(10,wxGRID_VALUE_NUMBER,wxT("Lines Of Code"), #ifdef CHOICEINT new wxDbGridColInfo(11,NativeLangChoice, wxT("Native Language"),NULL)))))))))))); -#else +#else new wxDbGridColInfo(11,wxGRID_VALUE_NUMBER,wxT("Native Language"),NULL)))))))))))); #endif diff --git a/samples/db/dbtest.h b/samples/db/dbtest.h index 91ffdf60f0..db98a60e37 100644 --- a/samples/db/dbtest.h +++ b/samples/db/dbtest.h @@ -68,7 +68,7 @@ void DisplayDbDiagnostics(wxDb *pDb); // // This class contains the actual data members that are used for transferring -// data back and forth from the database to the program. +// data back and forth from the database to the program. // // NOTE: The object described in this class is just for example purposes, and has no // real meaning other than to show each type of field being used by the database @@ -99,10 +99,10 @@ class CstructContact : public wxObject // all combined in this one class. // class Ccontact : public wxDbTable, public CstructContact -{ +{ private: // Used to keep track of whether this class had a wxDb instance - // passed in to it or not. If an existing wxDb instance was not + // passed in to it or not. If an existing wxDb instance was not // passed in at Ccontact creation time, then when the Ccontact // instance is deleted, the connection will be freed as Ccontact // created its own connection when it was created. @@ -114,7 +114,7 @@ class Ccontact : public wxDbTable, public CstructContact void SetupColumns(); public: - // Used in places where we need to construct a WHERE clause to + // Used in places where we need to construct a WHERE clause to // be passed to the SetWhereClause() function. From example, // where building the WHERE clause requires using ::Printf() // to build the string. @@ -151,7 +151,7 @@ typedef struct Cparameters // Define a new frame type class DatabaseDemoFrame: public wxFrame -{ +{ private: CeditorDlg *pEditorDlg; CparameterDlg *pParamDlg; @@ -169,7 +169,7 @@ class DatabaseDemoFrame: public wxFrame void OnAbout(wxCommandEvent& event); #if wxUSE_GRID void OnDbGridTable( wxCommandEvent& ); -#endif +#endif void CreateDataTable(bool recreate); void BuildEditorDialog(); void BuildParameterDialog(wxWindow *parent); @@ -212,26 +212,26 @@ class DatabaseDemoApp: public wxApp // Pointer to the main database connection used in the program. This // pointer would normally be used for doing things as database lookups // for user login names and passwords, getting workstation settings, etc. - // + // // ---> IMPORTANT <--- - // + // // For each database object created which uses this wxDb pointer // connection to the database, when a CommitTrans() or RollBackTrans() // will commit or rollback EVERY object which uses this wxDb pointer. - // - // To allow each table object (those derived from wxDbTable) to be + // + // To allow each table object (those derived from wxDbTable) to be // individually committed or rolled back, you MUST use a different - // instance of wxDb in the constructor of the table. Doing so creates + // instance of wxDb in the constructor of the table. Doing so creates // more overhead, and will use more database connections (some DBs have // connection limits...), so use connections sparringly. - // + // // It is recommended that one "main" database connection be created for // the entire program to use for READ-ONLY database accesses, but for each // table object which will do a CommitTrans() or RollbackTrans() that a // new wxDb object be created and used for it. wxDb *READONLY_DB; - // Contains the ODBC connection information used by + // Contains the ODBC connection information used by // all database connections wxDbConnectInf *DbConnectInf; @@ -259,13 +259,13 @@ class CeditorDlg : public wxPanel { private: // Used to indicate whether all of the widget pointers (defined - // below) have been initialized to point to the memory for + // below) have been initialized to point to the memory for // the named widget. Used as a safeguard from using the widget // before it has been initialized. bool widgetPtrsSet; - // Used when the EDIT button has been pressed to maintain the - // original name that was displayed in the editor before the + // Used when the EDIT button has been pressed to maintain the + // original name that was displayed in the editor before the // EDIT button was pressed, so that if CANCEL is pressed, a // FetchByName() can be done to retrieve the original data // to repopulate the dialog. @@ -318,7 +318,7 @@ class CeditorDlg : public wxPanel // retrieved from the editor dialog bool Save(); - // Database functions for changing the data that is to + // Database functions for changing the data that is to // be displayed on the dialog. GetNextRec()/GetPrevRec() // provide database independent methods that do not require // backward scrolling cursors to obtain the record that @@ -326,7 +326,7 @@ class CeditorDlg : public wxPanel bool GetNextRec(); bool GetPrevRec(); bool GetRec(const wxString &whereStr); - + DECLARE_EVENT_TABLE() }; // CeditorDlg @@ -381,14 +381,14 @@ class CparameterDlg : public wxDialog { private: // Used to indicate whether all of the widget pointers (defined - // below) have been initialized to point to the memory for + // below) have been initialized to point to the memory for // the named widget. Used as a safeguard from using the widget // before it has been initialized. bool widgetPtrsSet; enum DialogModes mode; - // Have the parameters been saved yet, or do they + // Have the parameters been saved yet, or do they // need to be saved to update the params on disk bool saved; @@ -480,7 +480,7 @@ class CqueryDlg : public wxDialog public: // Used to indicate whether all of the widget pointers (defined - // below) have been initialized to point to the memory for + // below) have been initialized to point to the memory for // the named widget. Used as a safeguard from using the widget // before it has been initialized. bool widgetPtrsSet; @@ -515,7 +515,7 @@ class CqueryDlg : public wxDialog wxTextCtrl *pFocusTxt; CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg); - ~CqueryDlg(); + ~CqueryDlg(){}; void OnButton( wxCommandEvent &event ); void OnCommand(wxWindow& win, wxCommandEvent& event); @@ -572,7 +572,7 @@ wxChar * const langDBINF_OUTER_JOINS = wxT("Outer Joins = "); wxChar * const langDBINF_STORED_PROC = wxT("Stored Procedures = "); wxChar * const langDBINF_MAX_HDBC = wxT("Max # of Db connections = "); wxChar * const langDBINF_MAX_HSTMT = wxT("Max # of cursors (per db connection) = "); -wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown"); +wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown"); wxChar * const langDBINF_API_LVL = wxT("ODBC API conformance level = "); wxChar * const langDBINF_CLI_LVL = wxT("Client (SAG) conformance level = "); wxChar * const langDBINF_SQL_LVL = wxT("SQL conformance level = "); diff --git a/samples/db/listdb.cpp b/samples/db/listdb.cpp index 8238f181b4..5cfbc84f79 100644 --- a/samples/db/listdb.cpp +++ b/samples/db/listdb.cpp @@ -15,7 +15,7 @@ Member functions for the classes defined in LISTDB.H This class is used to present a generic ListBox lookup window for - use with any of the object creation/selection choice widgets. This + use with any of the object creation/selection choice widgets. This dialog window will present a (possibly) scrolling list of values that come from a data table source. Based on the object type passed in the constructor, a ListBox is built to present the user with a @@ -28,7 +28,7 @@ For each object (database) type that is to be used, an overridden constructor should be written to appropriately link to the proper data table/object for building the list. - + The data table record access is all handled through the routines in this module, interfacing with the methods defined in wxDbTable. @@ -36,7 +36,7 @@ have opened the table prior to passing them in the dialog constructor, and the 'where' query should already have been set and performed before creating this dialog instance. - + // SYNOPSIS STOP */ @@ -108,7 +108,7 @@ const wxChar *GetExtendedDBErrorMsg2(wxDb *pDb, wxChar *ErrFile, int ErrLine) msg.Append (wxT("\nODBC errors:\n")); msg += wxT("\n"); - + // Display errors for this connection int i; for (i = 0; i < DB_MAX_ERROR_HISTORY; i++) @@ -131,7 +131,7 @@ const wxChar *GetExtendedDBErrorMsg2(wxDb *pDb, wxChar *ErrFile, int ErrLine) // Clookup constructor Clookup::Clookup(wxChar *tblName, wxChar *colName, wxDb *pDb, const wxString &defDir) - : wxDbTable(pDb, tblName, 1, wxT(""), !wxDB_QUERY_ONLY, + : wxDbTable(pDb, tblName, 1, wxEmptyString, !wxDB_QUERY_ONLY, defDir) { @@ -143,7 +143,7 @@ Clookup::Clookup(wxChar *tblName, wxChar *colName, wxDb *pDb, const wxString &de // Clookup2 constructor Clookup2::Clookup2(wxChar *tblName, wxChar *colName1, wxChar *colName2, wxDb *pDb, const wxString &defDir) - : wxDbTable(pDb, tblName, (1 + (wxStrlen(colName2) > 0)), wxT(""), + : wxDbTable(pDb, tblName, (UWORD)(1 + (wxStrlen(colName2) > 0)), wxEmptyString, !wxDB_QUERY_ONLY, defDir) { wxASSERT(pDb); @@ -153,10 +153,10 @@ Clookup2::Clookup2(wxChar *tblName, wxChar *colName1, wxChar *colName2, int i = 0; - SetColDefs (i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false); + SetColDefs ((UWORD)i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false); if (wxStrlen(colName2) > 0) - SetColDefs (++i, colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false); + SetColDefs ((UWORD)(++i), colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false); } // Clookup2() @@ -175,7 +175,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName, : wxDialog (parent, LOOKUP_DIALOG, wxT("Select..."), wxDefaultPosition, wxSize(400, 290)) { wxBeginBusyCursor(); - + wxStrcpy(ListDB_Selection,wxT("")); widgetPtrsSet = false; lookup = 0; @@ -267,12 +267,12 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName, // ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName, wxChar *dispCol1, wxChar *dispCol2, wxChar *where, wxChar *orderBy, - wxDb *pDb, const wxString &defDir, bool distinctValues, + wxDb *pDb, const wxString &defDir, bool distinctValues, wxChar *selectStmt, int maxLenCol1, bool allowOk) : wxDialog (parent, LOOKUP_DIALOG, wxT("Select..."), wxDefaultPosition, wxSize(400, 290)) { wxBeginBusyCursor(); - + wxStrcpy(ListDB_Selection,wxT("")); wxStrcpy(ListDB_Selection2,wxT("")); widgetPtrsSet = false; diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index 031940c99f..974ffe9339 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -91,7 +91,7 @@ void MyCanvas::OnEraseBackground(wxEraseEvent& event) { wxSize sz = GetClientSize(); wxRect rect(0, 0, sz.x, sz.y); - + if (event.GetDC()) { wxGetApp().TileBitmap(rect, *(event.GetDC()), wxGetApp().GetBackgroundBitmap()); @@ -195,7 +195,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) #else wxIcon icon(wxICON(dragicon)); #endif - + m_dragImage = new wxDragImage(icon, wxCursor(wxCURSOR_HAND)); break; } @@ -205,19 +205,19 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) // The offset between the top-left of the shape image and the current shape position wxPoint beginDragHotSpot = m_dragStartPos - m_draggedShape->GetPosition(); - + // Now we do this inside the implementation: always assume // coordinates relative to the capture window (client coordinates) //if (fullScreen) // beginDragHotSpot -= ClientToScreen(wxPoint(0, 0)); - + if (!m_dragImage->BeginDrag(beginDragHotSpot, this, fullScreen)) { delete m_dragImage; m_dragImage = (wxDragImage*) NULL; m_dragMode = TEST_DRAG_NONE; - + } else { m_dragImage->Move(event.GetPosition()); @@ -287,7 +287,7 @@ void MyCanvas::EraseShape(DragShape* shape, wxDC& dc) wxRect rect2(shape->GetRect()); dc.SetClippingRegion(rect2.x, rect2.y, rect2.width, rect2.height); - + wxGetApp().TileBitmap(rect, dc, wxGetApp().GetBackgroundBitmap()); dc.DestroyClippingRegion(); @@ -334,19 +334,19 @@ MyFrame::MyFrame() file_menu->Append( wxID_ABOUT, _T("&About...")); file_menu->AppendCheckItem( TEST_USE_SCREEN, _T("&Use whole screen for dragging"), _T("Use whole screen")); file_menu->Append( wxID_EXIT, _T("E&xit")); - + wxMenuBar *menu_bar = new wxMenuBar(); menu_bar->Append(file_menu, _T("&File")); SetIcon(wxICON(mondrian)); SetMenuBar( menu_bar ); - + #if wxUSE_STATUSBAR CreateStatusBar(2); int widths[] = { -1, 100 }; SetStatusWidths( 2, widths ); #endif // wxUSE_STATUSBAR - + m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) ); } @@ -359,7 +359,7 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) { (void)wxMessageBox( _T("wxDragImage demo\n") _T("Julian Smart (c) 2000"), - _T("About wxDragImage Demo"), + _T("About wxDragImage Demo"), wxICON_INFORMATION | wxOK ); } @@ -447,7 +447,7 @@ bool MyApp::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap) { int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); - + int i, j; for (i = rect.x; i < rect.x + rect.width; i += w) { @@ -473,10 +473,6 @@ DragShape::DragShape(const wxBitmap& bitmap) m_show = true; } -DragShape::~DragShape() -{ -} - bool DragShape::HitTest(const wxPoint& pt) const { wxRect rect(GetRect()); @@ -489,7 +485,7 @@ bool DragShape::Draw(wxDC& dc, int op) { wxMemoryDC memDC; memDC.SelectObject(m_bitmap); - + dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(), & memDC, 0, 0, op, true); diff --git a/samples/dragimag/dragimag.h b/samples/dragimag/dragimag.h index 61958342f2..cdc1baa912 100644 --- a/samples/dragimag/dragimag.h +++ b/samples/dragimag/dragimag.h @@ -123,7 +123,7 @@ class DragShape: public wxObject { public: DragShape(const wxBitmap& bitmap); - ~DragShape(); + ~DragShape(){}; //// Operations diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index f524b224f4..fa8d1938f7 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -674,11 +674,12 @@ void MyCanvas::DrawDefault(wxDC& dc) wxMemoryDC memdc2; memdc2.SelectObject(bitmap2); - wxBrush yellowBrush(wxColour(255, 255, 0), wxSOLID); + wxColour clr(255, 255, 0); + wxBrush yellowBrush(clr, wxSOLID); memdc2.SetBackground(yellowBrush); memdc2.Clear(); - wxPen yellowPen(wxColour(255, 255, 0), 1, wxSOLID); + wxPen yellowPen(clr, 1, wxSOLID); // Now draw a white rectangle with red outline. It should // entirely eclipse the yellow background. @@ -951,7 +952,8 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event)) if ( m_owner->m_textureBackground) { if ( ! m_owner->m_backgroundBrush.Ok() ) { - wxBrush b(wxColour(0,128,0), wxSOLID); + wxColour clr(0,128,0); + wxBrush b(clr, wxSOLID); dc.SetBackground(b); } } diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index 166f7e1008..cd9c9f8ac2 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -198,9 +198,9 @@ void MyCanvas::OnChar( wxKeyEvent &event ) case WXK_RIGHT: m_text += wxT( "" ); break; case WXK_DOWN: m_text += wxT( "" ); break; case WXK_RETURN: m_text += wxT( "" ); break; - default: m_text += event.m_keyCode; break; + default: m_text += (wxChar)event.m_keyCode; break; } - + } void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) @@ -215,7 +215,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetTextForeground(*wxBLUE); dc.DrawText(_T("This text is drawn from OnPaint"), 65, 65); - + wxString tmp; tmp.Printf( _T("Hit any key to display more text: %s"), m_text.c_str() ); int w,h; diff --git a/samples/font/font.cpp b/samples/font/font.cpp index df30e1b671..626a5d8d4e 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -32,8 +32,10 @@ #include "wx/splitter.h" #include "wx/textfile.h" +#ifdef __WXMAC__ #undef wxFontDialog #include "wx/mac/fontdlg.h" +#endif // ---------------------------------------------------------------------------- // private classes @@ -57,7 +59,7 @@ class MyCanvas: public wxWindow { public: MyCanvas( wxWindow *parent ); - virtual ~MyCanvas(); + virtual ~MyCanvas(){}; // accessors for the frame const wxFont& GetTextFont() const { return m_font; } @@ -714,10 +716,6 @@ MyCanvas::MyCanvas( wxWindow *parent ) { } -MyCanvas::~MyCanvas() -{ -} - void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc(this); @@ -784,7 +782,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { for ( int j = 0; j < 32; j++ ) { - wxChar c = 32 * (i + 1) + j; + wxChar c = (wxChar)(32 * (i + 1) + j); long charWidth, charHeight; dc.GetTextExtent(c, &charWidth, &charHeight); diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 86f387a629..9464900565 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -722,7 +722,8 @@ void GridFrame::SetCellBgColour( wxCommandEvent& WXUNUSED(ev) ) { // Check the new Refresh function by passing it a rectangle // which exactly fits the grid. - wxRect r(wxPoint(0, 0), grid->GetSize()); + wxPoint pt(0, 0); + wxRect r(pt, grid->GetSize()); grid->SetDefaultCellBackgroundColour(col); grid->Refresh(true, &r); } @@ -1349,10 +1350,6 @@ wxString BugsGridTable::GetColLabelValue( int col ) return headers[col]; } -BugsGridTable::BugsGridTable() -{ -} - // ---------------------------------------------------------------------------- // BugsGridFrame // ---------------------------------------------------------------------------- diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h index 9ddddbdbe8..ec95d19e1d 100644 --- a/samples/grid/griddemo.h +++ b/samples/grid/griddemo.h @@ -232,7 +232,7 @@ private: class BugsGridTable : public wxGridTableBase { public: - BugsGridTable(); + BugsGridTable(){}; virtual int GetNumberRows(); virtual int GetNumberCols(); diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 9c3108725f..73d82e1cfd 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -203,7 +203,7 @@ public: { unsigned char *cmap = new unsigned char [256]; for ( int i = 0; i < 256; i++ ) - cmap[i] = i; + cmap[i] = (unsigned char)i; image.SetPalette(wxPalette(256, cmap, cmap, cmap)); delete cmap; @@ -538,7 +538,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, tmp << i ; wxLogError(tmp); } - else + else my_horse_ani [i] = wxBitmap( image ); } #endif // wxUSE_ICO_CUR @@ -549,7 +549,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, wxFile file(dir + _T("horse.bmp")); if ( file.IsOpened() ) { - off_t len = file.Length(); + size_t len = (size_t)file.Length(); void *data = malloc(len); if ( file.Read(data, len) != len ) wxLogError(_T("Reading bitmap file failed")); @@ -713,7 +713,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) // For testing transparency dc.SetBrush( *wxRED_BRUSH ); dc.DrawRectangle( 20, 2220, 560, 68 ); - + dc.DrawText(_T("XPM bitmap"), 30, 2230 ); if ( m_bmpSmileXpm.Ok() ) dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true); @@ -721,8 +721,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.DrawText(_T("XPM icon"), 110, 2230 ); if ( m_iconSmileXpm.Ok() ) dc.DrawIcon(m_iconSmileXpm, 110, 2250); - - // testing icon -> bitmap conversion + + // testing icon -> bitmap conversion wxBitmap to_blit( m_iconSmileXpm ); if (to_blit.Ok()) { @@ -737,7 +737,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetUserScale( 2, 2 ); dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true ); dc.SetUserScale( 1.0, 1.0 ); - + dc.DrawText( _T("Blit"), 400, 2230); wxMemoryDC blit_dc; blit_dc.SelectObject( to_blit ); @@ -822,7 +822,7 @@ void MyCanvas::CreateAntiAliasedBitmap() original.GetBlue( x*2, y*2+1 ) + original.GetBlue( x*2+1, y*2+1 ); blue = blue/4; - anti.SetRGB( x, y, red, green, blue ); + anti.SetRGB( x, y, (unsigned char)red, (unsigned char)green, (unsigned char)blue ); } my_anti = new wxBitmap(anti); } diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 7fd5df9a29..d4faa14be2 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -251,15 +251,15 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) localeInfo.Printf(_("Language: %s\nSystem locale name:\n%s\nCanonical locale name: %s\n"), locale.c_str(), sysname.c_str(), canname.c_str() ); - wxMessageDialog - ( - this, - wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart")) - + wxT("\n\n") - + localeInfo, - _("About Internat"), - wxOK | wxICON_INFORMATION - ).ShowModal(); + wxMessageDialog dlg( + this, + wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart")) + + wxT("\n\n") + + localeInfo, + _("About Internat"), + wxOK | wxICON_INFORMATION + ); + dlg.ShowModal(); } void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 924103bf01..ea87565499 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -132,7 +132,7 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event) ymax += abs(ymin); pt.y += abs(ymin); } - + // Scale to canvas size int cw, ch; GetSize(&cw, &ch); @@ -178,11 +178,6 @@ MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, canvas = new MyCanvas(this); } -MyFrame::~MyFrame() -{ - // Empty -} - void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(true); diff --git a/samples/joytest/joytest.h b/samples/joytest/joytest.h index 31bfa14e5b..0c50e66e62 100644 --- a/samples/joytest/joytest.h +++ b/samples/joytest/joytest.h @@ -45,7 +45,7 @@ public: MyCanvas *canvas; MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); - ~MyFrame(); + ~MyFrame(){}; void OnActivate(wxActivateEvent& event); void OnQuit(wxCommandEvent& event); diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index 17be24a877..ed27778a83 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -37,10 +37,6 @@ IMPLEMENT_APP(MyApp) -MyApp::MyApp() -{ -} - bool MyApp::OnInit() { // Create the main frame window @@ -61,7 +57,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(LAYOUT_TEST_SIZER, MyFrame::TestFlexSizers) EVT_MENU(LAYOUT_TEST_NB_SIZER, MyFrame::TestNotebookSizers) - EVT_MENU(LAYOUT_TEST_GB_SIZER, MyFrame::TestGridBagSizer) + EVT_MENU(LAYOUT_TEST_GB_SIZER, MyFrame::TestGridBagSizer) END_EVENT_TABLE() // Define my frame constructor @@ -365,7 +361,7 @@ enum { GBS_SHOW_BTN, GBS_MOVE_BTN1, GBS_MOVE_BTN2, - + GBS_MAX, }; @@ -385,11 +381,11 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar *title, int x, int y ) m_panel = p; m_gbs = new wxGridBagSizer(); - + m_gbs->Add( new wxStaticText(p, wxID_ANY, gbsDescription), POS(0,0), SPAN(1, 7), wxALIGN_CENTER | wxALL, 5); - + m_gbs->Add( TEXTCTRL("pos(1,0)"), POS(1,0) ); m_gbs->Add( TEXTCTRL("pos(1,1)"), POS(1,1) ); m_gbs->Add( TEXTCTRL("pos(2,0)"), POS(2,0) ); @@ -401,7 +397,7 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar *title, int x, int y ) m_gbs->Add( TEXTCTRL("pos(5,4)"), POS(5,4), wxDefaultSpan, wxEXPAND ); m_gbs->Add( TEXTCTRL("pos(6,5)"), POS(6,5), wxDefaultSpan, wxEXPAND ); m_gbs->Add( TEXTCTRL("pos(7,6)"), POS(7,6) ); - + //m_gbs->Add( TEXTCTRL("bad position"), POS(4,3) ); // Test for assert //m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert @@ -410,28 +406,28 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar *title, int x, int y ) m_moveBtn2 = new wxButton(p, GBS_MOVE_BTN2, _T("Move this to (3,6)")); m_gbs->Add( m_moveBtn1, POS(10,2) ); m_gbs->Add( m_moveBtn2, POS(10,3) ); - + m_hideBtn = new wxButton(p, GBS_HIDE_BTN, _T("Hide this item -->")); m_gbs->Add(m_hideBtn, POS(12, 3)); m_hideTxt = new wxTextCtrl(p, wxID_ANY, _T("pos(12,4), size(150, -1)"), wxDefaultPosition, wxSize(150,-1)); m_gbs->Add( m_hideTxt, POS(12,4) ); - + m_showBtn = new wxButton(p, GBS_SHOW_BTN, _T("<-- Show it again")); m_gbs->Add(m_showBtn, POS(12, 5)); m_showBtn->Disable(); m_gbs->Add(10,10, POS(14,0)); - + m_gbs->AddGrowableRow(3); m_gbs->AddGrowableCol(2); - + p->SetSizerAndFit(m_gbs); SetClientSize(p->GetSize()); } - + void MyGridBagSizerFrame::OnHideBtn(wxCommandEvent&) { m_gbs->Hide(m_hideTxt); @@ -460,14 +456,14 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event) m_gbs->SetItemPosition(btn, m_lastPos); btn->SetLabel(_T("Move this to (3,6)")); } - else + else { if ( m_gbs->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) ) wxMessageBox( _T("wxGridBagSizer will not allow items to be in the same cell as\n\ another item, so this operation will fail. You will also get an assert\n\ when compiled in debug mode."), _T("Warning"), wxOK | wxICON_INFORMATION); - + if ( m_gbs->SetItemPosition(btn, wxGBPosition(3,6)) ) { m_lastPos = curPos; diff --git a/samples/layout/layout.h b/samples/layout/layout.h index 1a4923d4e9..fdb38de484 100644 --- a/samples/layout/layout.h +++ b/samples/layout/layout.h @@ -13,7 +13,7 @@ class MyApp: public wxApp { public: - MyApp(); + MyApp(){}; bool OnInit(); }; @@ -26,7 +26,7 @@ public: void TestFlexSizers(wxCommandEvent& event); void TestNotebookSizers(wxCommandEvent& event); void TestGridBagSizer(wxCommandEvent& event); - + void OnAbout(wxCommandEvent& event); void OnQuit(wxCommandEvent& event); @@ -62,7 +62,7 @@ public: void OnHideBtn(wxCommandEvent&); void OnShowBtn(wxCommandEvent&); void OnMoveBtn(wxCommandEvent&); - + private: wxGridBagSizer* m_gbs; wxPanel* m_panel; @@ -73,7 +73,7 @@ private: wxButton* m_moveBtn1; wxButton* m_moveBtn2; wxGBPosition m_lastPos; - + DECLARE_EVENT_TABLE() }; diff --git a/samples/mobile/styles/styles.cpp b/samples/mobile/styles/styles.cpp index 55d194a95c..ddef0c19e6 100644 --- a/samples/mobile/styles/styles.cpp +++ b/samples/mobile/styles/styles.cpp @@ -2,7 +2,7 @@ // Name: styles.cpp // Author: Robert Roebling // Created: 04/07/02 -// Copyright: +// Copyright: ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -41,17 +41,17 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, CreateStatusBar(1); SetStatusText( _T("Welcome to Styles!") ); #endif // wxUSE_STATUSBAR - + wxImage image; image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG ); - + wxBitmap bitmap( image ); #ifdef __WXUNIVERSAL__ SetBackground( bitmap, 0, wxTILE ); #endif - + new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) ); - + new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) ); } @@ -64,7 +64,7 @@ void MyFrame::CreateMyMenuBar() wxMenuBar *menu_bar = new wxMenuBar(); menu_bar->Append( file_menu, _T("&File") ); - + SetMenuBar( menu_bar ); } @@ -88,20 +88,16 @@ void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) ) IMPLEMENT_APP(MyApp) -MyApp::MyApp() -{ -} - bool MyApp::OnInit() { wxInitAllImageHandlers(); SetVendorName(_T("Free world")); SetAppName(_T("Styles")); - + MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) ); frame->Show( true ); - + return true; } diff --git a/samples/mobile/styles/styles.h b/samples/mobile/styles/styles.h index 4dbc634360..d4629f6e88 100644 --- a/samples/mobile/styles/styles.h +++ b/samples/mobile/styles/styles.h @@ -36,16 +36,16 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE ); - + private: void CreateMyMenuBar(); - + private: void OnAbout( wxCommandEvent &event ); void OnQuit( wxCommandEvent &event ); - + void OnCloseWindow( wxCloseEvent &event ); - + private: DECLARE_EVENT_TABLE() }; @@ -57,8 +57,8 @@ private: class MyApp: public wxApp { public: - MyApp(); - + MyApp(){}; + virtual bool OnInit(); virtual int OnExit(); }; diff --git a/samples/mobile/wxedit/wxedit.cpp b/samples/mobile/wxedit/wxedit.cpp index 53d6b6f710..87676f4571 100644 --- a/samples/mobile/wxedit/wxedit.cpp +++ b/samples/mobile/wxedit/wxedit.cpp @@ -2,7 +2,7 @@ // Name: wxedit.cpp // Author: Robert Roebling // Created: 04/07/02 -// Copyright: +// Copyright: ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -34,20 +34,20 @@ BEGIN_EVENT_TABLE(MyFrame,wxFrame) EVT_MENU(ID_ABOUT, MyFrame::OnAbout) - + EVT_MENU(ID_NEW, MyFrame::OnNew) EVT_MENU(ID_OPEN, MyFrame::OnOpen) EVT_MENU(ID_SAVE, MyFrame::OnSave) EVT_MENU(ID_SAVEAS, MyFrame::OnSaveAs) EVT_MENU(ID_QUIT, MyFrame::OnQuit) - + EVT_MENU(ID_COPY, MyFrame::OnCopy) EVT_MENU(ID_CUT, MyFrame::OnCut) EVT_MENU(ID_PASTE, MyFrame::OnPaste) EVT_MENU(ID_DELETE, MyFrame::OnDelete) - + EVT_MENU_RANGE(ID_LAST_1, ID_LAST_3, MyFrame::OnLastFiles) - + EVT_CLOSE(MyFrame::OnCloseWindow) EVT_UPDATE_UI(wxID_ANY,MyFrame::OnUpdateUI) END_EVENT_TABLE() @@ -62,26 +62,26 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, CreateStatusBar(1); SetStatusText( _T("Welcome to wxEdit!") ); #endif // wxUSE_STATUSBAR - + // Create edit control. Since it is the only // control in the frame, it will be resized // to file it out. m_text = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); - + // Read .ini file for file history etc. wxConfig *conf = (wxConfig*) wxConfig::Get(); - int entries = 0; + int entries = 0; conf->Read( _T("/History/Count"), &entries ); - + for (int i = 0; i < entries; i++) { wxString tmp; tmp.Printf( _T("/History/File%d"), (int)i ); - + wxString res; conf->Read( tmp, &res ); - + if (!res.empty()) AddToHistory( res ); } @@ -90,19 +90,19 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, void MyFrame::MakeHistory() { wxMenuBar *mb = GetMenuBar(); - + wxASSERT( mb ); int max = m_history.GetCount(); if (max > HISTORY_ENTRIES) max = HISTORY_ENTRIES; - + for (int i = 0; i < max; i++) { wxMenu *menu = NULL; mb->FindItem( ID_LAST_1 + i, &menu ); wxASSERT( menu ); - + wxFileName fname( m_history[(size_t)i] ); menu->SetLabel( ID_LAST_1 + i, fname.GetFullName() ); } @@ -112,12 +112,12 @@ void MyFrame::AddToHistory( const wxString &fname ) { // Fill menu with history index int index = m_history.Index( fname ); - + if (index != wxNOT_FOUND) m_history.RemoveAt( (size_t) index ); - + m_history.Insert( fname, 0 ); - + // Update menu MakeHistory(); } @@ -140,17 +140,17 @@ void MyFrame::CreateMyMenuBar() edit_menu->Append( ID_PASTE, _T("Paste") ); edit_menu->AppendSeparator(); edit_menu->Append( ID_DELETE, _T("Delete") ); - + wxMenu *history_menu = new wxMenu; history_menu->Append( ID_LAST_1, _T("No file.") ); history_menu->Append( ID_LAST_2, _T("No file.") ); history_menu->Append( ID_LAST_3, _T("No file.") ); - + wxMenuBar *menu_bar = new wxMenuBar(); menu_bar->Append( file_menu, _T("&File") ); menu_bar->Append( edit_menu, _T("&Edit") ); menu_bar->Append( history_menu, _T("&History") ); - + SetMenuBar( menu_bar ); } @@ -176,16 +176,16 @@ void MyFrame::OnLastFiles( wxCommandEvent &event ) if (!m_filename.empty()) AddToHistory( m_filename ); - + size_t index = event.GetId() - ID_LAST_1; - + if( index < m_history.GetCount() ) { m_filename = m_history[index]; - + m_text->Clear(); m_text->LoadFile( m_filename ); - + #if wxUSE_STATUSBAR SetStatusText( m_filename ); #endif // wxUSE_STATUSBAR @@ -206,12 +206,12 @@ void MyFrame::OnNew( wxCommandEvent& WXUNUSED(event) ) if (!Discard()) return; m_text->Clear(); - + if (!m_filename.empty()) AddToHistory( m_filename ); - + m_filename = wxEmptyString; - + #if wxUSE_STATUSBAR SetStatusText( _T("") ); #endif // wxUSE_STATUSBAR @@ -257,7 +257,7 @@ void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) ) m_filename = dialog.GetPath(); m_text->LoadFile( m_filename ); - + #if wxUSE_STATUSBAR SetStatusText( m_filename ); #endif // wxUSE_STATUSBAR @@ -278,7 +278,7 @@ void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) ) { m_filename = dialog.GetPath(); m_text->SaveFile( m_filename ); - + #if wxUSE_STATUSBAR SetStatusText( m_filename ); #endif // wxUSE_STATUSBAR @@ -300,12 +300,12 @@ void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) bool MyFrame::Save() { wxCommandEvent event; - + if (m_filename.empty()) OnSaveAs( event ); else m_text->SaveFile( m_filename ); - + return true; } @@ -315,19 +315,19 @@ bool MyFrame::Discard() { wxMessageDialog dialog( this, _T("Text has been\nmodified! Save?"), _T("wxEdit"), wxYES_NO|wxCANCEL|wxICON_EXCLAMATION ); - + int ret = dialog.ShowModal(); - + if (ret == wxID_CANCEL) return false; - + if (ret == wxID_YES) { if (!Save()) return false; } } - + return true; } @@ -353,7 +353,7 @@ void MyFrame::OnUpdateUI( wxUpdateUIEvent &event ) m_text->GetSelection(& selFrom, & selTo); event.Enable( selFrom != selTo ); } -#endif +#endif break; default: break; @@ -363,29 +363,29 @@ void MyFrame::OnUpdateUI( wxUpdateUIEvent &event ) void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) { // Save changes? - if (!Discard()) return; - + if (!Discard()) return; + // Add current to history if (!m_filename.empty()) AddToHistory( m_filename ); - // Write .ini file + // Write .ini file wxConfig *conf = (wxConfig*) wxConfig::Get(); - + int max = HISTORY_ENTRIES; if (m_history.GetCount() < (size_t)max) max = m_history.GetCount(); - + conf->Write( _T("/History/Count"), max ); - + for (int i = 0; i < max; i++) { wxString tmp; tmp.Printf( _T("/History/File%d"), (int)i ); - + conf->Write( tmp, m_history[(size_t)i] ); } - + // Flush and delete config delete wxConfig::Set( NULL ); @@ -399,18 +399,14 @@ void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) IMPLEMENT_APP(MyApp) -MyApp::MyApp() -{ -} - bool MyApp::OnInit() { SetVendorName(_T("Free world")); SetAppName(_T("wxEdit")); - + MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("wxEdit"), wxPoint(20,20), wxSize(500,340) ); frame->Show( true ); - + return true; } diff --git a/samples/mobile/wxedit/wxedit.h b/samples/mobile/wxedit/wxedit.h index de364747d7..6b412e61dd 100644 --- a/samples/mobile/wxedit/wxedit.h +++ b/samples/mobile/wxedit/wxedit.h @@ -50,15 +50,15 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE ); - + private: void CreateMyMenuBar(); - + private: wxTextCtrl *m_text; wxString m_filename; wxArrayString m_history; - + private: void OnAbout( wxCommandEvent &event ); void OnNew( wxCommandEvent &event ); @@ -66,23 +66,23 @@ private: void OnSave( wxCommandEvent &event ); void OnSaveAs( wxCommandEvent &event ); void OnQuit( wxCommandEvent &event ); - + void OnCopy( wxCommandEvent &event ); void OnCut( wxCommandEvent &event ); void OnPaste( wxCommandEvent &event ); void OnDelete( wxCommandEvent &event ); - + void OnLastFiles( wxCommandEvent &event ); - + void MakeHistory(); void AddToHistory( const wxString &fname ); - + bool Save(); bool Discard(); - + void OnUpdateUI( wxUpdateUIEvent &event ); void OnCloseWindow( wxCloseEvent &event ); - + private: DECLARE_EVENT_TABLE() }; @@ -94,8 +94,8 @@ private: class MyApp: public wxApp { public: - MyApp(); - + MyApp(){}; + virtual bool OnInit(); virtual int OnExit(); }; diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index 3bb9a21494..ede591f229 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -34,11 +34,6 @@ IMPLEMENT_APP(MyApp) -// Testing of ressources -MyApp::MyApp() -{ -} - bool MyApp::OnInit(void) { // Create the main frame window diff --git a/samples/nativdlg/nativdlg.h b/samples/nativdlg/nativdlg.h index 87d1148895..eb839430d0 100644 --- a/samples/nativdlg/nativdlg.h +++ b/samples/nativdlg/nativdlg.h @@ -17,7 +17,7 @@ class MyApp: public wxApp { public: - MyApp(void) ; + MyApp(void){}; bool OnInit(void); }; diff --git a/samples/opengl/isosurf/isosurf.cpp b/samples/opengl/isosurf/isosurf.cpp index ad9a6273c5..a02d4d8e71 100644 --- a/samples/opengl/isosurf/isosurf.cpp +++ b/samples/opengl/isosurf/isosurf.cpp @@ -373,10 +373,6 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, } -TestGLCanvas::~TestGLCanvas() -{ -} - void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) { // This is a dummy, to avoid an endless succession of paint messages. diff --git a/samples/opengl/isosurf/isosurf.h b/samples/opengl/isosurf/isosurf.h index 66c81485f0..cc85da042d 100644 --- a/samples/opengl/isosurf/isosurf.h +++ b/samples/opengl/isosurf/isosurf.h @@ -29,7 +29,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = _T("TestGLCanvas"), int *gl_attrib = NULL); - ~TestGLCanvas(); + ~TestGLCanvas(){}; void OnPaint(wxPaintEvent& event); void OnSize(wxSizeEvent& event); diff --git a/samples/opengl/penguin/lw.cpp b/samples/opengl/penguin/lw.cpp index fa9a3827e1..b97448a75e 100644 --- a/samples/opengl/penguin/lw.cpp +++ b/samples/opengl/penguin/lw.cpp @@ -63,7 +63,7 @@ static wxInt32 read_short(FILE *f) // when using the direct evaluation in the return statement wxInt32 first = read_char(f) ; wxInt32 second = read_char(f) ; - + return (first<<8) | second ; } @@ -91,7 +91,7 @@ static int read_string(FILE *f, char *s) do { c = read_char(f); if (cnt < LW_MAX_NAME_LEN) - s[cnt] = c; + s[cnt] = (char)c; else s[LW_MAX_NAME_LEN-1] = 0; cnt++; @@ -170,7 +170,7 @@ static void read_surf(FILE *f, int nbytes, lwObject *lwo) static void read_pols(FILE *f, int nbytes, lwObject *lwo) { int guess_cnt = lwo->face_cnt; - + while (nbytes > 0) { lwFace *face; int i; @@ -188,17 +188,17 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo) /* allocate space for points */ face->index = (int*) calloc(sizeof(int)*face->index_cnt,1); - + /* read points in */ for (i=0; iindex_cnt; i++) { face->index[i] = read_short(f); nbytes -= 2; } - + /* read surface material */ face->material = read_short(f); nbytes -= 2; - + /* skip over detail polygons */ if (face->material < 0) { int det_cnt; diff --git a/samples/ownerdrw/ownerdrw.cpp b/samples/ownerdrw/ownerdrw.cpp index cfaadcc756..3824969383 100644 --- a/samples/ownerdrw/ownerdrw.cpp +++ b/samples/ownerdrw/ownerdrw.cpp @@ -2,7 +2,7 @@ // Name: ownerdrw.cpp // Purpose: Owner-draw sample, for Windows // Author: Vadim Zeitlin -// Modified by: +// Modified by: // Created: 13.11.97 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin @@ -41,7 +41,7 @@ class OwnerDrawnFrame : public wxFrame public: // ctor & dtor OwnerDrawnFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h); - ~OwnerDrawnFrame(); + ~OwnerDrawnFrame(){}; // notifications void OnQuit (wxCommandEvent& event); @@ -61,12 +61,12 @@ private: wxMenuItem *pAboutItem; }; -enum +enum { - Menu_Quit = 1, + Menu_Quit = 1, Menu_First = 100, - Menu_Test1, Menu_Test2, Menu_Test3, - Menu_Bitmap, Menu_Bitmap2, + Menu_Test1, Menu_Test2, Menu_Test3, + Menu_Bitmap, Menu_Bitmap2, Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3, Menu_Toggle, Menu_About, Control_First = 1000, @@ -79,7 +79,7 @@ BEGIN_EVENT_TABLE(OwnerDrawnFrame, wxFrame) EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit) EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect) EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle) - EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, + EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, OwnerDrawnFrame::OnListboxDblClick) END_EVENT_TABLE() @@ -176,13 +176,13 @@ void OwnerDrawnFrame::InitMenu() file_menu->Append(pItem); file_menu->AppendSeparator(); - pItem = new wxMenuItem(file_menu, Menu_Toggle, _T("&Disable/Enable\tCtrl+D"), + pItem = new wxMenuItem(file_menu, Menu_Toggle, _T("&Disable/Enable\tCtrl+D"), _T("enables/disables the About-Item"), wxITEM_NORMAL); pItem->SetFont(*wxNORMAL_FONT); file_menu->Append(pItem); // Of course Ctrl+RatherLongAccel will not work in this example: - pAboutItem = new wxMenuItem(file_menu, Menu_About, _T("&About\tCtrl+RatherLongAccel"), + pAboutItem = new wxMenuItem(file_menu, Menu_About, _T("&About\tCtrl+RatherLongAccel"), _T("display program information"), wxITEM_NORMAL); pAboutItem->SetBitmap(bmpInfo); pAboutItem->SetDisabledBitmap(bmpInfo_mono); @@ -224,7 +224,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title, wxPanel *pPanel = new wxPanel(this); // check list box - static const wxChar* aszChoices[] = { _T("Hello"), _T("world"), _T("and"), + static const wxChar* aszChoices[] = { _T("Hello"), _T("world"), _T("and"), _T("goodbye"), _T("cruel"), _T("world"), _T("-------"), _T("owner-drawn"), _T("listbox") }; @@ -256,7 +256,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title, // normal (but owner-drawn) listbox static const wxChar* aszColors[] = { _T("Red"), _T("Blue"), _T("Pink"), - _T("Green"), _T("Yellow"), + _T("Green"), _T("Yellow"), _T("Black"), _T("Violet") }; astrChoices = new wxString[WXSIZEOF(aszColors)]; @@ -279,17 +279,17 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title, #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) - struct { unsigned int r, g, b; } aColors[] = + struct { unsigned char r, g, b; } aColors[] = { {255,0,0}, {0,0,255}, {255,128,192}, - {0,255,0}, {255,255,128}, + {0,255,0}, {255,255,128}, {0,0,0}, {128,0,255} }; for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ ) { pListBox->GetItem(ui)->SetTextColour(wxColor(aColors[ui].r, - aColors[ui].g, + aColors[ui].g, aColors[ui].b)); // yellow on white is horrible... if ( ui == 4 ) @@ -307,10 +307,6 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title, Show(true); } -OwnerDrawnFrame::~OwnerDrawnFrame() -{ -} - void OwnerDrawnFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(true); diff --git a/samples/png/pngdemo.cpp b/samples/png/pngdemo.cpp index 7d1c3a47d3..5ae070ba07 100644 --- a/samples/png/pngdemo.cpp +++ b/samples/png/pngdemo.cpp @@ -29,10 +29,6 @@ wxBitmap *g_TestBitmap = (wxBitmap *) NULL; IMPLEMENT_APP(MyApp) -MyApp::MyApp() -{ -} - bool MyApp::OnInit(void) { wxImage::AddHandler(new wxPNGHandler); @@ -119,9 +115,9 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event)) wxT("png"), wxT("PNG files (*.png)|*.png") ); if (f == _T("")) return; - + wxBitmap *backstore = new wxBitmap( 150, 150 ); - + wxMemoryDC memDC; memDC.SelectObject( *backstore ); memDC.Clear(); @@ -132,11 +128,11 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event)) memDC.DrawLine( 0, 0, 0, 10 ); memDC.SetTextForeground( *wxWHITE ); memDC.DrawText( _T("This is a memory dc."), 10, 10 ); - + memDC.SelectObject( wxNullBitmap ); - + backstore->SaveFile( f, wxBITMAP_TYPE_PNG, (wxPalette*)NULL ); - + delete backstore; } @@ -173,10 +169,6 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size): { } -MyCanvas::~MyCanvas(void) -{ -} - // Define the repainting behaviour void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { diff --git a/samples/png/pngdemo.h b/samples/png/pngdemo.h index 66bb8354ee..8267cecf60 100644 --- a/samples/png/pngdemo.h +++ b/samples/png/pngdemo.h @@ -19,7 +19,7 @@ class MyApp: public wxApp { public: - MyApp(void) ; + MyApp(void){}; bool OnInit(void); }; @@ -46,7 +46,7 @@ class MyCanvas: public wxScrolledWindow { public: MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size); - ~MyCanvas(void) ; + ~MyCanvas(void){}; void OnPaint(wxPaintEvent& event); DECLARE_EVENT_TABLE() diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 95d65c86d3..827ed78269 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -66,10 +66,6 @@ IMPLEMENT_APP(MyApp) // Writes a header on a page. Margin units are in millimetres. bool WritePageHeader(wxPrintout *printout, wxDC *dc, wxChar *text, float mmToLogical); -MyApp::MyApp() -{ -} - // The `main program' equivalent, creating the windows and returning the // main frame bool MyApp::OnInit(void) @@ -340,10 +336,6 @@ MyCanvas::MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long SetBackgroundColour(* wxWHITE); } -MyCanvas::~MyCanvas(void) -{ -} - // Define the repainting behaviour void MyCanvas::OnDraw(wxDC& dc) { diff --git a/samples/printing/printing.h b/samples/printing/printing.h index 8361d5a882..25e098350d 100644 --- a/samples/printing/printing.h +++ b/samples/printing/printing.h @@ -17,7 +17,7 @@ class MyApp: public wxApp { public: - MyApp() ; + MyApp(){}; bool OnInit(); int OnExit(); @@ -59,7 +59,7 @@ class MyCanvas: public wxScrolledWindow { public: MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED); - ~MyCanvas(void) ; + ~MyCanvas(void){}; virtual void OnDraw(wxDC& dc); void OnEvent(wxMouseEvent& event); diff --git a/samples/richedit/wxllist.cpp b/samples/richedit/wxllist.cpp index 51ba0553e8..0025d971b3 100644 --- a/samples/richedit/wxllist.cpp +++ b/samples/richedit/wxllist.cpp @@ -735,11 +735,6 @@ wxLayoutLine::wxLayoutLine(wxLayoutLine *prev, wxLayoutList *llist) llist->IncNumLines(); } -wxLayoutLine::~wxLayoutLine() -{ - // kbList cleans itself -} - wxPoint wxLayoutLine::RecalculatePosition(wxLayoutList *llist) { @@ -777,14 +772,15 @@ wxLayoutLine::FindObject(CoordType xpos, CoordType *offset) const wxASSERT(offset); wxLayoutObjectList::iterator i, - found = NULLIT; + found(NULL), + nulled(NULL); CoordType x = 0, len; /* We search through the objects. As we don't like returning the object that the cursor is behind, we just remember such an object in "found" so we can return it if there is really no further object following it. */ - for(i = m_ObjectList.begin(); i != NULLIT; i++) + for(i = m_ObjectList.begin(); i != nulled; i++) { len = (**i).GetLength(); if( x <= xpos && xpos <= x + len ) @@ -809,10 +805,10 @@ wxLayoutLine::FindObjectScreen(wxDC &dc, wxLayoutList *llist, llist->ApplyStyle(GetStyleInfo(), dc); - wxLayoutObjectList::iterator i; + wxLayoutObjectList::iterator i, nulled(NULL); CoordType x = 0, cx = 0, width; - for(i = m_ObjectList.begin(); i != NULLIT; i++) + for(i = m_ObjectList.begin(); i != nulled; i++) { wxLayoutObject *obj = *i; if ( obj->GetType() == WXLO_TYPE_CMD ) @@ -883,7 +879,8 @@ wxLayoutLine::Insert(CoordType xpos, wxLayoutObject *obj) CoordType offset; wxLOiterator i = FindObject(xpos, &offset); - if(i == NULLIT) + wxLayoutObjectList::iterator nulled(NULL); + if(i == nulled) { if(xpos == 0 ) // aha, empty line! { @@ -940,7 +937,8 @@ wxLayoutLine::Insert(CoordType xpos, const wxString& text) CoordType offset; wxLOiterator i = FindObject(xpos, &offset); - if(i != NULLIT && (**i).GetType() == WXLO_TYPE_TEXT) + wxLayoutObjectList::iterator nulled(NULL); + if(i != nulled && (**i).GetType() == WXLO_TYPE_TEXT) { wxLayoutObjectText *tobj = (wxLayoutObjectText *) *i; tobj->GetText().insert(offset, text); @@ -964,9 +962,10 @@ wxLayoutLine::Delete(CoordType xpos, CoordType npos) wxASSERT(npos >= 0); MarkDirty(xpos); wxLOiterator i = FindObject(xpos, &offset); + wxLayoutObjectList::iterator nulled(NULL); while(npos > 0) { - if(i == NULLIT) return npos; + if(i == nulled) return npos; // now delete from that object: if((**i).GetType() != WXLO_TYPE_TEXT) { @@ -1020,10 +1019,10 @@ wxLayoutLine::DeleteWord(CoordType xpos) MarkDirty(xpos); wxLOiterator i = FindObject(xpos, &offset); - + wxLayoutObjectList::iterator nulled(NULL); for(;;) { - if(i == NULLIT) return false; + if(i == nulled) return false; if((**i).GetType() != WXLO_TYPE_TEXT) { // This should only happen when at end of line, behind a non-text @@ -1094,7 +1093,7 @@ wxLayoutLine::Draw(wxDC &dc, wxLayoutList *llist, const wxPoint & offset) const { - wxLayoutObjectList::iterator i; + wxLayoutObjectList::iterator i, nulled(NULL); wxPoint pos = offset; pos = pos + GetPosition(); @@ -1111,7 +1110,7 @@ wxLayoutLine::Draw(wxDC &dc, else llist->EndHighlighting(dc); - for(i = m_ObjectList.begin(); i != NULLIT; i++) + for(i = m_ObjectList.begin(); i != nulled; i++) { if(highlight == -1) // partially highlight line { @@ -1142,7 +1141,7 @@ wxLayoutLine::Layout(wxDC &dc, int cx, bool WXUNUSED(suppressSIupdate)) { - wxLayoutObjectList::iterator i; + wxLayoutObjectList::iterator i, nulled(NULL); // when a line becomes dirty, we redraw it from the place where it was // changed till the end of line (because the following wxLayoutObjects are @@ -1177,7 +1176,7 @@ wxLayoutLine::Layout(wxDC &dc, } m_StyleInfo = llist->GetStyleInfo(); // save current style - for(i = m_ObjectList.begin(); i != NULLIT; i++) + for(i = m_ObjectList.begin(); i != nulled; i++) { wxLayoutObject *obj = *i; obj->Layout(dc, llist); @@ -1313,7 +1312,8 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist) CoordType offset; wxLOiterator i = FindObject(xpos, &offset); - if(i == NULLIT) + wxLayoutObjectList::iterator nulled(NULL); + if(i == nulled) // must be at the end of the line then return new wxLayoutLine(this, llist); // split this line: @@ -1356,18 +1356,19 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist) bool wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist) { + wxLayoutObjectList::iterator nulled(NULL); if(GetLength() < wrapmargin) return false; // nothing to do // find the object which covers the wrapmargin: CoordType offset; wxLOiterator i = FindObject(wrapmargin, &offset); - wxCHECK_MSG( i != NULLIT, false, + wxCHECK_MSG( i != nulled, false, wxT("Cannot find object covering wrapmargin.")); // from this object on, the rest of the line must be copied to the // next one: - wxLOiterator copyObject = NULLIT; + wxLOiterator copyObject = nulled; // if we split a text-object, we must pre-pend some text to the // next line later on, remember it here: wxString prependText = _T(""); @@ -1390,7 +1391,7 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist) bool foundSpace = false; do { -// while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT) +// while(i != nulled && (**i).GetType() != WXLO_TYPE_TEXT) // i--; // try to find a suitable place to split the object: wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i; @@ -1431,7 +1432,7 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist) if( this == llist->GetCursorLine() && xpos >= breakpos ) { for(wxLOiterator j = m_ObjectList.begin(); - j != NULLIT && j != i; j++) + j != nulled && j != i; j++) objectCursorPos += (**j).GetLength(); } // now we know where to break it: @@ -1449,7 +1450,7 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist) wxASSERT(m_Next); // We need to move this and all following objects to the next // line. Starting from the end of line, to keep the order right. - if(copyObject != NULLIT) + if(copyObject != nulled) { wxLOiterator j; for(j = m_ObjectList.tail(); j != copyObject; j--) @@ -1558,7 +1559,8 @@ wxLayoutLine::GetWrapPosition(CoordType column) { CoordType offset; wxLOiterator i = FindObject(column, &offset); - if(i == NULLIT) return -1; // cannot wrap + wxLayoutObjectList::iterator nulled(NULL); + if(i == nulled) return -1; // cannot wrap // go backwards through the list and look for space in text objects do @@ -1582,20 +1584,20 @@ wxLayoutLine::GetWrapPosition(CoordType column) column -= (**i).GetLength(); i--; } - if( i != NULLIT) + if( i != nulled) offset = (**i).GetLength(); - }while(i != NULLIT); + }while(i != nulled); /* If we reached the begin of the list and have more than one object, that one is longer than the margin, so break behind it. */ CoordType pos = 0; i = m_ObjectList.begin(); - while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT) + while(i != nulled && (**i).GetType() != WXLO_TYPE_TEXT) { pos += (**i).GetLength(); i++; } - if(i == NULLIT) return -1; //why should this happen? + if(i == nulled) return -1; //why should this happen? // now we are behind the one long text object and need to find the // first space in it @@ -1613,6 +1615,7 @@ wxLayoutLine::GetWrapPosition(CoordType column) void wxLayoutLine::Debug() const { + wxLayoutObjectList::iterator nulled(NULL); wxPoint pos = GetPosition(); WXLO_DEBUG((wxT("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d"), (long int) GetLineNumber(), @@ -1620,7 +1623,7 @@ wxLayoutLine::Debug() const (long int) GetHeight(), (long int) m_BaseLine, (int) m_StyleInfo.family)); - if(m_ObjectList.begin() != NULLIT) + if(m_ObjectList.begin() != nulled) { WXLO_DEBUG(((**m_ObjectList.begin()).DebugDump().c_str())); } @@ -1633,6 +1636,7 @@ wxLayoutLine::Copy(wxLayoutList *llist, CoordType from, CoordType to) { + wxLayoutObjectList::iterator nulled(NULL); CoordType firstOffset, lastOffset; if(to == -1) to = GetLength(); @@ -1642,7 +1646,7 @@ wxLayoutLine::Copy(wxLayoutList *llist, wxLOiterator last = FindObject(to, &lastOffset); // Common special case: only one object - if( first != NULLIT && last != NULLIT && *first == *last ) + if( first != nulled && last != nulled && *first == *last ) { if( (**first).GetType() == WXLO_TYPE_TEXT ) { @@ -2003,6 +2007,7 @@ wxLayoutList::MoveCursorHorizontally(int n) bool wxLayoutList::MoveCursorWord(int n, bool untilNext) { + wxLayoutObjectList::iterator nulled(NULL); wxCHECK_MSG( m_CursorLine, false, wxT("no current line") ); wxCHECK_MSG( n == -1 || n == +1, false, wxT("not implemented yet") ); @@ -2013,7 +2018,7 @@ wxLayoutList::MoveCursorWord(int n, bool untilNext) n != 0; n > 0 ? i++ : i-- ) { - if ( i == NULLIT ) + if ( i == nulled ) { if ( n > 0 ) { @@ -2032,7 +2037,7 @@ wxLayoutList::MoveCursorWord(int n, bool untilNext) i = lineCur->GetLastObject(); } - if ( i == NULLIT ) + if ( i == nulled ) { // moved to the end/beginning of text return false; @@ -2209,6 +2214,7 @@ wxLayoutList::Insert(wxLayoutObject *obj) bool wxLayoutList::Insert(wxLayoutList *llist) { + wxLayoutObjectList::iterator nulled(NULL); wxASSERT(llist); bool rc = true; @@ -2218,7 +2224,7 @@ wxLayoutList::Insert(wxLayoutList *llist) ) { for(wxLOiterator i = line->GetFirstObject(); - i != NULLIT; + i != nulled; i++) rc |= Insert(*i); LineBreak(); @@ -2596,6 +2602,7 @@ wxLayoutObject * wxLayoutList::FindObjectScreen(wxDC &dc, wxPoint const pos, wxPoint *cursorPos, bool *found) { + wxLayoutObjectList::iterator nulled(NULL); // First, find the right line: wxLayoutLine *line = m_FirstLine, @@ -2646,7 +2653,7 @@ wxLayoutList::FindObjectScreen(wxDC &dc, wxPoint const pos, if ( found ) *found = didFind && foundinline; - return (i == NULLIT) ? NULL : *i; + return (i == nulled) ? NULL : *i; } @@ -3208,10 +3215,6 @@ wxLayoutPrintout::wxLayoutPrintout(wxLayoutList *llist, // layout is called in ScaleDC() when we have a DC } -wxLayoutPrintout::~wxLayoutPrintout() -{ -} - float wxLayoutPrintout::ScaleDC(wxDC *dc) { diff --git a/samples/richedit/wxllist.h b/samples/richedit/wxllist.h index d62a236737..9806179483 100644 --- a/samples/richedit/wxllist.h +++ b/samples/richedit/wxllist.h @@ -260,9 +260,6 @@ protected: /// Define a list type of wxLayoutObject pointers. KBLIST_DEFINE(wxLayoutObjectList, wxLayoutObject); -/// An illegal iterator to save typing. -#define NULLIT (wxLayoutObjectList::iterator(NULL)) - /// The iterator type. typedef wxLayoutObjectList::iterator wxLOiterator; @@ -595,7 +592,7 @@ public: @param xpos the column number @param offset where to store the difference between xpos and the object's head - @return iterator to the object or NULLIT + @return iterator to the object or iterator to NULL */ wxLayoutObjectList::iterator FindObject(CoordType xpos, CoordType *offset) const ; @@ -607,7 +604,7 @@ public: @param xpos the screen x coordinate @param offset where to store the difference between xpos and the object's head - @return iterator to the object or NULLIT + @return iterator to the object or iterator to NULL */ wxLayoutObjectList::iterator FindObjectScreen(wxDC &dc, wxLayoutList *llist, @@ -771,7 +768,7 @@ public: private: /// Destructor is private. Use DeleteLine() to remove it. - ~wxLayoutLine(); + ~wxLayoutLine(){}; /**@name Functions to let the lines synchronise with each other. */ //@{ @@ -1412,7 +1409,7 @@ public: _T("wxLayout Printout")); /// Destructor. - ~wxLayoutPrintout(); + ~wxLayoutPrintout(){}; /** Function which prints the n-th page. @param page the page number to print diff --git a/samples/richedit/wxlparser.cpp b/samples/richedit/wxlparser.cpp index fb139f5991..c5705745a4 100644 --- a/samples/richedit/wxlparser.cpp +++ b/samples/richedit/wxlparser.cpp @@ -180,10 +180,11 @@ wxLayoutExportStatus::wxLayoutExportStatus(wxLayoutList *list) wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status, int mode, int flags) { + wxLayoutObjectList::iterator nulled(NULL); wxASSERT(status); wxLayoutExportObject * exp; - if(status->m_iterator == NULLIT) // end of line + if(status->m_iterator == nulled) // end of line { if(!status->m_line || status->m_line->GetNextLine() == NULL) // reached end of list @@ -191,7 +192,7 @@ wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status, } exp = new wxLayoutExportObject(); wxLayoutObjectType type; - if(status->m_iterator != NULLIT) + if(status->m_iterator != nulled) { type = (** status->m_iterator).GetType(); if( mode == WXLO_EXPORT_AS_OBJECTS || ! WXLO_IS_TEXT(type)) // simple case @@ -203,7 +204,7 @@ wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status, } } else - { // iterator == NULLIT + { // iterator == nulled if(mode == WXLO_EXPORT_AS_OBJECTS) { exp->type = WXLO_EXPORT_EMPTYLINE; @@ -222,7 +223,7 @@ wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status, // text must be concatenated for(;;) { - while(status->m_iterator == NULLIT) + while(status->m_iterator == nulled) { if(mode & WXLO_EXPORT_AS_HTML) *str += _T("
"); diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index bd0cb05c31..4b60e0ab04 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -37,7 +37,7 @@ class MyCanvas: public wxScrolledWindow public: MyCanvas() {} MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size ); - ~MyCanvas(); + ~MyCanvas(){}; void OnPaint( wxPaintEvent &event ); void OnQueryPosition( wxCommandEvent &event ); void OnAddButton( wxCommandEvent &event ); @@ -272,10 +272,6 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, SetCursor( wxCursor( wxCURSOR_IBEAM ) ); } -MyCanvas::~MyCanvas() -{ -} - void MyCanvas::OnMouseDown( wxMouseEvent &event ) { if (event.LeftDown()) diff --git a/samples/scrollsub/scrollsub.cpp b/samples/scrollsub/scrollsub.cpp index 7f90285eb7..4891f67dab 100644 --- a/samples/scrollsub/scrollsub.cpp +++ b/samples/scrollsub/scrollsub.cpp @@ -36,9 +36,9 @@ class MyApp; class MyScrolledWindow: public wxScrolledWindow { public: - MyScrolledWindow() {} + MyScrolledWindow(){}; MyScrolledWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size ); - ~MyScrolledWindow(); + ~MyScrolledWindow(){}; void OnPaint( wxPaintEvent &event ); private: @@ -87,10 +87,10 @@ private: class MyCanvas: public wxPanel { public: - MyCanvas() {} + MyCanvas(){}; MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *right, wxWindowID id, const wxPoint &pos, const wxSize &size ); - ~MyCanvas(); + ~MyCanvas(){}; void OnPaint( wxPaintEvent &event ); void ScrollWindow( int dx, int dy, const wxRect *rect ); @@ -177,10 +177,6 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id, SetSizer( mainsizer ); } -MyScrolledWindow::~MyScrolledWindow() -{ -} - void MyScrolledWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); @@ -296,10 +292,6 @@ MyCanvas::MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *r SetCursor( wxCursor( wxCURSOR_IBEAM ) ); } -MyCanvas::~MyCanvas() -{ -} - void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index 805ff140fb..4ba2ae6c0e 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -29,7 +29,7 @@ # pragma hdrstop #endif -// for all others, include the necessary headers +// for all others, include the necessary headers #ifndef WX_PRECOMP # include "wx/wx.h" #endif @@ -313,7 +313,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event)) // // update waitmore if needed. // } // bool success = client->IsConnected(); - // + // // And that's all :-) m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n")); @@ -328,7 +328,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event)) m_text->AppendText(_("Failed ! Unable to connect\n")); wxMessageBox(_("Can't connect to the specified host"), _("Alert !")); } - + UpdateStatusBar(); } @@ -363,7 +363,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) m_sock->SetFlags(wxSOCKET_WAITALL); buf1 = _("Test string (less than 256 chars!)"); - len = (wxStrlen(buf1) + 1) * sizeof(wxChar); + len = (unsigned char)((wxStrlen(buf1) + 1) * sizeof(wxChar)); buf2 = new wxChar[wxStrlen(buf1) + 1]; m_text->AppendText(_("Sending a test buffer to the server ...")); @@ -443,7 +443,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event)) m_text->AppendText(_("Comparing the two buffers ...")); if (memcmp(msg1, msg2, len) != 0) { - m_text->AppendText(_("failed!\n")); + m_text->AppendText(_("failed!\n")); m_text->AppendText(_("Test 2 failed !\n")); } else diff --git a/samples/splitter/splitter.cpp b/samples/splitter/splitter.cpp index 0fdc603d09..767ed3c782 100644 --- a/samples/splitter/splitter.cpp +++ b/samples/splitter/splitter.cpp @@ -73,7 +73,7 @@ class MyFrame: public wxFrame { public: MyFrame(); - virtual ~MyFrame(); + virtual ~MyFrame(){}; // Menu commands void SplitHorizontal(wxCommandEvent& event); @@ -121,7 +121,7 @@ class MyCanvas: public wxScrolledWindow { public: MyCanvas(wxWindow* parent, bool mirror); - virtual ~MyCanvas(); + virtual ~MyCanvas(){}; virtual void OnDraw(wxDC& dc); @@ -242,10 +242,6 @@ MyFrame::MyFrame() #endif // wxUSE_STATUSBAR } -MyFrame::~MyFrame() -{ -} - // menu command handlers void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) ) @@ -419,10 +415,6 @@ MyCanvas::MyCanvas(wxWindow* parent, bool mirror) m_mirror = mirror; } -MyCanvas::~MyCanvas() -{ -} - void MyCanvas::OnDraw(wxDC& dcOrig) { wxMirrorDC dc(dcOrig, m_mirror); diff --git a/samples/text/text.cpp b/samples/text/text.cpp index ce57da1f3f..8ae237b1dd 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -97,10 +97,10 @@ class MyPanel: public wxPanel { public: MyPanel(wxFrame *frame, int x, int y, int w, int h); - virtual ~MyPanel() - { + virtual ~MyPanel() + { #if wxUSE_LOG - delete wxLog::SetActiveTarget(m_logOld); + delete wxLog::SetActiveTarget(m_logOld); #endif // wxUSE_LOG } @@ -200,13 +200,13 @@ public: if ( !m_panel->m_textrich->PageUp() ) wxLogMessage(_T("Already at the top")); } - + void OnGetLine(wxCommandEvent& WXUNUSED(event)) { long nLine = wxGetNumberFromUser(wxT("Which line would you like to get?"), wxT("Enter which line you would like to get"), wxT("Get a line from the tabbed multiline text control") ); - + wxMessageBox(m_panel->m_tab->GetLineText(nLine)); } @@ -215,8 +215,8 @@ public: long nLine = wxGetNumberFromUser(wxT("Which line would you like to get?"), wxT("Enter which line you would like to get"), wxT("Get length of a line from the tabbed multiline text control") ); - - wxMessageBox(wxString::Format(wxT("Length of line %i is:%i"), + + wxMessageBox(wxString::Format(wxT("Length of line %i is:%i"), (int) nLine, m_panel->m_tab->GetLineLength(nLine)) ); @@ -357,10 +357,10 @@ enum TEXT_LINE_UP, TEXT_PAGE_DOWN, TEXT_PAGE_UP, - + TEXT_GET_LINE, TEXT_GET_LINELENGTH, - + TEXT_REMOVE, TEXT_REPLACE, TEXT_SELECT, @@ -1552,7 +1552,7 @@ void RichTextFrame::OnChangeFont(wxCommandEvent& WXUNUSED(event)) wxTextAttr attr; attr.SetFont(font); - + long start, end; m_textCtrl->GetSelection(& start, & end); m_textCtrl->SetStyle(start, end, attr); @@ -1568,7 +1568,7 @@ void RichTextFrame::OnChangeTextColour(wxCommandEvent& WXUNUSED(event)) data.SetChooseFull(true); for (int i = 0; i < 16; i++) { - wxColour colour(i*16, i*16, i*16); + wxColour colour((unsigned char)(i*16), (unsigned char)(i*16), (unsigned char)(i*16)); data.SetCustomColour(i, colour); } @@ -1581,7 +1581,7 @@ void RichTextFrame::OnChangeTextColour(wxCommandEvent& WXUNUSED(event)) wxTextAttr attr; attr.SetTextColour(col); - + long start, end; m_textCtrl->GetSelection(& start, & end); m_textCtrl->SetStyle(start, end, attr); @@ -1597,7 +1597,7 @@ void RichTextFrame::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event)) data.SetChooseFull(true); for (int i = 0; i < 16; i++) { - wxColour colour(i*16, i*16, i*16); + wxColour colour((unsigned char)(i*16), (unsigned char)(i*16), (unsigned char)(i*16)); data.SetCustomColour(i, colour); } @@ -1610,7 +1610,7 @@ void RichTextFrame::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event)) wxTextAttr attr; attr.SetBackgroundColour(col); - + long start, end; m_textCtrl->GetSelection(& start, & end); m_textCtrl->SetStyle(start, end, attr); @@ -1634,7 +1634,7 @@ void RichTextFrame::OnLeftIndent(wxCommandEvent& WXUNUSED(event)) wxTextAttr attr; attr.SetLeftIndent(indent); - + long start, end; m_textCtrl->GetSelection(& start, & end); m_textCtrl->SetStyle(start, end, attr); @@ -1658,7 +1658,7 @@ void RichTextFrame::OnRightIndent(wxCommandEvent& WXUNUSED(event)) wxTextAttr attr; attr.SetRightIndent(indent); - + long start, end; m_textCtrl->GetSelection(& start, & end); m_textCtrl->SetStyle(start, end, attr); diff --git a/samples/thread/thread.cpp b/samples/thread/thread.cpp index dd421d794d..d239920382 100644 --- a/samples/thread/thread.cpp +++ b/samples/thread/thread.cpp @@ -47,7 +47,7 @@ class MyApp : public wxApp { public: MyApp(); - virtual ~MyApp(); + virtual ~MyApp(){}; virtual bool OnInit(); @@ -358,10 +358,6 @@ MyApp::MyApp() m_waitingUntilAllDone = false; } -MyApp::~MyApp() -{ -} - // `Main program' equivalent, creating windows and returning main app frame bool MyApp::OnInit() { diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 6ab96a4285..d140808b4d 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -363,9 +363,9 @@ void MyFrame::OnIdle(wxIdleEvent& event) void MyFrame::OnSize(wxSizeEvent& event) { - if ( m_treeCtrl + if ( m_treeCtrl #if wxUSE_LOG - && m_textCtrl + && m_textCtrl #endif // wxUSE_LOG ) { @@ -758,10 +758,6 @@ void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size)) #endif } -MyTreeCtrl::~MyTreeCtrl() -{ -} - int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2) { @@ -1168,7 +1164,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event) { //attempt to guess where to show the menu if (item.IsOk()) - { + { //if an item was clicked, show menu to the right of it wxRect rect; GetBoundingRect(item, rect, true); //true = only the label @@ -1184,7 +1180,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event) //event was generated by mouse, use supplied coords pt = ScreenToClient(pt); } - + ShowMenu(item, pt); } diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 6e328aed69..ebb7674e98 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -65,7 +65,7 @@ public: MyTreeCtrl(wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style); - virtual ~MyTreeCtrl(); + virtual ~MyTreeCtrl(){}; void OnBeginDrag(wxTreeEvent& event); void OnBeginRDrag(wxTreeEvent& event); diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 0550ca1a00..983961312d 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -71,6 +71,9 @@ BEGIN_EVENT_TABLE(MyApp, wxApp) EVT_MENU(TYPES_MIME, MyApp::DoMIMEDemo) END_EVENT_TABLE() +wxString file_name = _T("test_wx.dat"); +wxString file_name2 = wxString(_T("test_wx2.dat")); + bool MyApp::OnInit() { // Create the main frame window @@ -129,7 +132,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing to ofstream and wxFileOutputStream:\n") ); wxSTD ofstream std_file_output( "test_std.dat" ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); wxBufferedOutputStream buf_output( file_output ); wxTextOutputStream text_output( buf_output ); @@ -194,7 +197,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) buf_output.Sync(); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); wxBufferedInputStream buf_input( file_input ); wxTextInputStream text_input( file_input ); @@ -282,13 +285,13 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing number 0 to 9 to buffered wxFileOutputStream:\n\n") ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); wxBufferedOutputStream buf_output( file_output ); for (ch = 0; ch < 10; ch++) buf_output.Write( &ch, 1 ); buf_output.Sync(); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); for (ch2 = 0; ch2 < 10; ch2++) { file_input.Read( &ch, 1 ); @@ -299,7 +302,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing number 0 to 9 to buffered wxFileOutputStream, then\n") ); textCtrl.WriteText( _T("seeking back to #3 and writing 0:\n\n") ); - wxFileOutputStream file_output2( wxString(_T("test_wx2.dat")) ); + wxFileOutputStream file_output2( file_name2 ); wxBufferedOutputStream buf_output2( file_output2 ); for (ch = 0; ch < 10; ch++) buf_output2.Write( &ch, 1 ); @@ -308,7 +311,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) buf_output2.Write( &ch, 1 ); buf_output2.Sync(); - wxFileInputStream file_input2( wxString(_T("test_wx2.dat")) ); + wxFileInputStream file_input2( file_name2 ); for (ch2 = 0; ch2 < 10; ch2++) { file_input2.Read( &ch, 1 ); @@ -326,7 +329,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Reading number 0 to 9 from buffered wxFileInputStream, then\n") ); textCtrl.WriteText( _T("seeking back to #3 and reading the 0:\n\n") ); - wxFileInputStream file_input3( wxString(_T("test_wx2.dat")) ); + wxFileInputStream file_input3( file_name2 ); wxBufferedInputStream buf_input3( file_input3 ); for (ch2 = 0; ch2 < 10; ch2++) { @@ -354,7 +357,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream:\n\n") ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); for (ch = 0; ch < 10; ch++) file_output.Write( &ch, 1 ); @@ -362,7 +365,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Reading 0 to 10 to wxFileInputStream:\n\n") ); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); for (ch2 = 0; ch2 < 11; ch2++) { file_input.Read( &ch, 1 ); @@ -411,7 +414,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Reading 0 to 10 to wxFFileInputStream:\n\n") ); - wxFFileInputStream ffile_input( wxString(_T("test_wx.dat")) ); + wxFFileInputStream ffile_input( file_name ); for (ch2 = 0; ch2 < 11; ch2++) { ffile_input.Read( &ch, 1 ); @@ -459,7 +462,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Reading 0 to 10 to buffered wxFFileInputStream:\n\n") ); - wxFFileInputStream ffile_input2( wxString(_T("test_wx.dat")) ); + wxFFileInputStream ffile_input2( file_name ); wxBufferedInputStream buf_input( ffile_input2 ); for (ch2 = 0; ch2 < 11; ch2++) { @@ -516,7 +519,7 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) // bigger than buffer textCtrl.WriteText( _T("Writing 2000x 1 to wxFileOutputStream.\n\n") ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); for (int i = 0; i < 2000; i++) { char ch = 1; @@ -525,7 +528,7 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Opening with a buffered wxFileInputStream:\n\n") ); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); wxBufferedInputStream buf_input( file_input ); textCtrl.WriteText( _T("wxBufferedInputStream.GetLastError() returns: ") ); @@ -655,13 +658,13 @@ void MyApp::DoStreamDemo5(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream:\n\n") ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); for (ch = 0; ch < 10; ch++) file_output.Write( &ch, 1 ); file_output.Sync(); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); ch = file_input.Peek(); str.Printf( wxT("First char peeked: %d\n"), (int) ch ); @@ -730,7 +733,7 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); for (ch = 0; ch < 10; ch++) file_output.Write( &ch, 1 ); @@ -738,52 +741,52 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Reading char from wxFileInputStream:\n\n") ); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); ch = file_input.GetC(); - size_t pos = file_input.TellI(); + size_t pos = (size_t)file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading another char from wxFileInputStream:\n\n") ); ch = file_input.GetC(); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading yet another char from wxFileInputStream:\n\n") ); ch = file_input.GetC(); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxFileInputStream...\n\n") ); file_input.Ungetch( 5 ); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Now at position %d\n\n"), (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading char from wxFileInputStream:\n\n") ); ch = file_input.GetC(); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading another char from wxFileInputStream:\n\n") ); ch = file_input.GetC(); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxFileInputStream again...\n\n") ); file_input.Ungetch( 5 ); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Now at position %d\n\n"), (int) pos ); textCtrl.WriteText( str ); @@ -792,7 +795,7 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event)) file_input.SeekI( 3 ); ch = file_input.GetC(); - pos = file_input.TellI(); + pos = (size_t)file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); } @@ -809,7 +812,7 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") ); - wxFileOutputStream file_output( wxString(_T("test_wx.dat")) ); + wxFileOutputStream file_output( file_name ); for (ch = 0; ch < 10; ch++) file_output.Write( &ch, 1 ); @@ -817,53 +820,53 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("Reading char from wxBufferedInputStream via wxFileInputStream:\n\n") ); - wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); + wxFileInputStream file_input( file_name ); wxBufferedInputStream buf_input( file_input ); ch = buf_input.GetC(); - size_t pos = buf_input.TellI(); + size_t pos = (size_t)buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading another char from wxBufferedInputStream:\n\n") ); ch = buf_input.GetC(); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading yet another char from wxBufferedInputStream:\n\n") ); ch = buf_input.GetC(); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxBufferedInputStream...\n\n") ); buf_input.Ungetch( 5 ); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Now at position %d\n\n"), (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading char from wxBufferedInputStream:\n\n") ); ch = buf_input.GetC(); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Reading another char from wxBufferedInputStream:\n\n") ); ch = buf_input.GetC(); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxBufferedInputStream again...\n\n") ); buf_input.Ungetch( 5 ); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Now at position %d\n\n"), (int) pos ); textCtrl.WriteText( str ); @@ -872,7 +875,7 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event)) buf_input.SeekI( 3 ); ch = buf_input.GetC(); - pos = buf_input.TellI(); + pos = (size_t)buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); } diff --git a/samples/xrc/custclas.cpp b/samples/xrc/custclas.cpp index 1582342227..24669047db 100644 --- a/samples/xrc/custclas.cpp +++ b/samples/xrc/custclas.cpp @@ -102,11 +102,6 @@ MyResizableListCtrl::MyResizableListCtrl( wxWindow *parent, wxWindowID id, } -MyResizableListCtrl::~MyResizableListCtrl() -{ -} - - void MyResizableListCtrl::ContextSensitiveMenu( wxMouseEvent& event ) { // Make an instance of a menu. diff --git a/samples/xrc/custclas.h b/samples/xrc/custclas.h index 9973ed0161..9f13053fc3 100644 --- a/samples/xrc/custclas.h +++ b/samples/xrc/custclas.h @@ -69,7 +69,7 @@ public: ); // Destuctor. - ~MyResizableListCtrl(); + ~MyResizableListCtrl(){}; protected: diff --git a/samples/xrc/derivdlg.cpp b/samples/xrc/derivdlg.cpp index 64cda9224f..32c81c95ee 100644 --- a/samples/xrc/derivdlg.cpp +++ b/samples/xrc/derivdlg.cpp @@ -64,11 +64,6 @@ PreferencesDialog::PreferencesDialog(wxWindow* parent) wxXmlResource::Get()->LoadDialog(this, parent, wxT("derived_dialog")); } -// Destructor. (Empty, as I don't need anything special done when destructing). -PreferencesDialog::~PreferencesDialog() -{ -} - //----------------------------------------------------------------------------- // Private members (including the event handlers) //----------------------------------------------------------------------------- diff --git a/samples/xrc/derivdlg.h b/samples/xrc/derivdlg.h index edcf91f525..63df8e8244 100644 --- a/samples/xrc/derivdlg.h +++ b/samples/xrc/derivdlg.h @@ -45,7 +45,7 @@ public: PreferencesDialog( wxWindow* parent ); // Destructor. - ~PreferencesDialog(); + ~PreferencesDialog(){}; private: