Warning fix.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34316 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-05-24 10:10:40 +00:00
parent 7c8b87a78a
commit 15575028ea

View File

@@ -82,16 +82,16 @@ public:
~wxDialUpManagerImpl(); ~wxDialUpManagerImpl();
/** Could the dialup manager be initialized correctly? If this function /** Could the dialup manager be initialized correctly? If this function
returns FALSE, no other functions will work neither, so it's a good idea returns false, no other functions will work neither, so it's a good idea
to call this function and check its result before calling any other to call this function and check its result before calling any other
wxDialUpManager methods. wxDialUpManager methods.
*/ */
virtual bool IsOk() const virtual bool IsOk() const
{ return TRUE; } { return true; }
/** The simplest way to initiate a dial up: this function dials the given /** The simplest way to initiate a dial up: this function dials the given
ISP (exact meaning of the parameter depends on the platform), returns ISP (exact meaning of the parameter depends on the platform), returns
TRUE on success or FALSE on failure and logs the appropriate error true on success or false on failure and logs the appropriate error
message in the latter case. message in the latter case.
@param nameOfISP optional paramater for dial program @param nameOfISP optional paramater for dial program
@param username unused @param username unused
@@ -105,7 +105,7 @@ public:
// Hang up the currently active dial up connection. // Hang up the currently active dial up connection.
virtual bool HangUp(); virtual bool HangUp();
// returns TRUE if the computer is connected to the network: under Windows, // returns true if the computer is connected to the network: under Windows,
// this just means that a RAS connection exists, under Unix we check that // this just means that a RAS connection exists, under Unix we check that
// the "well-known host" (as specified by SetWellKnownHost) is reachable // the "well-known host" (as specified by SetWellKnownHost) is reachable
virtual bool IsOnline() const virtual bool IsOnline() const
@@ -117,11 +117,11 @@ public:
// do we have a constant net connection? // do we have a constant net connection?
virtual bool IsAlwaysOnline() const; virtual bool IsAlwaysOnline() const;
// returns TRUE if (async) dialing is in progress // returns true if (async) dialing is in progress
virtual bool IsDialing() const virtual bool IsDialing() const
{ return m_DialProcess != NULL; } { return m_DialProcess != NULL; }
// cancel dialing the number initiated with Dial(async = TRUE) // cancel dialing the number initiated with Dial(async = true)
// NB: this won't result in DISCONNECTED event being sent // NB: this won't result in DISCONNECTED event being sent
virtual bool CancelDialing(); virtual bool CancelDialing();
@@ -132,7 +132,7 @@ public:
// so, in general, the user should be allowed to override it. This function // so, in general, the user should be allowed to override it. This function
// allows to forcefully set the online status - whatever our internal // allows to forcefully set the online status - whatever our internal
// algorithm may think about it. // algorithm may think about it.
virtual void SetOnlineStatus(bool isOnline = TRUE) virtual void SetOnlineStatus(bool isOnline = true)
{ m_IsOnline = isOnline ? Net_Connected : Net_No; } { m_IsOnline = isOnline ? Net_Connected : Net_No; }
// set misc wxDialUpManager options // set misc wxDialUpManager options
@@ -144,7 +144,7 @@ public:
// Windows, the notification about the change of connection status is // Windows, the notification about the change of connection status is
// instantenous. // instantenous.
// //
// Returns FALSE if couldn't set up automatic check for online status. // Returns false if couldn't set up automatic check for online status.
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds); virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds);
// disable automatic check for connection status change - notice that the // disable automatic check for connection status change - notice that the
@@ -222,7 +222,7 @@ private:
friend class wxDialProcess; friend class wxDialProcess;
// determine status // determine status
void CheckStatus(bool fromAsync = FALSE) const; void CheckStatus(bool fromAsync = false) const;
// real status check // real status check
void CheckStatusInternal(); void CheckStatusInternal();
@@ -278,7 +278,7 @@ public:
if(m_DupMan) if(m_DupMan)
{ {
m_DupMan->m_DialProcess = NULL; m_DupMan->m_DialProcess = NULL;
m_DupMan->CheckStatus(TRUE); m_DupMan->CheckStatus(true);
} }
} }
private: private:
@@ -327,54 +327,54 @@ wxDialUpManagerImpl::Dial(const wxString &isp,
const wxString & WXUNUSED(password), const wxString & WXUNUSED(password),
bool async) bool async)
{ {
if(m_IsOnline == Net_Connected) if(m_IsOnline == Net_Connected)
return FALSE; return false;
m_ISPname = isp; m_ISPname = isp;
wxString cmd; wxString cmd;
if(m_ConnectCommand.Find(wxT("%s"))) if(m_ConnectCommand.Find(wxT("%s")))
cmd.Printf(m_ConnectCommand,m_ISPname.c_str()); cmd.Printf(m_ConnectCommand,m_ISPname.c_str());
else else
cmd = m_ConnectCommand; cmd = m_ConnectCommand;
if ( async ) if ( async )
{ {
m_DialProcess = new wxDialProcess(this); m_DialProcess = new wxDialProcess(this);
m_DialPId = (int)wxExecute(cmd, FALSE, m_DialProcess); m_DialPId = (int)wxExecute(cmd, false, m_DialProcess);
if(m_DialPId == 0) if(m_DialPId == 0)
{ {
delete m_DialProcess; delete m_DialProcess;
m_DialProcess = NULL; m_DialProcess = NULL;
return FALSE; return false;
} }
else else
return TRUE; return true;
} }
else else
return wxExecute(cmd, /* sync */ TRUE) == 0; return wxExecute(cmd, /* sync */ true) == 0;
} }
bool wxDialUpManagerImpl::HangUp() bool wxDialUpManagerImpl::HangUp()
{ {
if(m_IsOnline == Net_No) if(m_IsOnline == Net_No)
return FALSE; return false;
if(IsDialing()) if(IsDialing())
{ {
wxLogError(_("Already dialling ISP.")); wxLogError(_("Already dialling ISP."));
return FALSE; return false;
} }
wxString cmd; wxString cmd;
if(m_HangUpCommand.Find(wxT("%s"))) if(m_HangUpCommand.Find(wxT("%s")))
cmd.Printf(m_HangUpCommand,m_ISPname.c_str(), m_DialProcess); cmd.Printf(m_HangUpCommand,m_ISPname.c_str(), m_DialProcess);
else else
cmd = m_HangUpCommand; cmd = m_HangUpCommand;
return wxExecute(cmd, /* sync */ TRUE) == 0; return wxExecute(cmd, /* sync */ true) == 0;
} }
bool wxDialUpManagerImpl::CancelDialing() bool wxDialUpManagerImpl::CancelDialing()
{ {
if(! IsDialing()) if(! IsDialing())
return FALSE; return false;
return kill(m_DialPId, SIGTERM) > 0; return kill(m_DialPId, SIGTERM) > 0;
} }
@@ -640,10 +640,10 @@ int
wxDialUpManagerImpl::CheckIfconfig() wxDialUpManagerImpl::CheckIfconfig()
{ {
#ifdef __VMS #ifdef __VMS
m_CanUseIfconfig = 0; m_CanUseIfconfig = 0;
return -1; return -1;
#else #else
// assume that the test doesn't work // assume that the test doesn't work
int netDevice = NetDevice_Unknown; int netDevice = NetDevice_Unknown;
// first time check for ifconfig location // first time check for ifconfig location
@@ -691,8 +691,13 @@ wxDialUpManagerImpl::CheckIfconfig()
// VZ: a wild guess (but without it, ifconfig fails completely) // VZ: a wild guess (but without it, ifconfig fails completely)
cmd << wxT(" ppp0"); cmd << wxT(" ppp0");
#else #else
# pragma warning "No ifconfig information for this OS." #if defined(__GNUG__)
m_CanUseIfconfig = 0; #warning "No ifconfig information for this OS."
#else
#pragma warning "No ifconfig information for this OS."
#endif
m_CanUseIfconfig = 0;
return -1; return -1;
#endif #endif
cmd << wxT(" >") << tmpfile << wxT('\''); cmd << wxT(" >") << tmpfile << wxT('\'');
@@ -700,7 +705,7 @@ wxDialUpManagerImpl::CheckIfconfig()
so we could let ifconfig write directly to the tmpfile, but so we could let ifconfig write directly to the tmpfile, but
this does not work. That should be faster, as it doesn<73>t call this does not work. That should be faster, as it doesn<73>t call
the shell first. I have no idea why. :-( (KB) */ the shell first. I have no idea why. :-( (KB) */
if ( wxExecute(cmd,TRUE /* sync */) == 0 ) if ( wxExecute(cmd,true /* sync */) == 0 )
{ {
m_CanUseIfconfig = 1; m_CanUseIfconfig = 1;
wxFFile file; wxFFile file;
@@ -711,8 +716,8 @@ wxDialUpManagerImpl::CheckIfconfig()
{ {
// FIXME shouldn't we grep for "^ppp"? (VZ) // FIXME shouldn't we grep for "^ppp"? (VZ)
bool hasModem = FALSE, bool hasModem = false,
hasLAN = FALSE; hasLAN = false;
#if defined(__SOLARIS__) || defined (__SUNOS__) #if defined(__SOLARIS__) || defined (__SUNOS__)
// dialup device under SunOS/Solaris // dialup device under SunOS/Solaris
@@ -727,7 +732,7 @@ wxDialUpManagerImpl::CheckIfconfig()
hasModem = strstr(output, "ppp") != NULL; // PPP hasModem = strstr(output, "ppp") != NULL; // PPP
#elif defined(__HPUX__) #elif defined(__HPUX__)
// if could run ifconfig on interface, then it exists // if could run ifconfig on interface, then it exists
hasModem = TRUE; hasModem = true;
#endif #endif
netDevice = NetDevice_None; netDevice = NetDevice_None;
@@ -779,26 +784,31 @@ wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckPing()
return Net_Unknown; return Net_Unknown;
} }
wxLogNull ln; // suppress all error messages wxLogNull ln; // suppress all error messages
wxASSERT(m_PingPath.length()); wxASSERT(m_PingPath.length());
wxString cmd; wxString cmd;
cmd << m_PingPath << wxT(' '); cmd << m_PingPath << wxT(' ');
#if defined(__SOLARIS__) || defined (__SUNOS__) #if defined(__SOLARIS__) || defined (__SUNOS__)
// nothing to add to ping command // nothing to add to ping command
#elif defined(__LINUX__) || defined (__BSD__) || defined( __VMS ) #elif defined(__LINUX__) || defined (__BSD__) || defined( __VMS )
cmd << wxT("-c 1 "); // only ping once cmd << wxT("-c 1 "); // only ping once
#elif defined(__HPUX__) #elif defined(__HPUX__)
cmd << wxT("64 1 "); // only ping once (need also specify the packet size) cmd << wxT("64 1 "); // only ping once (need also specify the packet size)
#else #else
# pragma warning "No Ping information for this OS." #if defined(__GNUG__)
m_CanUsePing = 0; #warning "No Ping information for this OS."
return Net_Unknown; #else
#pragma warning "No Ping information for this OS."
#endif
m_CanUsePing = 0;
return Net_Unknown;
#endif #endif
cmd << m_BeaconHost; cmd << m_BeaconHost;
if(wxExecute(cmd, TRUE /* sync */) == 0) if(wxExecute(cmd, true /* sync */) == 0)
return Net_Connected; return Net_Connected;
else else
return Net_No; return Net_No;
} }
/* static */ /* static */