minor cleanup: corrected typos, etc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,9 +57,9 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
style |= wxTAB_TRAVERSAL;
|
style |= wxTAB_TRAVERSAL;
|
||||||
|
|
||||||
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style & ~(wxYES|wxOK|wxNO /*|wxCANCEL*/) , name) )
|
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style & ~(wxYES|wxOK|wxNO /*|wxCANCEL*/) , name) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDialog::SetModal(bool flag)
|
void wxDialog::SetModal(bool flag)
|
||||||
@@ -83,8 +83,8 @@ void wxDialog::SetModal(bool flag)
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = true;
|
||||||
Show(FALSE);
|
Show(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// By default, pressing escape cancels the dialog; on mac command-stop does the same thing
|
// By default, pressing escape cancels the dialog; on mac command-stop does the same thing
|
||||||
@@ -123,7 +123,7 @@ bool wxDialog::Show(bool show)
|
|||||||
if ( !wxDialogBase::Show(show) )
|
if ( !wxDialogBase::Show(show) )
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( show )
|
if ( show )
|
||||||
@@ -140,13 +140,13 @@ bool wxDialog::Show(bool show)
|
|||||||
}
|
}
|
||||||
else // end of modal dialog
|
else // end of modal dialog
|
||||||
{
|
{
|
||||||
// this will cause IsModalShowing() return FALSE and our local
|
// this will cause IsModalShowing() return false and our local
|
||||||
// message loop will terminate
|
// message loop will terminate
|
||||||
wxModalDialogs.DeleteObject(this);
|
wxModalDialogs.DeleteObject(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
@@ -183,15 +183,13 @@ void wxDialog::DoShowModal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
// Replacement for Show(true) for modal dialogs - returns return code
|
||||||
int wxDialog::ShowModal()
|
int wxDialog::ShowModal()
|
||||||
{
|
{
|
||||||
if ( !m_isModalStyle )
|
if ( !m_isModalStyle )
|
||||||
{
|
SetModal(true);
|
||||||
SetModal(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Show(TRUE);
|
Show(true);
|
||||||
return GetReturnCode();
|
return GetReturnCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +198,7 @@ int wxDialog::ShowModal()
|
|||||||
void wxDialog::EndModal(int retCode)
|
void wxDialog::EndModal(int retCode)
|
||||||
{
|
{
|
||||||
SetReturnCode(retCode);
|
SetReturnCode(retCode);
|
||||||
Show(FALSE);
|
Show(false);
|
||||||
SetModal(false);
|
SetModal(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,15 +206,14 @@ void wxDialog::EndModal(int retCode)
|
|||||||
void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if ( Validate() && TransferDataFromWindow() )
|
if ( Validate() && TransferDataFromWindow() )
|
||||||
{
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (Validate())
|
if (Validate())
|
||||||
TransferDataFromWindow();
|
TransferDataFromWindow();
|
||||||
|
|
||||||
// TODO probably need to disable the Apply button until things change again
|
// TODO probably need to disable the Apply button until things change again
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ void wxMacCarbonPrintData::TransferFrom( wxPageSetupData *data )
|
|||||||
|
|
||||||
void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
|
void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
|
||||||
{
|
{
|
||||||
PMRect rPaper;
|
PMRect rPaper;
|
||||||
OSStatus err = PMGetUnadjustedPaperRect(m_macPageFormat, &rPaper);
|
OSStatus err = PMGetUnadjustedPaperRect(m_macPageFormat, &rPaper);
|
||||||
if ( err == noErr )
|
if ( err == noErr )
|
||||||
{
|
{
|
||||||
@@ -230,7 +230,7 @@ void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
|
|||||||
(int)(((double) rPage.left - rPaper.left ) * pt2mm) ,
|
(int)(((double) rPage.left - rPaper.left ) * pt2mm) ,
|
||||||
(int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
|
(int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
|
||||||
|
|
||||||
data->SetMinMarginBottomRight( wxPoint (
|
data->SetMinMarginBottomRight( wxPoint (
|
||||||
(wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
|
(wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
|
||||||
(wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
|
(wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
|
||||||
|
|
||||||
@@ -248,7 +248,6 @@ void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
|
|||||||
if ( data->GetMarginBottomRight().y < data->GetMinMarginBottomRight().y )
|
if ( data->GetMarginBottomRight().y < data->GetMinMarginBottomRight().y )
|
||||||
data->SetMarginBottomRight( wxPoint( data->GetMarginBottomRight().x ,
|
data->SetMarginBottomRight( wxPoint( data->GetMarginBottomRight().x ,
|
||||||
data->GetMinMarginBottomRight().y) );
|
data->GetMinMarginBottomRight().y) );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,13 +286,9 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintDialogData* data )
|
|||||||
PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
|
PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
|
||||||
|
|
||||||
if (data->GetAllPages() || data->GetFromPage() == 0)
|
if (data->GetAllPages() || data->GetFromPage() == 0)
|
||||||
{
|
PMSetLastPage( m_macPrintSettings , (UInt32) kPMPrintAllPages, true ) ;
|
||||||
PMSetLastPage( m_macPrintSettings , (UInt32) kPMPrintAllPages, true ) ;
|
else
|
||||||
}
|
PMSetLastPage( m_macPrintSettings , (UInt32) data->GetToPage() , false ) ;
|
||||||
else
|
|
||||||
{
|
|
||||||
PMSetLastPage( m_macPrintSettings , (UInt32) data->GetToPage() , false ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -311,13 +306,13 @@ wxMacPrinter::~wxMacPrinter(void)
|
|||||||
|
|
||||||
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||||
{
|
{
|
||||||
sm_abortIt = FALSE;
|
sm_abortIt = false;
|
||||||
sm_abortWindow = NULL;
|
sm_abortWindow = NULL;
|
||||||
|
|
||||||
if (!printout)
|
if (!printout)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
printout->SetIsPreview(FALSE);
|
printout->SetIsPreview(false);
|
||||||
if (m_printDialogData.GetMinPage() < 1)
|
if (m_printDialogData.GetMinPage() < 1)
|
||||||
m_printDialogData.SetMinPage(1);
|
m_printDialogData.SetMinPage(1);
|
||||||
if (m_printDialogData.GetMaxPage() < 1)
|
if (m_printDialogData.GetMaxPage() < 1)
|
||||||
@@ -339,16 +334,15 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
|
dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// May have pressed cancel.
|
// May have pressed cancel.
|
||||||
if (!dc || !dc->Ok())
|
if (!dc || !dc->Ok())
|
||||||
{
|
{
|
||||||
if (dc) delete dc;
|
if (dc)
|
||||||
return FALSE;
|
delete dc;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// on the mac we have always pixels as addressing mode with 72 dpi
|
// on the mac we have always pixels as addressing mode with 72 dpi
|
||||||
|
|
||||||
printout->SetPPIScreen(72, 72);
|
printout->SetPPIScreen(72, 72);
|
||||||
PMResolution res;
|
PMResolution res;
|
||||||
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
|
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
|
||||||
@@ -379,7 +373,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
if (maxPage == 0)
|
if (maxPage == 0)
|
||||||
{
|
{
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only set min and max, because from and to have been
|
// Only set min and max, because from and to have been
|
||||||
@@ -395,15 +389,17 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
|
wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
|
||||||
delete dc;
|
delete dc;
|
||||||
return FALSE;
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm_abortWindow = win;
|
sm_abortWindow = win;
|
||||||
sm_abortWindow->Show(TRUE);
|
sm_abortWindow->Show(true);
|
||||||
wxSafeYield(win,true);
|
wxSafeYield(win,true);
|
||||||
|
|
||||||
printout->OnBeginPrinting();
|
printout->OnBeginPrinting();
|
||||||
|
|
||||||
bool keepGoing = TRUE;
|
bool keepGoing = true;
|
||||||
|
|
||||||
int copyCount;
|
int copyCount;
|
||||||
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
|
||||||
@@ -418,12 +414,13 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
int pn;
|
int pn;
|
||||||
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
for (pn = m_printDialogData.GetFromPage();
|
||||||
|
keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
|
||||||
pn++)
|
pn++)
|
||||||
{
|
{
|
||||||
if (sm_abortIt)
|
if (sm_abortIt)
|
||||||
{
|
{
|
||||||
keepGoing = FALSE;
|
keepGoing = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -449,7 +446,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
|
|
||||||
if (sm_abortWindow)
|
if (sm_abortWindow)
|
||||||
{
|
{
|
||||||
sm_abortWindow->Show(FALSE);
|
sm_abortWindow->Show(false);
|
||||||
delete sm_abortWindow;
|
delete sm_abortWindow;
|
||||||
sm_abortWindow = NULL;
|
sm_abortWindow = NULL;
|
||||||
}
|
}
|
||||||
@@ -458,7 +455,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
|
|
||||||
delete dc;
|
delete dc;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
|
wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
|
||||||
@@ -481,17 +478,16 @@ bool wxMacPrinter::Setup(wxWindow *parent)
|
|||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
wxPrintDialog dialog(parent, & m_printDialogData);
|
wxPrintDialog dialog(parent, & m_printDialogData);
|
||||||
dialog.GetPrintDialogData().SetSetupDialog(TRUE);
|
dialog.GetPrintDialogData().SetSetupDialog(true);
|
||||||
|
|
||||||
int ret = dialog.ShowModal();
|
int ret = dialog.ShowModal();
|
||||||
|
|
||||||
if (ret == wxID_OK)
|
if (ret == wxID_OK)
|
||||||
{
|
|
||||||
m_printDialogData = dialog.GetPrintDialogData();
|
m_printDialogData = dialog.GetPrintDialogData();
|
||||||
}
|
|
||||||
|
|
||||||
return (ret == wxID_OK);
|
return (ret == wxID_OK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,7 +516,8 @@ wxMacPrintPreview::~wxMacPrintPreview(void)
|
|||||||
bool wxMacPrintPreview::Print(bool interactive)
|
bool wxMacPrintPreview::Print(bool interactive)
|
||||||
{
|
{
|
||||||
if (!m_printPrintout)
|
if (!m_printPrintout)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
wxMacPrinter printer(&m_printDialogData);
|
wxMacPrinter printer(&m_printDialogData);
|
||||||
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
return printer.Print(m_previewFrame, m_printPrintout, interactive);
|
||||||
}
|
}
|
||||||
@@ -556,6 +553,7 @@ void wxMacPrintPreview::DetermineScaling(void)
|
|||||||
{
|
{
|
||||||
m_isOk = false ;
|
m_isOk = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// At 100%, the page should look about page-size on the screen.
|
// At 100%, the page should look about page-size on the screen.
|
||||||
// m_previewScale = (float)((float)screenWidth/(float)printerWidth);
|
// m_previewScale = (float)((float)screenWidth/(float)printerWidth);
|
||||||
// m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
|
// m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__VISAGECPP__)
|
#if defined(__VISAGECPP__)
|
||||||
#define BSD_SELECT /* use Berkley Sockets select */
|
#define BSD_SELECT /* use Berkeley Sockets select */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
|
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
|
||||||
@@ -613,6 +613,7 @@ GSocket *GSocket::WaitConnection()
|
|||||||
m_error = GSOCK_MEMERR;
|
m_error = GSOCK_MEMERR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = _GAddress_translate_from(connection->m_peer, &from, fromlen);
|
err = _GAddress_translate_from(connection->m_peer, &from, fromlen);
|
||||||
if (err != GSOCK_NOERROR)
|
if (err != GSOCK_NOERROR)
|
||||||
{
|
{
|
||||||
@@ -620,6 +621,7 @@ GSocket *GSocket::WaitConnection()
|
|||||||
m_error = err;
|
m_error = err;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__EMX__) || defined(__VISAGECPP__)
|
#if defined(__EMX__) || defined(__VISAGECPP__)
|
||||||
ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
|
ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
|
||||||
#else
|
#else
|
||||||
@@ -633,10 +635,13 @@ GSocket *GSocket::WaitConnection()
|
|||||||
bool GSocket::SetReusable()
|
bool GSocket::SetReusable()
|
||||||
{
|
{
|
||||||
/* socket must not be null, and must not be in use/already bound */
|
/* socket must not be null, and must not be in use/already bound */
|
||||||
if (this && m_fd == INVALID_SOCKET) {
|
if (this && m_fd == INVALID_SOCKET)
|
||||||
|
{
|
||||||
m_reusable = true;
|
m_reusable = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,9 +730,7 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (m_non_blocking || ret == 0)
|
if (m_non_blocking || ret == 0)
|
||||||
{
|
|
||||||
gs_gui_functions->Enable_Events(this);
|
gs_gui_functions->Enable_Events(this);
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
@@ -778,6 +781,7 @@ GSocketError GSocket::Connect(GSocketStream stream)
|
|||||||
*/
|
*/
|
||||||
Close();
|
Close();
|
||||||
m_error = GSOCK_IOERR;
|
m_error = GSOCK_IOERR;
|
||||||
|
|
||||||
return GSOCK_IOERR;
|
return GSOCK_IOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,7 +879,8 @@ int GSocket::Read(char *buffer, int size)
|
|||||||
* re-enabled! */
|
* re-enabled! */
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
/* Read the data */
|
/* Read the data */
|
||||||
if (m_stream)
|
if (m_stream)
|
||||||
ret = Recv_Stream(buffer, size);
|
ret = Recv_Stream(buffer, size);
|
||||||
@@ -888,7 +893,8 @@ int GSocket::Read(char *buffer, int size)
|
|||||||
*/
|
*/
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
m_error = GSOCK_IOERR;
|
m_error = GSOCK_IOERR;
|
||||||
else if (ret == -1) {
|
else if (ret == -1)
|
||||||
|
{
|
||||||
if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
|
if ((errno == EWOULDBLOCK) || (errno == EAGAIN))
|
||||||
m_error = GSOCK_WOULDBLOCK;
|
m_error = GSOCK_WOULDBLOCK;
|
||||||
else
|
else
|
||||||
@@ -951,6 +957,7 @@ int GSocket::Write(const char *buffer, int size)
|
|||||||
* will further OUTPUT events be posted.
|
* will further OUTPUT events be posted.
|
||||||
*/
|
*/
|
||||||
Enable(GSOCK_OUTPUT);
|
Enable(GSOCK_OUTPUT);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1094,10 +1101,8 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
assert(this);
|
assert(this);
|
||||||
return flags & m_detected;
|
return flags & m_detected;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1210,9 +1215,8 @@ GSocketError GSocket::GetSockOpt(int level, int optname,
|
|||||||
void *optval, int *optlen)
|
void *optval, int *optlen)
|
||||||
{
|
{
|
||||||
if (getsockopt(m_fd, level, optname, (char*)optval, (SOCKOPTLEN_T*)optlen) == 0)
|
if (getsockopt(m_fd, level, optname, (char*)optval, (SOCKOPTLEN_T*)optlen) == 0)
|
||||||
{
|
|
||||||
return GSOCK_NOERROR;
|
return GSOCK_NOERROR;
|
||||||
}
|
|
||||||
return GSOCK_OPTERR;
|
return GSOCK_OPTERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,9 +1224,8 @@ GSocketError GSocket::SetSockOpt(int level, int optname,
|
|||||||
const void *optval, int optlen)
|
const void *optval, int optlen)
|
||||||
{
|
{
|
||||||
if (setsockopt(m_fd, level, optname, (const char*)optval, optlen) == 0)
|
if (setsockopt(m_fd, level, optname, (const char*)optval, optlen) == 0)
|
||||||
{
|
|
||||||
return GSOCK_NOERROR;
|
return GSOCK_NOERROR;
|
||||||
}
|
|
||||||
return GSOCK_OPTERR;
|
return GSOCK_OPTERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1270,6 +1273,7 @@ GSocketError GSocket::Input_Timeout()
|
|||||||
m_error = GSOCK_TIMEDOUT;
|
m_error = GSOCK_TIMEDOUT;
|
||||||
return GSOCK_TIMEDOUT;
|
return GSOCK_TIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
GSocket_Debug(( "GSocket_Input_Timeout, select returned -1\n" ));
|
GSocket_Debug(( "GSocket_Input_Timeout, select returned -1\n" ));
|
||||||
@@ -1281,6 +1285,7 @@ GSocketError GSocket::Input_Timeout()
|
|||||||
return GSOCK_TIMEDOUT;
|
return GSOCK_TIMEDOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GSOCK_NOERROR;
|
return GSOCK_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,6 +1316,7 @@ GSocketError GSocket::Output_Timeout()
|
|||||||
m_error = GSOCK_TIMEDOUT;
|
m_error = GSOCK_TIMEDOUT;
|
||||||
return GSOCK_TIMEDOUT;
|
return GSOCK_TIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
GSocket_Debug(( "GSocket_Output_Timeout, select returned -1\n" ));
|
GSocket_Debug(( "GSocket_Output_Timeout, select returned -1\n" ));
|
||||||
@@ -1321,10 +1327,13 @@ GSocketError GSocket::Output_Timeout()
|
|||||||
m_error = GSOCK_TIMEDOUT;
|
m_error = GSOCK_TIMEDOUT;
|
||||||
return GSOCK_TIMEDOUT;
|
return GSOCK_TIMEDOUT;
|
||||||
}
|
}
|
||||||
if ( ! wxFD_ISSET(m_fd, &writefds) ) {
|
|
||||||
|
if ( ! wxFD_ISSET(m_fd, &writefds) )
|
||||||
|
{
|
||||||
GSocket_Debug(( "GSocket_Output_Timeout is buggy!\n" ));
|
GSocket_Debug(( "GSocket_Output_Timeout is buggy!\n" ));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
GSocket_Debug(( "GSocket_Output_Timeout seems correct\n" ));
|
GSocket_Debug(( "GSocket_Output_Timeout seems correct\n" ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1342,7 +1351,9 @@ int GSocket::Recv_Stream(char *buffer, int size)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = recv(m_fd, buffer, size, GSOCKET_MSG_NOSIGNAL);
|
ret = recv(m_fd, buffer, size, GSOCKET_MSG_NOSIGNAL);
|
||||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
}
|
||||||
|
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,7 +1369,8 @@ int GSocket::Recv_Dgram(char *buffer, int size)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = recvfrom(m_fd, buffer, size, 0, &from, (WX_SOCKLEN_T *) &fromlen);
|
ret = recvfrom(m_fd, buffer, size, 0, &from, (WX_SOCKLEN_T *) &fromlen);
|
||||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
}
|
||||||
|
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1373,6 +1385,7 @@ int GSocket::Recv_Dgram(char *buffer, int size)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = _GAddress_translate_from(m_peer, &from, fromlen);
|
err = _GAddress_translate_from(m_peer, &from, fromlen);
|
||||||
if (err != GSOCK_NOERROR)
|
if (err != GSOCK_NOERROR)
|
||||||
{
|
{
|
||||||
@@ -1394,7 +1407,8 @@ int GSocket::Send_Stream(const char *buffer, int size)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = send(m_fd, (char *)buffer, size, GSOCKET_MSG_NOSIGNAL);
|
ret = send(m_fd, (char *)buffer, size, GSOCKET_MSG_NOSIGNAL);
|
||||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
}
|
||||||
|
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||||
|
|
||||||
UNMASK_SIGNAL();
|
UNMASK_SIGNAL();
|
||||||
|
|
||||||
@@ -1425,7 +1439,8 @@ int GSocket::Send_Dgram(const char *buffer, int size)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = sendto(m_fd, (char *)buffer, size, 0, addr, len);
|
ret = sendto(m_fd, (char *)buffer, size, 0, addr, len);
|
||||||
} while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
}
|
||||||
|
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
|
||||||
|
|
||||||
UNMASK_SIGNAL();
|
UNMASK_SIGNAL();
|
||||||
|
|
||||||
@@ -1533,9 +1548,11 @@ void GSocket::Detected_Write()
|
|||||||
GSocket *GSocket_new(void)
|
GSocket *GSocket_new(void)
|
||||||
{
|
{
|
||||||
GSocket *newsocket = new GSocket();
|
GSocket *newsocket = new GSocket();
|
||||||
if(newsocket->IsOk())
|
if (newsocket->IsOk())
|
||||||
return newsocket;
|
return newsocket;
|
||||||
|
|
||||||
delete newsocket;
|
delete newsocket;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1675,6 +1692,7 @@ GSocketError _GAddress_translate_from(GAddress *address,
|
|||||||
address->m_error = GSOCK_MEMERR;
|
address->m_error = GSOCK_MEMERR;
|
||||||
return GSOCK_MEMERR;
|
return GSOCK_MEMERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(address->m_addr, addr, len);
|
memcpy(address->m_addr, addr, len);
|
||||||
|
|
||||||
return GSOCK_NOERROR;
|
return GSOCK_NOERROR;
|
||||||
@@ -1761,9 +1779,11 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname)
|
|||||||
address->m_error = GSOCK_NOHOST;
|
address->m_error = GSOCK_NOHOST;
|
||||||
return GSOCK_NOHOST;
|
return GSOCK_NOHOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
array_addr = (struct in_addr *) *(he->h_addr_list);
|
array_addr = (struct in_addr *) *(he->h_addr_list);
|
||||||
addr->s_addr = array_addr[0].s_addr;
|
addr->s_addr = array_addr[0].s_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GSOCK_NOERROR;
|
return GSOCK_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user