Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
b2dd844489
4 changed files with 802 additions and 802 deletions
  1. +2
    -2
      src/juce_appframework/audio/devices/juce_AudioIODevice.h
  2. +17
    -17
      src/juce_core/io/network/juce_Socket.cpp
  3. +13
    -13
      src/juce_core/io/network/juce_Socket.h
  4. +770
    -770
      src/juce_core/text/juce_CharacterFunctions.cpp

+ 2
- 2
src/juce_appframework/audio/devices/juce_AudioIODevice.h View File

@@ -149,12 +149,12 @@ public:
const String& getTypeName() const throw() { return typeName; } const String& getTypeName() const throw() { return typeName; }
//============================================================================== //==============================================================================
/** Returns the names of all the available output channels on this device.
/** Returns the names of all the available output channels on this device.
To find out which of these are currently in use, call getActiveOutputChannels(). To find out which of these are currently in use, call getActiveOutputChannels().
*/ */
virtual const StringArray getOutputChannelNames() = 0; virtual const StringArray getOutputChannelNames() = 0;
/** Returns the names of all the available input channels on this device.
/** Returns the names of all the available input channels on this device.
To find out which of these are currently in use, call getActiveInputChannels(). To find out which of these are currently in use, call getActiveInputChannels().
*/ */
virtual const StringArray getInputChannelNames() = 0; virtual const StringArray getInputChannelNames() = 0;


+ 17
- 17
src/juce_core/io/network/juce_Socket.cpp View File

@@ -114,8 +114,8 @@ static bool bindSocketToPort (const int handle, const int port) throw()
return bind (handle, (struct sockaddr*) &servTmpAddr, sizeof (struct sockaddr_in)) >= 0; return bind (handle, (struct sockaddr*) &servTmpAddr, sizeof (struct sockaddr_in)) >= 0;
} }
static int readSocket (const int handle,
void* const destBuffer, const int maxBytesToRead,
static int readSocket (const int handle,
void* const destBuffer, const int maxBytesToRead,
bool volatile& connected) throw() bool volatile& connected) throw()
{ {
int bytesRead = 0; int bytesRead = 0;
@@ -148,7 +148,7 @@ static int readSocket (const int handle,
return bytesRead; return bytesRead;
} }
static int waitForReadiness (const int handle, const bool forReading,
static int waitForReadiness (const int handle, const bool forReading,
const int timeoutMsecs) throw() const int timeoutMsecs) throw()
{ {
struct timeval timeout; struct timeval timeout;
@@ -209,7 +209,7 @@ static bool setSocketBlockingState (const int handle, const bool shouldBlock) th
return false; return false;
if (shouldBlock) if (shouldBlock)
socketFlags &= ~O_NONBLOCK;
socketFlags &= ~O_NONBLOCK;
else else
socketFlags |= O_NONBLOCK; socketFlags |= O_NONBLOCK;
@@ -265,14 +265,14 @@ static bool connectSocket (int volatile& handle,
#if JUCE_WIN32 #if JUCE_WIN32
if (result == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK) if (result == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK)
#else #else
if (result == EINPROGRESS)
if (result == EINPROGRESS)
#endif #endif
{ {
if (waitForReadiness (handle, false, timeOutMillisecs) != 1) if (waitForReadiness (handle, false, timeOutMillisecs) != 1)
return false; return false;
} }
} }
setSocketBlockingState (handle, true); setSocketBlockingState (handle, true);
resetSocketOptions (handle, false); resetSocketOptions (handle, false);
@@ -291,8 +291,8 @@ StreamingSocket::StreamingSocket()
#endif #endif
} }
StreamingSocket::StreamingSocket (const String& hostName_,
const int portNumber_,
StreamingSocket::StreamingSocket (const String& hostName_,
const int portNumber_,
const int handle_) const int handle_)
: hostName (hostName_), : hostName (hostName_),
portNumber (portNumber_), portNumber (portNumber_),
@@ -339,7 +339,7 @@ int StreamingSocket::write (const void* sourceBuffer, const int numBytesToWrite)
} }
//============================================================================== //==============================================================================
int StreamingSocket::waitUntilReady (const bool readyForReading,
int StreamingSocket::waitUntilReady (const bool readyForReading,
const int timeoutMsecs) const const int timeoutMsecs) const
{ {
return connected ? waitForReadiness (handle, readyForReading, timeoutMsecs) return connected ? waitForReadiness (handle, readyForReading, timeoutMsecs)
@@ -488,7 +488,7 @@ DatagramSocket::DatagramSocket (const int localPortNumber)
bindToPort (localPortNumber); bindToPort (localPortNumber);
} }
DatagramSocket::DatagramSocket (const String& hostName_, const int portNumber_,
DatagramSocket::DatagramSocket (const String& hostName_, const int portNumber_,
const int handle_, const int localPortNumber) const int handle_, const int localPortNumber)
: hostName (hostName_), : hostName (hostName_),
portNumber (portNumber_), portNumber (portNumber_),
@@ -542,7 +542,7 @@ bool DatagramSocket::connect (const String& remoteHostName,
hostName = remoteHostName; hostName = remoteHostName;
portNumber = remotePortNumber; portNumber = remotePortNumber;
connected = connectSocket (handle, true, &serverAddress,
connected = connectSocket (handle, true, &serverAddress,
remoteHostName, remotePortNumber, remoteHostName, remotePortNumber,
timeOutMillisecs); timeOutMillisecs);
@@ -571,7 +571,7 @@ DatagramSocket* DatagramSocket::waitForNextConnection() const
if (recvfrom (handle, buf, 0, 0, &address, &len) > 0) if (recvfrom (handle, buf, 0, 0, &address, &len) > 0)
{ {
return new DatagramSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr),
return new DatagramSocket (inet_ntoa (((struct sockaddr_in*) &address)->sin_addr),
ntohs (((struct sockaddr_in*) &address)->sin_port), ntohs (((struct sockaddr_in*) &address)->sin_port),
-1, -1); -1, -1);
} }
@@ -581,7 +581,7 @@ DatagramSocket* DatagramSocket::waitForNextConnection() const
} }
//============================================================================== //==============================================================================
int DatagramSocket::waitUntilReady (const bool readyForReading,
int DatagramSocket::waitUntilReady (const bool readyForReading,
const int timeoutMsecs) const const int timeoutMsecs) const
{ {
return connected ? waitForReadiness (handle, readyForReading, timeoutMsecs) return connected ? waitForReadiness (handle, readyForReading, timeoutMsecs)
@@ -597,11 +597,11 @@ int DatagramSocket::read (void* destBuffer, const int maxBytesToRead)
int DatagramSocket::write (const void* sourceBuffer, const int numBytesToWrite) int DatagramSocket::write (const void* sourceBuffer, const int numBytesToWrite)
{ {
// You need to call connect() first to set the server address.. // You need to call connect() first to set the server address..
jassert (serverAddress != 0 && connected);
jassert (serverAddress != 0 && connected);
return connected ? sendto (handle, (const char*) sourceBuffer,
numBytesToWrite, 0,
(const struct sockaddr*) serverAddress,
return connected ? sendto (handle, (const char*) sourceBuffer,
numBytesToWrite, 0,
(const struct sockaddr*) serverAddress,
sizeof (struct sockaddr_in)) sizeof (struct sockaddr_in))
: -1; : -1;
} }


+ 13
- 13
src/juce_core/io/network/juce_Socket.h View File

@@ -65,7 +65,7 @@ public:
//============================================================================== //==============================================================================
/** Binds the socket to the specified local port. /** Binds the socket to the specified local port.
@returns true on success; false may indicate that another socket is already bound
@returns true on success; false may indicate that another socket is already bound
on the same port on the same port
*/ */
bool bindToPort (const int localPortNumber); bool bindToPort (const int localPortNumber);
@@ -106,15 +106,15 @@ public:
If the timeout is < 0, it will wait forever, or else will give up after If the timeout is < 0, it will wait forever, or else will give up after
the specified time. the specified time.
If the socket is ready on return, this returns 1. If it times-out before
If the socket is ready on return, this returns 1. If it times-out before
the socket becomes ready, it returns 0. If an error occurs, it returns -1. the socket becomes ready, it returns 0. If an error occurs, it returns -1.
*/ */
int waitUntilReady (const bool readyForReading,
int waitUntilReady (const bool readyForReading,
const int timeoutMsecs) const; const int timeoutMsecs) const;
/** Reads bytes from the socket (blocking). /** Reads bytes from the socket (blocking).
Note that this method will block unless you have checked the socket is ready
Note that this method will block unless you have checked the socket is ready
for reading before calling it (see the waitUntilReady() method). for reading before calling it (see the waitUntilReady() method).
@returns the number of bytes read, or -1 if there was an error. @returns the number of bytes read, or -1 if there was an error.
@@ -123,7 +123,7 @@ public:
/** Writes bytes to the socket from a buffer. /** Writes bytes to the socket from a buffer.
Note that this method will block unless you have checked the socket is ready
Note that this method will block unless you have checked the socket is ready
for writing before calling it (see the waitUntilReady() method). for writing before calling it (see the waitUntilReady() method).
@returns the number of bytes written, or -1 if there was an error. @returns the number of bytes written, or -1 if there was an error.
@@ -188,8 +188,8 @@ public:
The localPortNumber is the port on which to bind this socket. If this value is 0, The localPortNumber is the port on which to bind this socket. If this value is 0,
the port number is assigned by the operating system. the port number is assigned by the operating system.
To use the socket for sending, call the connect() method. This will not immediately
make a connection, but will save the destination you've provided. After this, you can
To use the socket for sending, call the connect() method. This will not immediately
make a connection, but will save the destination you've provided. After this, you can
call read() or write(). call read() or write().
To wait for other sockets to connect to this one, call waitForNextConnection(). To wait for other sockets to connect to this one, call waitForNextConnection().
@@ -202,7 +202,7 @@ public:
//============================================================================== //==============================================================================
/** Binds the socket to the specified local port. /** Binds the socket to the specified local port.
@returns true on success; false may indicate that another socket is already bound
@returns true on success; false may indicate that another socket is already bound
on the same port on the same port
*/ */
bool bindToPort (const int localPortNumber); bool bindToPort (const int localPortNumber);
@@ -243,15 +243,15 @@ public:
If the timeout is < 0, it will wait forever, or else will give up after If the timeout is < 0, it will wait forever, or else will give up after
the specified time. the specified time.
If the socket is ready on return, this returns 1. If it times-out before
If the socket is ready on return, this returns 1. If it times-out before
the socket becomes ready, it returns 0. If an error occurs, it returns -1. the socket becomes ready, it returns 0. If an error occurs, it returns -1.
*/ */
int waitUntilReady (const bool readyForReading,
int waitUntilReady (const bool readyForReading,
const int timeoutMsecs) const; const int timeoutMsecs) const;
/** Reads bytes from the socket (blocking). /** Reads bytes from the socket (blocking).
Note that this method will block unless you have checked the socket is ready
Note that this method will block unless you have checked the socket is ready
for reading before calling it (see the waitUntilReady() method). for reading before calling it (see the waitUntilReady() method).
@returns the number of bytes read, or -1 if there was an error. @returns the number of bytes read, or -1 if there was an error.
@@ -260,7 +260,7 @@ public:
/** Writes bytes to the socket from a buffer. /** Writes bytes to the socket from a buffer.
Note that this method will block unless you have checked the socket is ready
Note that this method will block unless you have checked the socket is ready
for writing before calling it (see the waitUntilReady() method). for writing before calling it (see the waitUntilReady() method).
@returns the number of bytes written, or -1 if there was an error. @returns the number of bytes written, or -1 if there was an error.
@@ -271,7 +271,7 @@ public:
/** This waits for incoming data to be sent, and returns a socket that can be used /** This waits for incoming data to be sent, and returns a socket that can be used
to read it. to read it.
The object that gets returned is owned by the caller, and can't be used for
The object that gets returned is owned by the caller, and can't be used for
sending, but can be used to read the data. sending, but can be used to read the data.
*/ */
DatagramSocket* waitForNextConnection() const; DatagramSocket* waitForNextConnection() const;


+ 770
- 770
src/juce_core/text/juce_CharacterFunctions.cpp
File diff suppressed because it is too large
View File


Loading…
Cancel
Save