1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

misc optimisations

This commit is contained in:
jules 2007-06-17 16:02:59 +00:00
parent 00e469d8ac
commit bfdb48d4bc
53 changed files with 1852 additions and 1877 deletions

View file

@ -62,7 +62,7 @@ static File executableFile;
//==============================================================================
bool juce_isDirectory (const String& fileName)
bool juce_isDirectory (const String& fileName) throw()
{
if (fileName.isEmpty())
return true;
@ -75,7 +75,7 @@ bool juce_isDirectory (const String& fileName)
return false;
}
bool juce_fileExists (const String& fileName, const bool dontCountDirectories)
bool juce_fileExists (const String& fileName, const bool dontCountDirectories) throw()
{
if (fileName.isEmpty())
return false;
@ -88,7 +88,7 @@ bool juce_fileExists (const String& fileName, const bool dontCountDirectories)
return exists;
}
int64 juce_getFileSize (const String& fileName)
int64 juce_getFileSize (const String& fileName) throw()
{
struct stat info;
const int res = stat (fileName.toUTF8(), &info);
@ -102,7 +102,7 @@ int64 juce_getFileSize (const String& fileName)
void juce_getFileTimes (const String& fileName,
int64& modificationTime,
int64& accessTime,
int64& creationTime)
int64& creationTime) throw()
{
modificationTime = 0;
accessTime = 0;
@ -125,7 +125,7 @@ void juce_getFileTimes (const String& fileName,
bool juce_setFileTimes (const String& fileName,
int64 modificationTime,
int64 accessTime,
int64 creationTime)
int64 creationTime) throw()
{
struct utimbuf times;
times.actime = (time_t) (accessTime / 1000);
@ -134,12 +134,12 @@ bool juce_setFileTimes (const String& fileName,
return utime (fileName.toUTF8(), &times) == 0;
}
bool juce_canWriteToFile (const String& fileName)
bool juce_canWriteToFile (const String& fileName) throw()
{
return access (fileName.toUTF8(), W_OK) == 0;
}
bool juce_setFileReadOnly (const String& fileName, bool isReadOnly)
bool juce_setFileReadOnly (const String& fileName, bool isReadOnly) throw()
{
struct stat info;
const int res = stat (fileName.toUTF8(), &info);
@ -157,7 +157,7 @@ bool juce_setFileReadOnly (const String& fileName, bool isReadOnly)
return chmod (fileName.toUTF8(), info.st_mode) == 0;
}
bool juce_deleteFile (const String& fileName)
bool juce_deleteFile (const String& fileName) throw()
{
if (juce_isDirectory (fileName))
return rmdir (fileName.toUTF8()) == 0;
@ -165,7 +165,7 @@ bool juce_deleteFile (const String& fileName)
return remove (fileName.toUTF8()) == 0;
}
bool juce_copyFile (const String& s, const String& d)
bool juce_copyFile (const String& s, const String& d) throw()
{
const File source (s), dest (d);
@ -196,7 +196,7 @@ bool juce_copyFile (const String& s, const String& d)
return ok;
}
bool juce_moveFile (const String& source, const String& dest)
bool juce_moveFile (const String& source, const String& dest) throw()
{
if (rename (source.toUTF8(), dest.toUTF8()) == 0)
return true;
@ -215,12 +215,12 @@ bool juce_moveFile (const String& source, const String& dest)
return false;
}
void juce_createDirectory (const String& fileName)
void juce_createDirectory (const String& fileName) throw()
{
mkdir (fileName.toUTF8(), 0777);
}
void* juce_fileOpen (const String& fileName, bool forWriting)
void* juce_fileOpen (const String& fileName, bool forWriting) throw()
{
const char* mode = "rb";
@ -243,13 +243,13 @@ void* juce_fileOpen (const String& fileName, bool forWriting)
return (void*)fopen (fileName.toUTF8(), mode);
}
void juce_fileClose (void* handle)
void juce_fileClose (void* handle) throw()
{
if (handle != 0)
fclose ((FILE*) handle);
}
int juce_fileRead (void* handle, void* buffer, int size)
int juce_fileRead (void* handle, void* buffer, int size) throw()
{
if (handle != 0)
return fread (buffer, 1, size, (FILE*) handle);
@ -257,7 +257,7 @@ int juce_fileRead (void* handle, void* buffer, int size)
return 0;
}
int juce_fileWrite (void* handle, const void* buffer, int size)
int juce_fileWrite (void* handle, const void* buffer, int size) throw()
{
if (handle != 0)
return fwrite (buffer, 1, size, (FILE*) handle);
@ -265,7 +265,7 @@ int juce_fileWrite (void* handle, const void* buffer, int size)
return 0;
}
int64 juce_fileSetPosition (void* handle, int64 pos)
int64 juce_fileSetPosition (void* handle, int64 pos) throw()
{
if (handle != 0 && fseek ((FILE*) handle, (long) pos, SEEK_SET) == 0)
return pos;
@ -273,7 +273,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos)
return -1;
}
int64 juce_fileGetPosition (void* handle)
int64 juce_fileGetPosition (void* handle) throw()
{
if (handle != 0)
return ftell ((FILE*) handle);
@ -281,13 +281,13 @@ int64 juce_fileGetPosition (void* handle)
return -1;
}
void juce_fileFlush (void* handle)
void juce_fileFlush (void* handle) throw()
{
if (handle != 0)
fflush ((FILE*) handle);
}
const StringArray juce_getFileSystemRoots()
const StringArray juce_getFileSystemRoots() throw()
{
StringArray s;
s.add (T("/"));
@ -295,7 +295,7 @@ const StringArray juce_getFileSystemRoots()
}
const String juce_getVolumeLabel (const String& filenameOnVolume,
int& volumeSerialNumber)
int& volumeSerialNumber) throw()
{
// There is no equivalent on Linux
volumeSerialNumber = 0;
@ -421,7 +421,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
}
//==============================================================================
void juce_setCurrentExecutableFileName (const String& filename)
void juce_setCurrentExecutableFileName (const String& filename) throw()
{
executableFile = File::getCurrentWorkingDirectory().getChildFile (filename);
}
@ -450,7 +450,7 @@ struct FindFileStruct
DIR* dir;
bool getNextMatch (String& result, bool* const isDir, bool* const isHidden, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
Time* const modTime, Time* const creationTime, bool* const isReadOnly) throw()
{
const char* const wildcardUTF8 = wildCard.toUTF8();
@ -507,7 +507,7 @@ struct FindFileStruct
// returns 0 on failure
void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile,
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly)
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
DIR* d = opendir (directory.toUTF8());
@ -543,7 +543,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
}
bool juce_findFileNext (void* handle, String& resultFile,
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly)
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
FindFileStruct* const ff = (FindFileStruct*) handle;
@ -553,7 +553,7 @@ bool juce_findFileNext (void* handle, String& resultFile,
return false;
}
void juce_findFileClose (void* handle)
void juce_findFileClose (void* handle) throw()
{
FindFileStruct* const ff = (FindFileStruct*) handle;
@ -565,7 +565,7 @@ void juce_findFileClose (void* handle)
}
bool juce_launchFile (const String& fileName,
const String& parameters)
const String& parameters) throw()
{
String cmdString (fileName);
cmdString << " " << parameters;

View file

@ -50,7 +50,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
int SystemStats::getMACAddresses (int64* addresses, int maxNum)
int SystemStats::getMACAddresses (int64* addresses, int maxNum) throw()
{
// xxx todo
return 0;

View file

@ -57,7 +57,7 @@ static struct _LogicalCpuInfo
} logicalCpuInfo;
//==============================================================================
static juce_noinline unsigned int getCPUIDWord (int* familyModel, int* extFeatures)
static juce_noinline unsigned int getCPUIDWord (int* familyModel, int* extFeatures) throw()
{
unsigned int cpu = 0;
unsigned int ext = 0;
@ -77,7 +77,7 @@ static juce_noinline unsigned int getCPUIDWord (int* familyModel, int* extFeatur
return cpu;
}
void juce_initLogicalCpuInfo()
void juce_initLogicalCpuInfo() throw()
{
int familyModelWord, extFeaturesWord;
int featuresWord = getCPUIDWord (&familyModelWord, &extFeaturesWord);
@ -182,13 +182,13 @@ void juce_initLogicalCpuInfo()
}
//==============================================================================
void Logger::outputDebugString (const String& text)
void Logger::outputDebugString (const String& text) throw()
{
fprintf (stdout, text.toUTF8());
fprintf (stdout, "\n");
}
void Logger::outputDebugPrintf (const tchar* format, ...)
void Logger::outputDebugPrintf (const tchar* format, ...) throw()
{
String text;
va_list args;
@ -197,17 +197,17 @@ void Logger::outputDebugPrintf (const tchar* format, ...)
outputDebugString(text);
}
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() throw()
{
return Linux;
}
const String SystemStats::getOperatingSystemName()
const String SystemStats::getOperatingSystemName() throw()
{
return T("Linux");
}
static const String getCpuInfo (const char* key, bool lastOne = false)
static const String getCpuInfo (const char* key, bool lastOne = false) throw()
{
String info;
char buf [256];
@ -243,44 +243,44 @@ static const String getCpuInfo (const char* key, bool lastOne = false)
return info;
}
bool SystemStats::hasMMX()
bool SystemStats::hasMMX() throw()
{
return getCpuInfo ("flags").contains (T("mmx"));
}
bool SystemStats::hasSSE()
bool SystemStats::hasSSE() throw()
{
return getCpuInfo ("flags").contains (T("sse"));
}
bool SystemStats::hasSSE2()
bool SystemStats::hasSSE2() throw()
{
return getCpuInfo ("flags").contains (T("sse2"));
}
bool SystemStats::has3DNow()
bool SystemStats::has3DNow() throw()
{
return getCpuInfo ("flags").contains (T("3dnow"));
}
const String SystemStats::getCpuVendor()
const String SystemStats::getCpuVendor() throw()
{
return getCpuInfo ("vendor_id");
}
int SystemStats::getCpuSpeedInMegaherz()
int SystemStats::getCpuSpeedInMegaherz() throw()
{
const String speed (getCpuInfo ("cpu MHz"));
return (int) (speed.getFloatValue() + 0.5f);
}
bool SystemStats::hasHyperThreading()
bool SystemStats::hasHyperThreading() throw()
{
return logicalCpuInfo.htAvailable;
}
int SystemStats::getMemorySizeInMegabytes()
int SystemStats::getMemorySizeInMegabytes() throw()
{
struct sysinfo sysi;
@ -336,7 +336,7 @@ int64 Time::getHighResolutionTicksPerSecond() throw()
return 1000000;
}
bool Time::setSystemTimeToThisTime() const
bool Time::setSystemTimeToThisTime() const throw()
{
timeval t;
t.tv_sec = millisSinceEpoch % 1000000;
@ -345,7 +345,7 @@ bool Time::setSystemTimeToThisTime() const
return settimeofday (&t, NULL) ? false : true;
}
int SystemStats::getPageSize()
int SystemStats::getPageSize() throw()
{
static int systemPageSize = 0;
@ -355,7 +355,7 @@ int SystemStats::getPageSize()
return systemPageSize;
}
int SystemStats::getNumPhysicalCpus()
int SystemStats::getNumPhysicalCpus() throw()
{
if (logicalCpuInfo.numPackages)
return logicalCpuInfo.numPackages;
@ -363,14 +363,14 @@ int SystemStats::getNumPhysicalCpus()
return getNumLogicalCpus();
}
int SystemStats::getNumLogicalCpus()
int SystemStats::getNumLogicalCpus() throw()
{
const int lastCpu = getCpuInfo ("processor", true).getIntValue();
return lastCpu + 1;
}
uint32 SystemStats::getPhysicalAffinityMask()
uint32 SystemStats::getPhysicalAffinityMask() throw()
{
#if SUPPORT_AFFINITIES
return logicalCpuInfo.physicalAffinityMask;
@ -385,7 +385,7 @@ uint32 SystemStats::getPhysicalAffinityMask()
}
//==============================================================================
void SystemStats::initialiseStats()
void SystemStats::initialiseStats() throw()
{
// Process starts off as root when running suid
Process::lowerPrivilege();

View file

@ -51,7 +51,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
void JUCE_API juce_threadEntryPoint (void*);
void* threadEntryProc (void* value)
void* threadEntryProc (void* value) throw()
{
// New threads start off as root when running suid
Process::lowerPrivilege();
@ -60,7 +60,7 @@ void* threadEntryProc (void* value)
return 0;
}
void* juce_createThread (void* userData)
void* juce_createThread (void* userData) throw()
{
pthread_t handle = 0;
@ -73,17 +73,17 @@ void* juce_createThread (void* userData)
return 0;
}
void juce_killThread (void* handle)
void juce_killThread (void* handle) throw()
{
if (handle != 0)
pthread_cancel ((pthread_t)handle);
}
void juce_setCurrentThreadName (const String& /*name*/)
void juce_setCurrentThreadName (const String& /*name*/) throw()
{
}
int Thread::getCurrentThreadId()
int Thread::getCurrentThreadId() throw()
{
return (int) pthread_self();
}
@ -104,7 +104,7 @@ int Thread::getCurrentThreadId()
// priority 1 to 10 where 5=normal, 1=low. If the handle is 0, sets the
// priority of the current thread
void juce_setThreadPriority (void* handle, int priority)
void juce_setThreadPriority (void* handle, int priority) throw()
{
struct sched_param param;
int policy, maxp, minp, pri;
@ -162,12 +162,12 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
#endif
}
void Thread::yield()
void Thread::yield() throw()
{
sched_yield();
}
void Thread::sleep (int millisecs)
void Thread::sleep (int millisecs) throw()
{
struct timespec time;
time.tv_sec = millisecs / 1000;

View file

@ -151,7 +151,7 @@ static bool untrapErrors()
//==============================================================================
static bool isActiveApplication = false;
bool Process::isForegroundProcess()
bool Process::isForegroundProcess() throw()
{
return isActiveApplication;
}
@ -2541,7 +2541,7 @@ void Desktop::setMousePosition (int x, int y)
}
//==============================================================================
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY)
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
{
Window root = RootWindow (display, DefaultScreen (display));
const unsigned int imageW = image.getWidth();
@ -2609,13 +2609,13 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
return result;
}
void juce_deleteMouseCursor (void* cursorHandle, bool)
void juce_deleteMouseCursor (void* const cursorHandle, const bool) throw()
{
if (cursorHandle != None)
XFreeCursor (display, (Cursor)cursorHandle);
XFreeCursor (display, (Cursor) cursorHandle);
}
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type)
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw()
{
unsigned int shape;

View file

@ -193,14 +193,14 @@ const String PlatformUtilities::convertToPrecomposedUnicode (const String& s)
}
//==============================================================================
static bool juce_stat (const String& fileName, struct stat& info)
static bool juce_stat (const String& fileName, struct stat& info) throw()
{
return fileName.isNotEmpty()
&& (stat (fileName.toUTF8(), &info) == 0);
}
//==============================================================================
bool juce_isDirectory (const String& fileName)
bool juce_isDirectory (const String& fileName) throw()
{
if (fileName.isEmpty())
return true;
@ -211,7 +211,7 @@ bool juce_isDirectory (const String& fileName)
&& ((info.st_mode & S_IFDIR) != 0);
}
bool juce_fileExists (const String& fileName, const bool dontCountDirectories)
bool juce_fileExists (const String& fileName, const bool dontCountDirectories) throw()
{
if (fileName.isEmpty())
return false;
@ -231,7 +231,7 @@ bool juce_fileExists (const String& fileName, const bool dontCountDirectories)
return exists;
}
int64 juce_getFileSize (const String& fileName)
int64 juce_getFileSize (const String& fileName) throw()
{
struct stat info;
@ -243,7 +243,7 @@ int64 juce_getFileSize (const String& fileName)
const unsigned int macTimeToUnixTimeDiff = 0x7c25be90;
static uint64 utcDateTimeToUnixTime (const UTCDateTime& d)
static uint64 utcDateTimeToUnixTime (const UTCDateTime& d) throw()
{
if (d.highSeconds == 0 && d.lowSeconds == 0 && d.fraction == 0)
return 0;
@ -253,7 +253,7 @@ static uint64 utcDateTimeToUnixTime (const UTCDateTime& d)
- 2082844800000ll;
}
static void unixTimeToUtcDateTime (uint64 t, UTCDateTime& d)
static void unixTimeToUtcDateTime (uint64 t, UTCDateTime& d) throw()
{
if (t != 0)
t += 2082844800000ll;
@ -266,7 +266,7 @@ static void unixTimeToUtcDateTime (uint64 t, UTCDateTime& d)
void juce_getFileTimes (const String& fileName,
int64& modificationTime,
int64& accessTime,
int64& creationTime)
int64& creationTime) throw()
{
modificationTime = 0;
accessTime = 0;
@ -296,7 +296,7 @@ void juce_getFileTimes (const String& fileName,
bool juce_setFileTimes (const String& fileName,
int64 modificationTime,
int64 accessTime,
int64 creationTime)
int64 creationTime) throw()
{
FSRef fileRef;
if (PlatformUtilities::makeFSRefFromPath (&fileRef, fileName))
@ -328,12 +328,12 @@ bool juce_setFileTimes (const String& fileName,
return false;
}
bool juce_canWriteToFile (const String& fileName)
bool juce_canWriteToFile (const String& fileName) throw()
{
return access (fileName.toUTF8(), W_OK) == 0;
}
bool juce_setFileReadOnly (const String& fileName, bool isReadOnly)
bool juce_setFileReadOnly (const String& fileName, bool isReadOnly) throw()
{
const char* const fileNameUTF8 = fileName.toUTF8();
@ -358,7 +358,7 @@ bool juce_setFileReadOnly (const String& fileName, bool isReadOnly)
return ok;
}
bool juce_deleteFile (const String& fileName)
bool juce_deleteFile (const String& fileName) throw()
{
const char* const fileNameUTF8 = fileName.toUTF8();
@ -368,7 +368,7 @@ bool juce_deleteFile (const String& fileName)
return remove (fileNameUTF8) == 0;
}
bool juce_copyFile (const String& src, const String& dst)
bool juce_copyFile (const String& src, const String& dst) throw()
{
const File destFile (dst);
@ -446,7 +446,7 @@ bool juce_copyFile (const String& src, const String& dst)
return false;
}
bool juce_moveFile (const String& source, const String& dest)
bool juce_moveFile (const String& source, const String& dest) throw()
{
if (rename (source.toUTF8(), dest.toUTF8()) == 0)
return true;
@ -463,12 +463,12 @@ bool juce_moveFile (const String& source, const String& dest)
return false;
}
void juce_createDirectory (const String& fileName)
void juce_createDirectory (const String& fileName) throw()
{
mkdir (fileName.toUTF8(), 0777);
}
void* juce_fileOpen (const String& fileName, bool forWriting)
void* juce_fileOpen (const String& fileName, bool forWriting) throw()
{
const char* const fileNameUTF8 = fileName.toUTF8();
const char* mode = "rb";
@ -493,13 +493,13 @@ void* juce_fileOpen (const String& fileName, bool forWriting)
return (void*) fopen (fileNameUTF8, mode);
}
void juce_fileClose (void* handle)
void juce_fileClose (void* handle) throw()
{
if (handle != 0)
fclose ((FILE*) handle);
}
int juce_fileRead (void* handle, void* buffer, int size)
int juce_fileRead (void* handle, void* buffer, int size) throw()
{
if (handle != 0)
return fread (buffer, 1, size, (FILE*) handle);
@ -507,7 +507,7 @@ int juce_fileRead (void* handle, void* buffer, int size)
return 0;
}
int juce_fileWrite (void* handle, const void* buffer, int size)
int juce_fileWrite (void* handle, const void* buffer, int size) throw()
{
if (handle != 0)
return fwrite (buffer, 1, size, (FILE*) handle);
@ -515,7 +515,7 @@ int juce_fileWrite (void* handle, const void* buffer, int size)
return 0;
}
int64 juce_fileSetPosition (void* handle, int64 pos)
int64 juce_fileSetPosition (void* handle, int64 pos) throw()
{
if (handle != 0 && fseek ((FILE*) handle, pos, SEEK_SET) == 0)
return pos;
@ -523,7 +523,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos)
return -1;
}
int64 juce_fileGetPosition (void* handle)
int64 juce_fileGetPosition (void* handle) throw()
{
if (handle != 0)
return ftell ((FILE*) handle);
@ -531,27 +531,27 @@ int64 juce_fileGetPosition (void* handle)
return -1;
}
void juce_fileFlush (void* handle)
void juce_fileFlush (void* handle) throw()
{
if (handle != 0)
fflush ((FILE*) handle);
}
const StringArray juce_getFileSystemRoots()
const StringArray juce_getFileSystemRoots() throw()
{
StringArray s;
s.add (T("/"));
return s;
}
const String juce_getVolumeLabel (const String& filenameOnVolume, int& volumeSerialNumber)
const String juce_getVolumeLabel (const String& filenameOnVolume, int& volumeSerialNumber) throw()
{
volumeSerialNumber = 0;
return String::empty;
}
// if this file doesn't exist, find a parent of it that does..
static bool doStatFS (const File* file, struct statfs& result)
static bool doStatFS (const File* file, struct statfs& result) throw()
{
File f (*file);
@ -579,7 +579,7 @@ int64 File::getBytesFreeOnVolume() const throw()
}
//==============================================================================
static bool isFileOnDriveType (const File* const f, const char** types)
static bool isFileOnDriveType (const File* const f, const char** types) throw()
{
struct statfs buf;
@ -671,13 +671,13 @@ const File File::getSpecialLocation (const SpecialLocationType type)
return File::nonexistent;
}
void juce_setCurrentExecutableFileName (const String& filename)
void juce_setCurrentExecutableFileName (const String& filename) throw()
{
executableFile = File::getCurrentWorkingDirectory()
.getChildFile (PlatformUtilities::convertToPrecomposedUnicode (filename));
}
void juce_setCurrentExecutableFileNameFromBundleId (const String& bundleId)
void juce_setCurrentExecutableFileNameFromBundleId (const String& bundleId) throw()
{
CFStringRef bundleIdStringRef = PlatformUtilities::juceStringToCFString (bundleId);
CFBundleRef bundleRef = CFBundleGetBundleWithIdentifier (bundleIdStringRef);
@ -722,7 +722,7 @@ struct FindFileStruct
DIR* dir;
bool getNextMatch (String& result, bool* const isDir, bool* const isHidden, int64* const fileSize,
Time* const modTime, Time* const creationTime, bool* const isReadOnly)
Time* const modTime, Time* const creationTime, bool* const isReadOnly) throw()
{
const char* const wildCardUTF8 = wildCard.toUTF8();
@ -779,7 +779,7 @@ struct FindFileStruct
// returns 0 on failure
void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile,
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly)
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
DIR* const d = opendir (directory.toUTF8());
@ -811,7 +811,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
}
bool juce_findFileNext (void* handle, String& resultFile,
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly)
bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
FindFileStruct* const ff = (FindFileStruct*) handle;
@ -821,7 +821,7 @@ bool juce_findFileNext (void* handle, String& resultFile,
return false;
}
void juce_findFileClose (void* handle)
void juce_findFileClose (void* handle) throw()
{
FindFileStruct* const ff = (FindFileStruct*)handle;
@ -833,7 +833,7 @@ void juce_findFileClose (void* handle)
}
//==============================================================================
bool juce_launchExecutable (const String& pathAndArguments)
bool juce_launchExecutable (const String& pathAndArguments) throw()
{
char* const argv[4] = { "/bin/sh", "-c", (char*) (const char*) pathAndArguments, 0 };
@ -855,7 +855,7 @@ bool juce_launchExecutable (const String& pathAndArguments)
}
bool juce_launchFile (const String& fileName,
const String& parameters)
const String& parameters) throw()
{
bool ok = false;

View file

@ -1,138 +1,126 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "../../../src/juce_core/basics/juce_StandardHeader.h"
#include <IOKit/IOKitLib.h>
#include <IOKit/network/IOEthernetInterface.h>
#include <IOKit/network/IONetworkInterface.h>
#include <IOKit/network/IOEthernetController.h>
#include <Carbon/Carbon.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
BEGIN_JUCE_NAMESPACE
#include "../../../src/juce_core/text/juce_String.h"
#include "../../../src/juce_core/basics/juce_Time.h"
#include "../../../src/juce_core/basics/juce_SystemStats.h"
#include "../../../src/juce_core/containers/juce_MemoryBlock.h"
#include "../../../src/juce_core/text/juce_StringArray.h"
#include "juce_mac_HTTPStream.h"
//==============================================================================
static bool GetEthernetIterator (io_iterator_t* matchingServices)
{
mach_port_t masterPort;
if (IOMasterPort (MACH_PORT_NULL, &masterPort) == KERN_SUCCESS)
{
CFMutableDictionaryRef dict = IOServiceMatching (kIOEthernetInterfaceClass);
if (dict != 0)
{
CFMutableDictionaryRef propDict = CFDictionaryCreateMutable (kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (propDict != 0)
{
CFDictionarySetValue (propDict, CFSTR (kIOPrimaryInterface), kCFBooleanTrue);
CFDictionarySetValue (dict, CFSTR (kIOPropertyMatchKey), propDict);
CFRelease (propDict);
}
}
return IOServiceGetMatchingServices (masterPort, dict, matchingServices) == KERN_SUCCESS;
}
return false;
}
int SystemStats::getMACAddresses (int64* addresses, int maxNum)
{
int numResults = 0;
io_iterator_t it;
if (GetEthernetIterator (&it))
{
io_object_t i;
while ((i = IOIteratorNext (it)) != 0)
{
io_object_t controller;
if (IORegistryEntryGetParentEntry (i, kIOServicePlane, &controller) == KERN_SUCCESS)
{
CFTypeRef data = IORegistryEntryCreateCFProperty (controller,
CFSTR (kIOMACAddress),
kCFAllocatorDefault,
0);
if (data != 0)
{
UInt8 addr [kIOEthernetAddressSize];
zeromem (addr, sizeof (addr));
CFDataGetBytes ((CFDataRef)data, CFRangeMake (0, sizeof (addr)), addr);
CFRelease (data);
int64 a = 0;
for (int i = 6; --i >= 0;)
a = (a << 8) | addr[i];
if (numResults < maxNum)
{
*addresses++ = a;
++numResults;
}
}
IOObjectRelease (controller);
}
IOObjectRelease (i);
}
IOObjectRelease (it);
}
return numResults;
}
END_JUCE_NAMESPACE
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-7 by Raw Material Software ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the
GNU General Public License, as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
JUCE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with JUCE; if not, visit www.gnu.org/licenses or write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
------------------------------------------------------------------------------
If you'd like to release a closed-source product which uses JUCE, commercial
licenses are also available: visit www.rawmaterialsoftware.com/juce for
more information.
==============================================================================
*/
#include "../../../src/juce_core/basics/juce_StandardHeader.h"
#include <IOKit/IOKitLib.h>
#include <IOKit/network/IOEthernetInterface.h>
#include <IOKit/network/IONetworkInterface.h>
#include <IOKit/network/IOEthernetController.h>
#include <Carbon/Carbon.h>
BEGIN_JUCE_NAMESPACE
#include "../../../src/juce_core/basics/juce_SystemStats.h"
//==============================================================================
static bool GetEthernetIterator (io_iterator_t* matchingServices) throw()
{
mach_port_t masterPort;
if (IOMasterPort (MACH_PORT_NULL, &masterPort) == KERN_SUCCESS)
{
CFMutableDictionaryRef dict = IOServiceMatching (kIOEthernetInterfaceClass);
if (dict != 0)
{
CFMutableDictionaryRef propDict = CFDictionaryCreateMutable (kCFAllocatorDefault,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (propDict != 0)
{
CFDictionarySetValue (propDict, CFSTR (kIOPrimaryInterface), kCFBooleanTrue);
CFDictionarySetValue (dict, CFSTR (kIOPropertyMatchKey), propDict);
CFRelease (propDict);
}
}
return IOServiceGetMatchingServices (masterPort, dict, matchingServices) == KERN_SUCCESS;
}
return false;
}
int SystemStats::getMACAddresses (int64* addresses, int maxNum) throw()
{
int numResults = 0;
io_iterator_t it;
if (GetEthernetIterator (&it))
{
io_object_t i;
while ((i = IOIteratorNext (it)) != 0)
{
io_object_t controller;
if (IORegistryEntryGetParentEntry (i, kIOServicePlane, &controller) == KERN_SUCCESS)
{
CFTypeRef data = IORegistryEntryCreateCFProperty (controller,
CFSTR (kIOMACAddress),
kCFAllocatorDefault,
0);
if (data != 0)
{
UInt8 addr [kIOEthernetAddressSize];
zeromem (addr, sizeof (addr));
CFDataGetBytes ((CFDataRef) data, CFRangeMake (0, sizeof (addr)), addr);
CFRelease (data);
int64 a = 0;
for (int i = 6; --i >= 0;)
a = (a << 8) | addr[i];
if (numResults < maxNum)
{
*addresses++ = a;
++numResults;
}
}
IOObjectRelease (controller);
}
IOObjectRelease (i);
}
IOObjectRelease (it);
}
return numResults;
}
END_JUCE_NAMESPACE

View file

@ -46,7 +46,7 @@ static int64 highResTimerFrequency;
#if JUCE_INTEL
static void juce_getCpuVendor (char* const v)
static void juce_getCpuVendor (char* const v) throw()
{
int vendor[4];
zerostruct (vendor);
@ -60,7 +60,7 @@ static void juce_getCpuVendor (char* const v)
memcpy (v, vendor, 16);
}
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures)
static unsigned int getCPUIDWord (unsigned int& familyModel, unsigned int& extFeatures) throw()
{
unsigned int cpu = 0;
unsigned int ext = 0;
@ -91,14 +91,14 @@ static CPUFlags cpuFlags;
#endif
//==============================================================================
void Logger::outputDebugString (const String& text)
void Logger::outputDebugString (const String& text) throw()
{
String withLineFeed (text + T("\n"));
const char* const utf8 = withLineFeed.toUTF8();
fwrite (utf8, strlen (utf8), 1, stdout);
}
void Logger::outputDebugPrintf (const tchar* format, ...)
void Logger::outputDebugPrintf (const tchar* format, ...) throw()
{
String text;
va_list args;
@ -107,7 +107,7 @@ void Logger::outputDebugPrintf (const tchar* format, ...)
outputDebugString (text);
}
int SystemStats::getMemorySizeInMegabytes()
int SystemStats::getMemorySizeInMegabytes() throw()
{
long bytes;
if (Gestalt (gestaltPhysicalRAMSize, &bytes) == noErr)
@ -117,18 +117,18 @@ int SystemStats::getMemorySizeInMegabytes()
}
//==============================================================================
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() throw()
{
return MacOSX;
}
const String SystemStats::getOperatingSystemName()
const String SystemStats::getOperatingSystemName() throw()
{
return T("Mac OS X");
}
//==============================================================================
void SystemStats::initialiseStats()
void SystemStats::initialiseStats() throw()
{
static bool initialised = false;
@ -165,7 +165,7 @@ void SystemStats::initialiseStats()
}
}
bool SystemStats::hasMMX()
bool SystemStats::hasMMX() throw()
{
#if JUCE_INTEL
return cpuFlags.hasMMX;
@ -174,7 +174,7 @@ bool SystemStats::hasMMX()
#endif
}
bool SystemStats::hasSSE()
bool SystemStats::hasSSE() throw()
{
#if JUCE_INTEL
return cpuFlags.hasSSE;
@ -183,7 +183,7 @@ bool SystemStats::hasSSE()
#endif
}
bool SystemStats::hasSSE2()
bool SystemStats::hasSSE2() throw()
{
#if JUCE_INTEL
return cpuFlags.hasSSE2;
@ -192,7 +192,7 @@ bool SystemStats::hasSSE2()
#endif
}
bool SystemStats::has3DNow()
bool SystemStats::has3DNow() throw()
{
#if JUCE_INTEL
return cpuFlags.has3DNow;
@ -201,7 +201,7 @@ bool SystemStats::has3DNow()
#endif
}
bool SystemStats::hasHyperThreading()
bool SystemStats::hasHyperThreading() throw()
{
#if JUCE_INTEL
return cpuFlags.hasHT;
@ -210,7 +210,7 @@ bool SystemStats::hasHyperThreading()
#endif
}
const String SystemStats::getCpuVendor()
const String SystemStats::getCpuVendor() throw()
{
#if JUCE_INTEL
char v [16];
@ -221,22 +221,22 @@ const String SystemStats::getCpuVendor()
#endif
}
int SystemStats::getCpuSpeedInMegaherz()
int SystemStats::getCpuSpeedInMegaherz() throw()
{
return GetCPUSpeed();
}
int SystemStats::getNumPhysicalCpus()
int SystemStats::getNumPhysicalCpus() throw()
{
return MPProcessors();
}
int SystemStats::getNumLogicalCpus()
int SystemStats::getNumLogicalCpus() throw()
{
return getNumPhysicalCpus();
}
uint32 SystemStats::getPhysicalAffinityMask()
uint32 SystemStats::getPhysicalAffinityMask() throw()
{
jassertfalse
return 0;
@ -271,20 +271,20 @@ int64 Time::getHighResolutionTicksPerSecond() throw()
return highResTimerFrequency;
}
int64 SystemStats::getClockCycleCounter()
int64 SystemStats::getClockCycleCounter() throw()
{
jassertfalse
return 0;
}
bool Time::setSystemTimeToThisTime() const
bool Time::setSystemTimeToThisTime() const throw()
{
jassertfalse
return false;
}
//==============================================================================
int SystemStats::getPageSize()
int SystemStats::getPageSize() throw()
{
jassertfalse
return 512; //xxx

View file

@ -156,13 +156,13 @@ void WaitableEvent::reset() const throw()
//==============================================================================
void JUCE_API juce_threadEntryPoint (void*);
void* threadEntryProc (void* userData)
void* threadEntryProc (void* userData) throw()
{
juce_threadEntryPoint (userData);
return 0;
}
void* juce_createThread (void* userData)
void* juce_createThread (void* userData) throw()
{
pthread_t handle = 0;
@ -175,22 +175,22 @@ void* juce_createThread (void* userData)
return 0;
}
void juce_killThread (void* handle)
void juce_killThread (void* handle) throw()
{
if (handle != 0)
pthread_cancel ((pthread_t) handle);
}
void juce_setCurrentThreadName (const String& /*name*/)
void juce_setCurrentThreadName (const String& /*name*/) throw()
{
}
int Thread::getCurrentThreadId()
int Thread::getCurrentThreadId() throw()
{
return (int) pthread_self();
}
void juce_setThreadPriority (void* handle, int priority)
void juce_setThreadPriority (void* handle, int priority) throw()
{
if (handle == 0)
handle = (void*) pthread_self();
@ -202,7 +202,7 @@ void juce_setThreadPriority (void* handle, int priority)
pthread_setschedparam ((pthread_t) handle, policy, &param);
}
void Thread::yield()
void Thread::yield() throw()
{
sched_yield();
}
@ -213,7 +213,7 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
jassertfalse
}
void Thread::sleep (int millisecs)
void Thread::sleep (int millisecs) throw()
{
struct timespec time;
time.tv_sec = millisecs / 1000;

View file

@ -2185,7 +2185,7 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text)
//==============================================================================
bool Process::isForegroundProcess()
bool Process::isForegroundProcess() throw()
{
ProcessSerialNumber psn, front;
GetCurrentProcess (&psn);
@ -2298,7 +2298,7 @@ struct CursorWrapper
ThemeCursor themeCursor;
};
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY)
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
{
const int maxW = 16;
const int maxH = 16;
@ -2360,7 +2360,7 @@ static void* cursorFromData (const unsigned char* data, const int size, int hx,
const unsigned int kSpecialNoCursor = 'nocr';
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type)
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw()
{
ThemeCursor id = kThemeArrowCursor;
@ -2481,15 +2481,13 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type)
return (void*) cw;
}
void juce_deleteMouseCursor (void* cursorHandle, bool isStandard)
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) throw()
{
CursorWrapper* cw = (CursorWrapper*)cursorHandle;
CursorWrapper* const cw = (CursorWrapper*) cursorHandle;
if (cw != 0)
{
if (cw->cursor != 0)
delete cw->cursor;
delete cw->cursor;
delete cw;
}
}

View file

@ -78,7 +78,7 @@ UNICODE_FUNCTION (SetCurrentDirectoryW, BOOL, (LPCWSTR))
UNICODE_FUNCTION (FindFirstFileW, HANDLE, (LPCWSTR, LPWIN32_FIND_DATAW))
UNICODE_FUNCTION (FindNextFileW, BOOL, (HANDLE, LPWIN32_FIND_DATAW))
void juce_initialiseUnicodeFileFunctions()
void juce_initialiseUnicodeFileFunctions() throw()
{
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
@ -108,7 +108,7 @@ void juce_initialiseUnicodeFileFunctions()
//==============================================================================
bool juce_fileExists (const String& fileName,
const bool dontCountDirectories)
const bool dontCountDirectories) throw()
{
if (fileName.isEmpty())
return false;
@ -120,7 +120,7 @@ bool juce_fileExists (const String& fileName,
: (attr != 0xffffffff);
}
bool juce_isDirectory (const String& fileName)
bool juce_isDirectory (const String& fileName) throw()
{
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
@ -129,7 +129,7 @@ bool juce_isDirectory (const String& fileName)
&& ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0);
}
bool juce_canWriteToFile (const String& fileName)
bool juce_canWriteToFile (const String& fileName) throw()
{
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
@ -161,7 +161,7 @@ bool juce_setFileReadOnly (const String& fileName,
}
//==============================================================================
bool juce_deleteFile (const String& fileName)
bool juce_deleteFile (const String& fileName) throw()
{
if (juce_isDirectory (fileName))
return (wRemoveDirectoryW != 0) ? wRemoveDirectoryW (fileName) != 0
@ -171,19 +171,19 @@ bool juce_deleteFile (const String& fileName)
: DeleteFile (fileName) != 0;
}
bool juce_moveFile (const String& source, const String& dest)
bool juce_moveFile (const String& source, const String& dest) throw()
{
return (wMoveFileW != 0) ? wMoveFileW (source, dest) != 0
: MoveFile (source, dest) != 0;
}
bool juce_copyFile (const String& source, const String& dest)
bool juce_copyFile (const String& source, const String& dest) throw()
{
return (wCopyFileW != 0) ? wCopyFileW (source, dest, false) != 0
: CopyFile (source, dest, false) != 0;
}
void juce_createDirectory (const String& fileName)
void juce_createDirectory (const String& fileName) throw()
{
if (! juce_fileExists (fileName, true))
{
@ -196,7 +196,7 @@ void juce_createDirectory (const String& fileName)
//==============================================================================
// return 0 if not possible
void* juce_fileOpen (const String& fileName, bool forWriting)
void* juce_fileOpen (const String& fileName, bool forWriting) throw()
{
HANDLE h;
@ -230,20 +230,20 @@ void* juce_fileOpen (const String& fileName, bool forWriting)
return (void*) h;
}
void juce_fileClose (void* handle)
void juce_fileClose (void* handle) throw()
{
CloseHandle (handle);
}
//==============================================================================
int juce_fileRead (void* handle, void* buffer, int size)
int juce_fileRead (void* handle, void* buffer, int size) throw()
{
DWORD num = 0;
ReadFile ((HANDLE) handle, buffer, size, &num, 0);
return num;
}
int juce_fileWrite (void* handle, const void* buffer, int size)
int juce_fileWrite (void* handle, const void* buffer, int size) throw()
{
DWORD num;
@ -254,7 +254,7 @@ int juce_fileWrite (void* handle, const void* buffer, int size)
return num;
}
int64 juce_fileSetPosition (void* handle, int64 pos)
int64 juce_fileSetPosition (void* handle, int64 pos) throw()
{
LARGE_INTEGER li;
li.QuadPart = pos;
@ -266,7 +266,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos)
return li.QuadPart;
}
int64 juce_fileGetPosition (void* handle)
int64 juce_fileGetPosition (void* handle) throw()
{
LARGE_INTEGER li;
li.QuadPart = 0;
@ -277,12 +277,12 @@ int64 juce_fileGetPosition (void* handle)
return jmax ((int64) 0, li.QuadPart);
}
void juce_fileFlush (void* handle)
void juce_fileFlush (void* handle) throw()
{
FlushFileBuffers ((HANDLE) handle);
}
int64 juce_getFileSize (const String& fileName)
int64 juce_getFileSize (const String& fileName) throw()
{
void* const handle = juce_fileOpen (fileName, false);
@ -324,7 +324,7 @@ static void timeToFileTime (const int64 time, FILETIME* const ft) throw()
void juce_getFileTimes (const String& fileName,
int64& modificationTime,
int64& accessTime,
int64& creationTime)
int64& creationTime) throw()
{
creationTime = accessTime = modificationTime = 0;
void* const h = juce_fileOpen (fileName, false);
@ -347,7 +347,7 @@ void juce_getFileTimes (const String& fileName,
bool juce_setFileTimes (const String& fileName,
int64 modificationTime,
int64 accessTime,
int64 creationTime)
int64 creationTime) throw()
{
FILETIME m, a, c;
@ -377,7 +377,7 @@ bool juce_setFileTimes (const String& fileName,
//==============================================================================
// return '\0' separated list of strings
const StringArray juce_getFileSystemRoots()
const StringArray juce_getFileSystemRoots() throw()
{
TCHAR buffer [2048];
buffer[0] = 0;
@ -402,7 +402,7 @@ const StringArray juce_getFileSystemRoots()
//==============================================================================
const String juce_getVolumeLabel (const String& filenameOnVolume,
int& volumeSerialNumber)
int& volumeSerialNumber) throw()
{
TCHAR n [4];
n[0] = *(const TCHAR*) filenameOnVolume;
@ -440,7 +440,7 @@ int64 File::getBytesFreeOnVolume() const throw()
}
//==============================================================================
static unsigned int getWindowsDriveType (const String& fileName)
static unsigned int getWindowsDriveType (const String& fileName) throw()
{
TCHAR n[4];
n[0] = *(const TCHAR*) fileName;
@ -490,7 +490,7 @@ bool File::isOnRemovableDrive() const throw()
//==============================================================================
#define MAX_PATH_CHARS (MAX_PATH + 256)
static const File juce_getSpecialFolderPath (int type)
static const File juce_getSpecialFolderPath (int type) throw()
{
if (wSHGetSpecialFolderPathW != 0)
{
@ -577,7 +577,7 @@ const File File::getSpecialLocation (const SpecialLocationType type)
}
void juce_setCurrentExecutableFileName (const String&)
void juce_setCurrentExecutableFileName (const String&) throw()
{
// n/a on windows
}
@ -612,7 +612,7 @@ template <class FindDataType>
static void getFindFileInfo (FindDataType& findData,
String& filename, bool* const isDir, bool* const isHidden,
int64* const fileSize, Time* const modTime, Time* const creationTime,
bool* const isReadOnly)
bool* const isReadOnly) throw()
{
filename = findData.cFileName;
@ -638,7 +638,7 @@ static void getFindFileInfo (FindDataType& findData,
void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResult,
bool* isDir, bool* isHidden, int64* fileSize,
Time* modTime, Time* creationTime, bool* isReadOnly)
Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
String wc (directory);
@ -676,7 +676,7 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
bool juce_findFileNext (void* handle, String& resultFile,
bool* isDir, bool* isHidden, int64* fileSize,
Time* modTime, Time* creationTime, bool* isReadOnly)
Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{
if (wFindNextFileW != 0)
{
@ -703,14 +703,14 @@ bool juce_findFileNext (void* handle, String& resultFile,
return false;
}
void juce_findFileClose (void* handle)
void juce_findFileClose (void* handle) throw()
{
FindClose (handle);
}
//==============================================================================
bool juce_launchFile (const String& fileName,
const String& parameters)
const String& parameters) throw()
{
HINSTANCE hInstance = 0;

View file

@ -66,12 +66,12 @@ BEGIN_JUCE_NAMESPACE
extern void juce_updateMultiMonitorInfo(); // from WindowDriver
//==============================================================================
void Logger::outputDebugString (const String& text)
void Logger::outputDebugString (const String& text) throw()
{
OutputDebugString (text + T("\n"));
}
void Logger::outputDebugPrintf (const tchar* format, ...)
void Logger::outputDebugPrintf (const tchar* format, ...) throw()
{
String text;
va_list args;
@ -103,7 +103,7 @@ static struct _LogicalCpuInfo
#pragma intrinsic (__cpuid)
#pragma intrinsic (__rdtsc)
static unsigned int getCPUIDWord (int* familyModel = 0, int* extFeatures = 0)
static unsigned int getCPUIDWord (int* familyModel = 0, int* extFeatures = 0) throw()
{
int info [4];
__cpuid (info, 1);
@ -117,7 +117,7 @@ static unsigned int getCPUIDWord (int* familyModel = 0, int* extFeatures = 0)
return info[3];
}
const String SystemStats::getCpuVendor()
const String SystemStats::getCpuVendor() throw()
{
int info [4];
__cpuid (info, 0);
@ -223,7 +223,7 @@ const String SystemStats::getCpuVendor()
}
#endif
static void initLogicalCpuInfo()
static void initLogicalCpuInfo() throw()
{
int familyModelWord, extFeaturesWord;
int featuresWord = getCPUIDWord (&familyModelWord, &extFeaturesWord);
@ -305,35 +305,35 @@ static void initLogicalCpuInfo()
}
//==============================================================================
void juce_initialiseThreadEvents();
void juce_initialiseUnicodeFileFunctions();
void juce_initialiseThreadEvents() throw();
void juce_initialiseUnicodeFileFunctions() throw();
static struct JuceCpuProps
{
bool hasMMX : 1, hasSSE : 1, hasSSE2 : 1, has3DNow : 1;
} juce_CpuProps;
bool SystemStats::hasMMX()
bool SystemStats::hasMMX() throw()
{
return juce_CpuProps.hasMMX;
}
bool SystemStats::hasSSE()
bool SystemStats::hasSSE() throw()
{
return juce_CpuProps.hasSSE;
}
bool SystemStats::hasSSE2()
bool SystemStats::hasSSE2() throw()
{
return juce_CpuProps.hasSSE2;
}
bool SystemStats::has3DNow()
bool SystemStats::has3DNow() throw()
{
return juce_CpuProps.has3DNow;
}
void SystemStats::initialiseStats()
void SystemStats::initialiseStats() throw()
{
juce_initialiseUnicodeFileFunctions();
juce_initialiseThreadEvents();
@ -370,7 +370,7 @@ void SystemStats::initialiseStats()
}
//==============================================================================
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType() throw()
{
OSVERSIONINFO info;
info.dwOSVersionInfoSize = sizeof (info);
@ -380,12 +380,6 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
{
switch (info.dwMajorVersion)
{
case 3:
return WinNT351;
case 4:
return WinNT40;
case 5:
return (info.dwMinorVersion == 0) ? Win2000 : WinXP;
@ -393,52 +387,44 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
return WinVista;
default:
jassertfalse // !! not a supported OS!
break;
}
}
else if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
{
return (info.dwMinorVersion == 0) ? Win95 : Win98;
jassert (info.dwMinorVersion != 0); // !! still running on Windows 95??
return Win98;
}
return UnknownOS;
}
const String SystemStats::getOperatingSystemName()
const String SystemStats::getOperatingSystemName() throw()
{
const tchar* name = T("Unknown OS");
const char* name = "Unknown OS";
switch (getOperatingSystemType())
{
case WinVista:
name = "Windows Vista";
break;
case WinXP:
name = T("Windows XP");
name = "Windows XP";
break;
case Win2000:
name = T("Windows 2000");
name = "Windows 2000";
break;
case Win98:
name = T("Windows 98");
break;
case Win95:
name = T("Windows 95");
break;
case WinNT351:
name = T("Windows NT 3.51");
break;
case WinNT40:
name = T("Windows NT4");
break;
case WinVista:
name = T("Windows Vista");
name = "Windows 98";
break;
default:
jassertfalse // !! new type of OS?
break;
}
@ -446,19 +432,19 @@ const String SystemStats::getOperatingSystemName()
}
//==============================================================================
int SystemStats::getMemorySizeInMegabytes()
int SystemStats::getMemorySizeInMegabytes() throw()
{
MEMORYSTATUS mem;
GlobalMemoryStatus (&mem);
return (int) (mem.dwTotalPhys / (1024 * 1024)) + 1;
}
bool SystemStats::hasHyperThreading()
bool SystemStats::hasHyperThreading() throw()
{
return logicalCpuInfo.htAvailable;
}
int SystemStats::getNumPhysicalCpus()
int SystemStats::getNumPhysicalCpus() throw()
{
if (logicalCpuInfo.numPackages)
return logicalCpuInfo.numPackages;
@ -466,12 +452,12 @@ int SystemStats::getNumPhysicalCpus()
return getNumLogicalCpus();
}
int SystemStats::getNumLogicalCpus()
int SystemStats::getNumLogicalCpus() throw()
{
return systemInfo.dwNumberOfProcessors;
}
uint32 SystemStats::getPhysicalAffinityMask()
uint32 SystemStats::getPhysicalAffinityMask() throw()
{
return logicalCpuInfo.physicalAffinityMask;
}
@ -511,7 +497,7 @@ int64 Time::getHighResolutionTicksPerSecond() throw()
return hiResTicksPerSecond;
}
int64 SystemStats::getClockCycleCounter()
int64 SystemStats::getClockCycleCounter() throw()
{
#if JUCE_USE_INTRINSICS
// MS intrinsics version...
@ -550,7 +536,7 @@ int64 SystemStats::getClockCycleCounter()
#endif
}
int SystemStats::getCpuSpeedInMegaherz()
int SystemStats::getCpuSpeedInMegaherz() throw()
{
const int64 cycles = SystemStats::getClockCycleCounter();
const uint32 millis = Time::getMillisecondCounter();
@ -578,7 +564,7 @@ int SystemStats::getCpuSpeedInMegaherz()
//==============================================================================
bool Time::setSystemTimeToThisTime() const
bool Time::setSystemTimeToThisTime() const throw()
{
SYSTEMTIME st;
@ -597,7 +583,7 @@ bool Time::setSystemTimeToThisTime() const
&& SetLocalTime (&st) != 0;
}
int SystemStats::getPageSize()
int SystemStats::getPageSize() throw()
{
return systemInfo.dwPageSize;
}

View file

@ -118,7 +118,7 @@ void WaitableEvent::reset() const throw()
//==============================================================================
void JUCE_API juce_threadEntryPoint (void*);
static unsigned int __stdcall threadEntryProc (void* userData)
static unsigned int __stdcall threadEntryProc (void* userData) throw()
{
AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0),
GetCurrentThreadId(), TRUE);
@ -129,7 +129,7 @@ static unsigned int __stdcall threadEntryProc (void* userData)
return 0;
}
void* juce_createThread (void* userData)
void* juce_createThread (void* userData) throw()
{
unsigned int threadId;
@ -139,7 +139,7 @@ void* juce_createThread (void* userData)
0, &threadId);
}
void juce_killThread (void* handle)
void juce_killThread (void* handle) throw()
{
if (handle != 0)
{
@ -150,7 +150,7 @@ void juce_killThread (void* handle)
}
}
void juce_setCurrentThreadName (const String& name)
void juce_setCurrentThreadName (const String& name) throw()
{
#if JUCE_DEBUG && JUCE_MSVC
struct
@ -179,13 +179,13 @@ void juce_setCurrentThreadName (const String& name)
#endif
}
int Thread::getCurrentThreadId()
int Thread::getCurrentThreadId() throw()
{
return (int) GetCurrentThreadId();
}
// priority 1 to 10 where 5=normal, 1=low
void juce_setThreadPriority (void* threadHandle, int priority)
void juce_setThreadPriority (void* threadHandle, int priority) throw()
{
int pri = THREAD_PRIORITY_TIME_CRITICAL;
@ -215,17 +215,17 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
static HANDLE sleepEvent = 0;
void juce_initialiseThreadEvents()
void juce_initialiseThreadEvents() throw()
{
sleepEvent = CreateEvent (0, 0, 0, 0);
}
void Thread::yield()
void Thread::yield() throw()
{
Sleep (0);
}
void Thread::sleep (int millisecs)
void Thread::sleep (const int millisecs) throw()
{
if (millisecs >= 10)
{

View file

@ -110,7 +110,7 @@ static HPALETTE palette = 0;
static bool createPaletteIfNeeded = true;
static bool shouldDeactivateTitleBar = true;
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY);
static HICON JUCE_CALLTYPE createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY);
#define WM_TRAYNOTIFY WM_USER + 100
//==============================================================================
@ -232,8 +232,8 @@ public:
unsigned char* bitmapData;
//==============================================================================
WindowsBitmapImage (const PixelFormat format_,
const int w, const int h, const bool clearImage)
JUCE_CALLTYPE WindowsBitmapImage (const PixelFormat format_,
const int w, const int h, const bool clearImage)
: Image (format_, w, h)
{
jassert (format_ == RGB || format_ == ARGB);
@ -292,7 +292,7 @@ public:
imageData = bitmapData - (lineStride * (h - 1));
}
~WindowsBitmapImage()
JUCE_CALLTYPE ~WindowsBitmapImage()
{
DeleteDC (hdc);
DeleteObject (hBitmap);
@ -300,8 +300,8 @@ public:
}
void blitToWindow (HWND hwnd, HDC dc, const bool transparent,
int x, int y, const RectangleList& maskedRegion)
void JUCE_CALLTYPE blitToWindow (HWND hwnd, HDC dc, const bool transparent,
int x, int y, const RectangleList& maskedRegion) throw()
{
static HDRAWDIB hdd = 0;
static bool needToCreateDrawDib = true;
@ -424,7 +424,7 @@ long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp
//==============================================================================
static int currentModifiers = 0;
static void updateKeyModifiers()
static void JUCE_CALLTYPE updateKeyModifiers()
{
currentModifiers &= ~(ModifierKeys::shiftModifier
| ModifierKeys::ctrlModifier
@ -489,7 +489,7 @@ const ModifierKeys ModifierKeys::getCurrentModifiersRealtime()
return ModifierKeys (currentModifiers);
}
static int64 getMouseEventTime()
static int64 JUCE_CALLTYPE getMouseEventTime()
{
static int64 eventTimeOffset = 0;
static DWORD lastMessageTime = 0;
@ -510,8 +510,8 @@ class Win32ComponentPeer : public ComponentPeer
{
public:
//==============================================================================
Win32ComponentPeer (Component* const component,
const int windowStyleFlags)
JUCE_CALLTYPE Win32ComponentPeer (Component* const component,
const int windowStyleFlags)
: ComponentPeer (component, windowStyleFlags),
dontRepaint (false),
fullScreen (false),
@ -862,7 +862,7 @@ public:
}
//==============================================================================
static Win32ComponentPeer* getOwnerOfWindow (HWND h)
static Win32ComponentPeer* JUCE_CALLTYPE getOwnerOfWindow (HWND h)
{
if (h != 0 && GetWindowLongPtr (h, GWLP_USERDATA) == improbableWindowNumber)
return (Win32ComponentPeer*) GetWindowLongPtr (h, 8);
@ -941,18 +941,18 @@ private:
{
public:
//==============================================================================
TemporaryImage()
JUCE_CALLTYPE TemporaryImage()
: image (0)
{
}
~TemporaryImage()
JUCE_CALLTYPE ~TemporaryImage()
{
delete image;
}
//==============================================================================
WindowsBitmapImage* getImage (const bool transparent, const int w, const int h)
WindowsBitmapImage* JUCE_CALLTYPE getImage (const bool transparent, const int w, const int h)
{
const Image::PixelFormat format = transparent ? Image::ARGB : Image::RGB;
@ -992,7 +992,7 @@ private:
class WindowClassHolder : public DeletedAtShutdown
{
public:
WindowClassHolder()
JUCE_CALLTYPE WindowClassHolder()
: windowClassName (T("JUCE_"))
{
// this name has to be different for each app/dll instance because otherwise
@ -1047,7 +1047,7 @@ private:
}
}
~WindowClassHolder()
JUCE_CALLTYPE ~WindowClassHolder()
{
if (ComponentPeer::getNumPeers() == 0)
UnregisterClass (windowClassName, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle());
@ -1056,7 +1056,7 @@ private:
String windowClassName;
};
void createWindow()
void JUCE_CALLTYPE createWindow()
{
DWORD exstyle = WS_EX_ACCEPTFILES;
DWORD type = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
@ -1202,7 +1202,7 @@ private:
}
//==============================================================================
void handlePaintMessage()
void JUCE_CALLTYPE handlePaintMessage()
{
#if DEBUG_REPAINT_TIMES
const double paintStart = Time::getMillisecondCounterHiRes();
@ -1352,7 +1352,7 @@ private:
}
//==============================================================================
void doMouseMove (const int x, const int y)
void JUCE_CALLTYPE doMouseMove (const int x, const int y)
{
static uint32 lastMouseTime = 0;
// this can be set to throttle the mouse-messages to less than a
@ -1417,7 +1417,7 @@ private:
}
}
void doMouseDown (const int x, const int y, const WPARAM wParam)
void JUCE_CALLTYPE doMouseDown (const int x, const int y, const WPARAM wParam)
{
if (GetCapture() != hwnd)
SetCapture (hwnd);
@ -1441,7 +1441,7 @@ private:
handleMouseDown (x, y, getMouseEventTime());
}
void doMouseUp (const int x, const int y, const WPARAM wParam)
void JUCE_CALLTYPE doMouseUp (const int x, const int y, const WPARAM wParam)
{
int numButtons = 0;
@ -1479,7 +1479,7 @@ private:
handleMouseUp (oldModifiers, x, y, getMouseEventTime());
}
void doCaptureChanged()
void JUCE_CALLTYPE doCaptureChanged()
{
if (isDragging)
{
@ -1494,7 +1494,7 @@ private:
}
}
void doMouseExit()
void JUCE_CALLTYPE doMouseExit()
{
if (isMouseOver)
{
@ -1510,7 +1510,7 @@ private:
}
}
void doMouseWheel (const WPARAM wParam, const bool isVertical)
void JUCE_CALLTYPE doMouseWheel (const WPARAM wParam, const bool isVertical)
{
updateKeyModifiers();
@ -1522,7 +1522,7 @@ private:
}
//==============================================================================
void doKeyUp (const WPARAM key)
void JUCE_CALLTYPE doKeyUp (const WPARAM key)
{
updateKeyModifiers();
@ -1549,7 +1549,7 @@ private:
handleKeyUpOrDown();
}
void doKeyDown (const WPARAM key)
void JUCE_CALLTYPE doKeyDown (const WPARAM key)
{
updateKeyModifiers();
@ -1637,7 +1637,7 @@ private:
}
}
void doKeyChar (int key, const LPARAM flags)
void JUCE_CALLTYPE doKeyChar (int key, const LPARAM flags)
{
updateKeyModifiers();
@ -1685,7 +1685,7 @@ private:
handleKeyPress (key, textChar);
}
bool doAppCommand (const LPARAM lParam)
bool JUCE_CALLTYPE doAppCommand (const LPARAM lParam)
{
int key = 0;
@ -1723,7 +1723,7 @@ private:
}
//==============================================================================
void doDroppedFiles (HDROP hdrop)
void JUCE_CALLTYPE doDroppedFiles (HDROP hdrop)
{
POINT p;
DragQueryPoint (hdrop, &p);
@ -1754,7 +1754,7 @@ private:
handleFilesDropped (p.x, p.y, files);
}
void doSettingChange()
void JUCE_CALLTYPE doSettingChange()
{
Desktop::getInstance().refreshMonitorSizes();
@ -1781,7 +1781,7 @@ public:
}
private:
LRESULT peerWindowProc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT JUCE_CALLTYPE peerWindowProc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
{
{
const MessageManagerLock messLock;
@ -2183,7 +2183,7 @@ void juce_setWindowStyleBit (HWND h, int styleType, int feature, bool bitIsSet)
//==============================================================================
bool Process::isForegroundProcess()
bool Process::isForegroundProcess() throw()
{
HWND fg = GetForegroundWindow();
@ -2259,7 +2259,7 @@ void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool c
}
//==============================================================================
static Image* createImageFromHBITMAP (HBITMAP bitmap)
static Image* JUCE_CALLTYPE createImageFromHBITMAP (HBITMAP bitmap)
{
Image* im = 0;
@ -2297,7 +2297,7 @@ static Image* createImageFromHBITMAP (HBITMAP bitmap)
return im;
}
static Image* createImageFromHICON (HICON icon)
static Image* JUCE_CALLTYPE createImageFromHICON (HICON icon)
{
ICONINFO info;
@ -2331,7 +2331,7 @@ static Image* createImageFromHICON (HICON icon)
return 0;
}
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY)
static HICON JUCE_CALLTYPE createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY)
{
HBITMAP mask = CreateBitmap (image.getWidth(), image.getHeight(), 1, 1, 0);
@ -2404,7 +2404,7 @@ Image* juce_createIconForFile (const File& file)
}
//==============================================================================
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY)
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) throw()
{
const int maxW = GetSystemMetrics (SM_CXCURSOR);
const int maxH = GetSystemMetrics (SM_CYCURSOR);
@ -2462,13 +2462,13 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
return cursorH;
}
void juce_deleteMouseCursor (void* cursorHandle, bool isStandard)
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) throw()
{
if (cursorHandle != 0 && ! isStandard)
DestroyCursor ((HCURSOR) cursorHandle);
}
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type)
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw()
{
LPCTSTR cursorName = IDC_ARROW;
@ -2834,7 +2834,7 @@ public:
HRESULT __stdcall EnumDAdvise (IEnumSTATDATA __RPC_FAR *__RPC_FAR *) { return OLE_E_ADVISENOTSUPPORTED; }
};
static HDROP createHDrop (const StringArray& fileNames)
static HDROP JUCE_CALLTYPE createHDrop (const StringArray& fileNames)
{
int totalChars = 0;
for (int i = fileNames.size(); --i >= 0;)
@ -2882,7 +2882,7 @@ static HDROP createHDrop (const StringArray& fileNames)
return hDrop;
}
static bool performDragDrop (FORMATETC* format, STGMEDIUM* medium, const DWORD whatToDo)
static bool JUCE_CALLTYPE performDragDrop (FORMATETC* format, STGMEDIUM* medium, const DWORD whatToDo)
{
JuceDropSource* const source = new JuceDropSource();
JuceDataObject* const data = new JuceDataObject (source, format, medium, 1);