From 8fc613f14f917aabe4bee20083f329b8fa298943 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 11 Feb 1999 12:44:10 +0000 Subject: [PATCH] Solaris compilation patches dbtest now works a little git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/db/dbtest.cpp | 47 +++++++++++++++++++------------ src/common/mimetype.cpp | 4 +-- src/gtk/app.cpp | 3 +- src/gtk/dcscreen.cpp | 2 +- src/gtk/font.cpp | 9 +++--- src/gtk/palette.cpp | 62 ++++++++++++++++++++--------------------- src/gtk/radiobox.cpp | 4 +-- src/gtk1/app.cpp | 3 +- src/gtk1/dcscreen.cpp | 2 +- src/gtk1/font.cpp | 9 +++--- src/gtk1/palette.cpp | 62 ++++++++++++++++++++--------------------- src/gtk1/radiobox.cpp | 4 +-- 12 files changed, 113 insertions(+), 98 deletions(-) diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index b4c08995e4..b5d0cbc3d2 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -619,7 +619,8 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 1, 1, 460, 455) // 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). - Contact->whereStr.Printf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->tableName); + // commented out because PostgreSQL can't do this + //Contact->whereStr.Printf("NAME = (SELECT MIN(NAME) FROM %s)",Contact->tableName); // NOTE: (const char*) returns a pointer which may not be valid later, so this is short term use only Contact->where = (char*) (const char*) Contact->whereStr; @@ -779,10 +780,13 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) } } + // commented out because PostgreSQL can't do this + // Previous record not available, retrieve first record in table - Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; - Contact->whereStr += Contact->tableName; - Contact->whereStr += ")"; + //Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; + //Contact->whereStr += Contact->tableName; + //Contact->whereStr += ")"; + Contact->where = (char*) (const char*) Contact->whereStr; if (!Contact->Query()) { @@ -832,9 +836,12 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // display it, if the query string has changed. if (strcmp(qryWhere, (const char*) Contact->qryWhereStr)) { - Contact->orderBy = "NAME"; - Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; - Contact->whereStr += CONTACT_TABLE_NAME; + + // commented out because PostgreSQL can't do this + Contact->whereStr = ""; + //Contact->orderBy = "NAME"; + //Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; + //Contact->whereStr += CONTACT_TABLE_NAME; // Append the query where string (if there is one) Contact->qryWhereStr = qryWhere; @@ -844,7 +851,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) Contact->whereStr += Contact->qryWhereStr; } // Close the expression with a right paren - Contact->whereStr += ")"; + // Contact->whereStr += ")"; // Requery the table Contact->where = (char*) (const char*) Contact->whereStr; if (!Contact->Query()) @@ -876,9 +883,10 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) // Query the first record in the table Contact->orderBy = "NAME"; - Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; - Contact->whereStr += CONTACT_TABLE_NAME; - Contact->whereStr += ")"; + // commented out because PostgreSQL can't do this + //Contact->whereStr = "NAME = (SELECT MIN(NAME) FROM "; + //Contact->whereStr += CONTACT_TABLE_NAME; + //Contact->whereStr += ")"; Contact->where = (char*) (const char*) Contact->whereStr; if (!Contact->Query()) @@ -1199,10 +1207,11 @@ bool CeditorDlg::GetNextRec() { wxString w; - - w = "NAME = (SELECT MIN(NAME) FROM "; - w += Contact->tableName; - w += " WHERE NAME > '"; + // commented out because PostgreSQL can't do this + //w = "NAME = (SELECT MIN(NAME) FROM "; + //w += Contact->tableName; + // w += " WHERE NAME > '"; + w = "(NAME > '"; w += Contact->Name; w += "'"; @@ -1229,9 +1238,11 @@ bool CeditorDlg::GetPrevRec() { wxString w; - w = "NAME = (SELECT MAX(NAME) FROM "; - w += Contact->tableName; - w += " WHERE NAME < '"; + // commented out because PostgreSQL can't do this + //w = "NAME = (SELECT MAX(NAME) FROM "; + //w += Contact->tableName; + //w += " WHERE NAME < '"; + w = "(NAME < '"; w += Contact->Name; w += "'"; diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 9f7cd6b0bf..9c9232276f 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -1031,8 +1031,8 @@ void wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName) } currentToken = Field_Type; // the flags and field values on the current line - bool needsterminal = false, - copiousoutput = false; + bool needsterminal = FALSE, + copiousoutput = FALSE; wxString strType, strOpenCmd, strPrintCmd, diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 78511d556f..78eef6efe3 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -30,7 +30,8 @@ #endif #include "unistd.h" -#ifdef __SUN__ +// add more here if you run into problems +#if defined(__SUN__) && !defined(__SunOs_5_6) && !defined(__SunOs_5_7) extern "C" { void usleep(unsigned long usec); diff --git a/src/gtk/dcscreen.cpp b/src/gtk/dcscreen.cpp index b7a89b9b83..1d71b4e739 100644 --- a/src/gtk/dcscreen.cpp +++ b/src/gtk/dcscreen.cpp @@ -329,7 +329,7 @@ bool wxScreenDC::StartDrawingOnTop( wxRect *rect ) if (sm_overlayWindow) gdk_window_show( sm_overlayWindow ); - return (sm_overlayWindow); + return (sm_overlayWindow != NULL); } bool wxScreenDC::EndDrawingOnTop(void) diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 9e52e23db1..59b5734012 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -108,8 +108,7 @@ wxFont::wxFont( char *xFontName ) M_FONTDATA->m_font = gdk_font_load( xFontName ); } -wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined = FALSE, - const wxString& face = wxEmptyString ) +wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined, const wxString& face ) { m_refData = new wxFontRefData(); @@ -442,12 +441,14 @@ static GdkFont *wxLoadQueryNearestFont( int point_size, int family, int style, i int max_size = point_size + 20 * (1 + (point_size/180)); int min_size = point_size - 20 * (1 + (point_size/180)); + int i; + /* Search for smaller size (approx.) */ - for (int i=point_size-10; !font && i >= 10 && i >= min_size; i -= 10) + for (i=point_size-10; !font && i >= 10 && i >= min_size; i -= 10) font = wxLoadQueryFont(i, family, style, weight, underlined, facename ); /* Search for larger size (approx.) */ - for (int i=point_size+10; !font && i <= max_size; i += 10) + for (i=point_size+10; !font && i <= max_size; i += 10) font = wxLoadQueryFont( i, family, style, weight, underlined, facename ); /* Try default family */ diff --git a/src/gtk/palette.cpp b/src/gtk/palette.cpp index 4cdaef3726..61e16d77ac 100644 --- a/src/gtk/palette.cpp +++ b/src/gtk/palette.cpp @@ -33,13 +33,13 @@ class wxPaletteRefData: public wxObjectRefData wxPaletteRefData::wxPaletteRefData() { - m_colormap = (GdkColormap *) NULL; -}; + m_colormap = (GdkColormap *) NULL; +} wxPaletteRefData::~wxPaletteRefData() { - if (m_colormap) gdk_colormap_unref( m_colormap ); -}; + if (m_colormap) gdk_colormap_unref( m_colormap ); +} //----------------------------------------------------------------------------- @@ -49,71 +49,71 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) wxPalette::wxPalette() { -}; +} wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ) { - m_refData = new wxPaletteRefData(); - Create( n, red, green, blue ); -}; + m_refData = new wxPaletteRefData(); + Create( n, red, green, blue ); +} wxPalette::wxPalette( const wxPalette& palette ) { - Ref( palette ); -}; + Ref( palette ); +} wxPalette::~wxPalette() { -}; +} wxPalette& wxPalette::operator = ( const wxPalette& palette ) { - if (*this == palette) return (*this); - Ref( palette ); - return *this; -}; + if (*this == palette) return (*this); + Ref( palette ); + return *this; +} bool wxPalette::operator == ( const wxPalette& palette ) { - return m_refData == palette.m_refData; -}; + return m_refData == palette.m_refData; +} bool wxPalette::operator != ( const wxPalette& palette ) { - return m_refData != palette.m_refData; -}; + return m_refData != palette.m_refData; +} bool wxPalette::Ok(void) const { - return (m_refData); -}; + return (m_refData != NULL); +} bool wxPalette::Create( int WXUNUSED(n), const unsigned char *WXUNUSED(red), const unsigned char *WXUNUSED(green), const unsigned char *WXUNUSED(blue) ) { - wxFAIL_MSG("not implemented"); + wxFAIL_MSG("not implemented"); - return FALSE; -}; + return FALSE; +} int wxPalette::GetPixel( const unsigned char WXUNUSED(red), const unsigned char WXUNUSED(green), const unsigned char WXUNUSED(blue) ) const { - wxFAIL_MSG("not implemented"); + wxFAIL_MSG("not implemented"); - return 0; -}; + return 0; +} bool wxPalette::GetRGB( int WXUNUSED(pixel), unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue) ) const { - wxFAIL_MSG("not implemented"); - - return 0; -}; + wxFAIL_MSG("not implemented"); + + return 0; +} diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 765f3912be..846ec6c3b2 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -163,7 +163,7 @@ wxSize wxRadioBox::LayoutItems() int max_len = 0; wxNode *node = m_boxes.Nth( j*num_per_major ); - for (int i = 0; i< num_per_major; i++) + for (int i1 = 0; i1< num_per_major; i1++) { GtkWidget *button = GTK_WIDGET( node->Data() ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); @@ -181,7 +181,7 @@ wxSize wxRadioBox::LayoutItems() // we don't know the max_len before node = m_boxes.Nth( j*num_per_major ); - for (int i = 0; i< num_per_major; i++) + for (int i2 = 0; i2< num_per_major; i2++) { GtkWidget *button = GTK_WIDGET( node->Data() ); diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 78511d556f..78eef6efe3 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -30,7 +30,8 @@ #endif #include "unistd.h" -#ifdef __SUN__ +// add more here if you run into problems +#if defined(__SUN__) && !defined(__SunOs_5_6) && !defined(__SunOs_5_7) extern "C" { void usleep(unsigned long usec); diff --git a/src/gtk1/dcscreen.cpp b/src/gtk1/dcscreen.cpp index b7a89b9b83..1d71b4e739 100644 --- a/src/gtk1/dcscreen.cpp +++ b/src/gtk1/dcscreen.cpp @@ -329,7 +329,7 @@ bool wxScreenDC::StartDrawingOnTop( wxRect *rect ) if (sm_overlayWindow) gdk_window_show( sm_overlayWindow ); - return (sm_overlayWindow); + return (sm_overlayWindow != NULL); } bool wxScreenDC::EndDrawingOnTop(void) diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 9e52e23db1..59b5734012 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -108,8 +108,7 @@ wxFont::wxFont( char *xFontName ) M_FONTDATA->m_font = gdk_font_load( xFontName ); } -wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined = FALSE, - const wxString& face = wxEmptyString ) +wxFont::wxFont( int pointSize, int family, int style, int weight, bool underlined, const wxString& face ) { m_refData = new wxFontRefData(); @@ -442,12 +441,14 @@ static GdkFont *wxLoadQueryNearestFont( int point_size, int family, int style, i int max_size = point_size + 20 * (1 + (point_size/180)); int min_size = point_size - 20 * (1 + (point_size/180)); + int i; + /* Search for smaller size (approx.) */ - for (int i=point_size-10; !font && i >= 10 && i >= min_size; i -= 10) + for (i=point_size-10; !font && i >= 10 && i >= min_size; i -= 10) font = wxLoadQueryFont(i, family, style, weight, underlined, facename ); /* Search for larger size (approx.) */ - for (int i=point_size+10; !font && i <= max_size; i += 10) + for (i=point_size+10; !font && i <= max_size; i += 10) font = wxLoadQueryFont( i, family, style, weight, underlined, facename ); /* Try default family */ diff --git a/src/gtk1/palette.cpp b/src/gtk1/palette.cpp index 4cdaef3726..61e16d77ac 100644 --- a/src/gtk1/palette.cpp +++ b/src/gtk1/palette.cpp @@ -33,13 +33,13 @@ class wxPaletteRefData: public wxObjectRefData wxPaletteRefData::wxPaletteRefData() { - m_colormap = (GdkColormap *) NULL; -}; + m_colormap = (GdkColormap *) NULL; +} wxPaletteRefData::~wxPaletteRefData() { - if (m_colormap) gdk_colormap_unref( m_colormap ); -}; + if (m_colormap) gdk_colormap_unref( m_colormap ); +} //----------------------------------------------------------------------------- @@ -49,71 +49,71 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) wxPalette::wxPalette() { -}; +} wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ) { - m_refData = new wxPaletteRefData(); - Create( n, red, green, blue ); -}; + m_refData = new wxPaletteRefData(); + Create( n, red, green, blue ); +} wxPalette::wxPalette( const wxPalette& palette ) { - Ref( palette ); -}; + Ref( palette ); +} wxPalette::~wxPalette() { -}; +} wxPalette& wxPalette::operator = ( const wxPalette& palette ) { - if (*this == palette) return (*this); - Ref( palette ); - return *this; -}; + if (*this == palette) return (*this); + Ref( palette ); + return *this; +} bool wxPalette::operator == ( const wxPalette& palette ) { - return m_refData == palette.m_refData; -}; + return m_refData == palette.m_refData; +} bool wxPalette::operator != ( const wxPalette& palette ) { - return m_refData != palette.m_refData; -}; + return m_refData != palette.m_refData; +} bool wxPalette::Ok(void) const { - return (m_refData); -}; + return (m_refData != NULL); +} bool wxPalette::Create( int WXUNUSED(n), const unsigned char *WXUNUSED(red), const unsigned char *WXUNUSED(green), const unsigned char *WXUNUSED(blue) ) { - wxFAIL_MSG("not implemented"); + wxFAIL_MSG("not implemented"); - return FALSE; -}; + return FALSE; +} int wxPalette::GetPixel( const unsigned char WXUNUSED(red), const unsigned char WXUNUSED(green), const unsigned char WXUNUSED(blue) ) const { - wxFAIL_MSG("not implemented"); + wxFAIL_MSG("not implemented"); - return 0; -}; + return 0; +} bool wxPalette::GetRGB( int WXUNUSED(pixel), unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue) ) const { - wxFAIL_MSG("not implemented"); - - return 0; -}; + wxFAIL_MSG("not implemented"); + + return 0; +} diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 765f3912be..846ec6c3b2 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -163,7 +163,7 @@ wxSize wxRadioBox::LayoutItems() int max_len = 0; wxNode *node = m_boxes.Nth( j*num_per_major ); - for (int i = 0; i< num_per_major; i++) + for (int i1 = 0; i1< num_per_major; i1++) { GtkWidget *button = GTK_WIDGET( node->Data() ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); @@ -181,7 +181,7 @@ wxSize wxRadioBox::LayoutItems() // we don't know the max_len before node = m_boxes.Nth( j*num_per_major ); - for (int i = 0; i< num_per_major; i++) + for (int i2 = 0; i2< num_per_major; i2++) { GtkWidget *button = GTK_WIDGET( node->Data() ); -- 2.45.2