From df5d50bcd8cfe3c36ed3646ddd34c54ae3287122 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 16 Apr 2012 17:54:42 +0100 Subject: [PATCH] Version number bump. --- modules/juce_audio_basics/juce_module_info | 2 +- modules/juce_audio_devices/juce_module_info | 2 +- modules/juce_audio_formats/juce_module_info | 2 +- .../juce_audio_plugin_client/juce_module_info | 2 +- .../juce_audio_processors/juce_module_info | 2 +- modules/juce_audio_utils/juce_module_info | 2 +- modules/juce_browser_plugin/juce_module_info | 2 +- modules/juce_core/files/juce_File.cpp | 133 +++++++----------- modules/juce_core/files/juce_File.h | 6 +- modules/juce_core/juce_module_info | 2 +- .../juce_core/system/juce_StandardHeader.h | 2 +- modules/juce_cryptography/juce_module_info | 2 +- modules/juce_data_structures/juce_module_info | 2 +- modules/juce_events/juce_module_info | 2 +- modules/juce_graphics/juce_module_info | 2 +- modules/juce_gui_basics/juce_module_info | 2 +- modules/juce_gui_extra/juce_module_info | 2 +- modules/juce_opengl/juce_module_info | 2 +- modules/juce_video/juce_module_info | 2 +- 19 files changed, 69 insertions(+), 104 deletions(-) diff --git a/modules/juce_audio_basics/juce_module_info b/modules/juce_audio_basics/juce_module_info index 72d15b8eb4..15121efa32 100644 --- a/modules/juce_audio_basics/juce_module_info +++ b/modules/juce_audio_basics/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_audio_basics", "name": "JUCE audio and midi data classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for audio buffer manipulation, midi message handling, synthesis, etc", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_audio_devices/juce_module_info b/modules/juce_audio_devices/juce_module_info index 38c01728b4..0fb684659b 100644 --- a/modules/juce_audio_devices/juce_module_info +++ b/modules/juce_audio_devices/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_audio_devices", "name": "JUCE audio and midi I/O device classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes to play and record from audio and midi i/o devices.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_audio_formats/juce_module_info b/modules/juce_audio_formats/juce_module_info index bbe5f32166..06165e175e 100644 --- a/modules/juce_audio_formats/juce_module_info +++ b/modules/juce_audio_formats/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_audio_formats", "name": "JUCE audio file format codecs", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for reading and writing various audio file formats.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_audio_plugin_client/juce_module_info b/modules/juce_audio_plugin_client/juce_module_info index d67ac51da9..3928c2486e 100644 --- a/modules/juce_audio_plugin_client/juce_module_info +++ b/modules/juce_audio_plugin_client/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_audio_plugin_client", "name": "JUCE audio plugin wrapper classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for building VST, RTAS and AU plugins.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_audio_processors/juce_module_info b/modules/juce_audio_processors/juce_module_info index 7d7b4ad4a2..aa10d2a084 100644 --- a/modules/juce_audio_processors/juce_module_info +++ b/modules/juce_audio_processors/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_audio_processors", "name": "JUCE audio plugin hosting classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for loading and playing VST, AU, or internally-generated audio processors.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_audio_utils/juce_module_info b/modules/juce_audio_utils/juce_module_info index e66bb6a6f8..7fc9919cf0 100644 --- a/modules/juce_audio_utils/juce_module_info +++ b/modules/juce_audio_utils/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_audio_utils", "name": "JUCE extra audio utility classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for audio-related GUI and miscellaneous tasks.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_browser_plugin/juce_module_info b/modules/juce_browser_plugin/juce_module_info index 36c5d8e94f..39e94c07b9 100644 --- a/modules/juce_browser_plugin/juce_module_info +++ b/modules/juce_browser_plugin/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_browser_plugin_client", "name": "JUCE browser plugin wrapper classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for building NPAPI and ActiveX browser plugins.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index c02e9288b7..33da2531aa 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -28,7 +28,7 @@ File::File (const String& fullPathName) { } -File File::createFileWithoutCheckingPath (const String& path) +File File::createFileWithoutCheckingPath (const String& path) noexcept { File f; f.fullPath = path; @@ -176,37 +176,19 @@ bool File::areFileNamesCaseSensitive() #endif } -bool File::operator== (const File& other) const +static int compareFilenames (const String& name1, const String& name2) noexcept { #if NAMES_ARE_CASE_SENSITIVE - return fullPath == other.fullPath; + return name1.compare (name2); #else - return fullPath.equalsIgnoreCase (other.fullPath); + return name1.compareIgnoreCase (name2); #endif } -bool File::operator!= (const File& other) const -{ - return ! operator== (other); -} - -bool File::operator< (const File& other) const -{ - #if NAMES_ARE_CASE_SENSITIVE - return fullPath < other.fullPath; - #else - return fullPath.compareIgnoreCase (other.fullPath) < 0; - #endif -} - -bool File::operator> (const File& other) const -{ - #if NAMES_ARE_CASE_SENSITIVE - return fullPath > other.fullPath; - #else - return fullPath.compareIgnoreCase (other.fullPath) > 0; - #endif -} +bool File::operator== (const File& other) const { return compareFilenames (fullPath, other.fullPath) == 0; } +bool File::operator!= (const File& other) const { return compareFilenames (fullPath, other.fullPath) != 0; } +bool File::operator< (const File& other) const { return compareFilenames (fullPath, other.fullPath) < 0; } +bool File::operator> (const File& other) const { return compareFilenames (fullPath, other.fullPath) > 0; } //============================================================================== bool File::setReadOnly (const bool shouldBeReadOnly, @@ -269,15 +251,14 @@ bool File::copyDirectoryTo (const File& newDirectory) const Array subFiles; findChildFiles (subFiles, File::findFiles, false); - int i; - for (i = 0; i < subFiles.size(); ++i) + for (int i = 0; i < subFiles.size(); ++i) if (! subFiles.getReference(i).copyFileTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) return false; subFiles.clear(); findChildFiles (subFiles, File::findDirectories, false); - for (i = 0; i < subFiles.size(); ++i) + for (int i = 0; i < subFiles.size(); ++i) if (! subFiles.getReference(i).copyDirectoryTo (newDirectory.getChildFile (subFiles.getReference(i).getFileName()))) return false; @@ -313,20 +294,10 @@ String File::getFileName() const return fullPath.substring (fullPath.lastIndexOfChar (separator) + 1); } -int File::hashCode() const -{ - return fullPath.hashCode(); -} - -int64 File::hashCode64() const -{ - return fullPath.hashCode64(); -} - String File::getFileNameWithoutExtension() const { const int lastSlash = fullPath.lastIndexOfChar (separator) + 1; - const int lastDot = fullPath.lastIndexOfChar ('.'); + const int lastDot = fullPath.lastIndexOfChar ('.'); if (lastDot > lastSlash) return fullPath.substring (lastSlash, lastDot); @@ -341,24 +312,18 @@ bool File::isAChildOf (const File& potentialParent) const const String ourPath (getPathUpToLastSlash()); - #if NAMES_ARE_CASE_SENSITIVE - if (potentialParent.fullPath == ourPath) - #else - if (potentialParent.fullPath.equalsIgnoreCase (ourPath)) - #endif - { + if (compareFilenames (potentialParent.fullPath, ourPath) == 0) return true; - } - else if (potentialParent.fullPath.length() >= ourPath.length()) - { + + if (potentialParent.fullPath.length() >= ourPath.length()) return false; - } - else - { - return getParentDirectory().isAChildOf (potentialParent); - } + + return getParentDirectory().isAChildOf (potentialParent); } +int File::hashCode() const { return fullPath.hashCode(); } +int64 File::hashCode64() const { return fullPath.hashCode64(); } + //============================================================================== bool File::isAbsolutePath (const String& path) { @@ -381,9 +346,7 @@ File File::getChildFile (String relativePath) const if (relativePath[0] == '.') { #if JUCE_WINDOWS - relativePath = relativePath.replaceCharacter ('/', '\\').trimStart(); - #else - relativePath = relativePath.trimStart(); + relativePath = relativePath.replaceCharacter ('/', '\\'); #endif while (relativePath[0] == '.') @@ -429,11 +392,16 @@ File File::getSiblingFile (const String& fileName) const //============================================================================== String File::descriptionOfSizeInBytes (const int64 bytes) { - if (bytes == 1) return "1 byte"; - else if (bytes < 1024) return String (bytes) + " bytes"; - else if (bytes < 1024 * 1024) return String (bytes / 1024.0, 1) + " KB"; - else if (bytes < 1024 * 1024 * 1024) return String (bytes / (1024.0 * 1024.0), 1) + " MB"; - else return String (bytes / (1024.0 * 1024.0 * 1024.0), 1) + " GB"; + const char* suffix; + double divisor = 0; + + if (bytes == 1) { suffix = " byte"; } + else if (bytes < 1024) { suffix = " bytes"; } + else if (bytes < 1024 * 1024) { suffix = " KB"; divisor = 1024.0; } + else if (bytes < 1024 * 1024 * 1024) { suffix = " MB"; divisor = 1024.0 * 1024.0; } + else { suffix = " GB"; divisor = 1024.0 * 1024.0 * 1024.0; } + + return (divisor > 0 ? String (bytes / divisor, 1) : String (bytes)) + suffix; } //============================================================================== @@ -452,7 +420,6 @@ Result File::create() const if (r.wasOk()) { FileOutputStream fo (*this, 8); - r = fo.getStatus(); } @@ -542,26 +509,24 @@ int File::getNumberOfChildFiles (const int whatToLookFor, const String& wildCard bool File::containsSubDirectories() const { - if (isDirectory()) - { - DirectoryIterator di (*this, false, "*", findDirectories); - return di.next(); - } + if (! isDirectory()) + return false; - return false; + DirectoryIterator di (*this, false, "*", findDirectories); + return di.next(); } //============================================================================== -File File::getNonexistentChildFile (const String& prefix_, +File File::getNonexistentChildFile (const String& suggestedPrefix, const String& suffix, bool putNumbersInBrackets) const { - File f (getChildFile (prefix_ + suffix)); + File f (getChildFile (suggestedPrefix + suffix)); if (f.exists()) { - int num = 2; - String prefix (prefix_); + int number = 1; + String prefix (suggestedPrefix); // remove any bracketed numbers that may already be on the end.. if (prefix.trim().endsWithChar (')')) @@ -575,23 +540,23 @@ File File::getNonexistentChildFile (const String& prefix_, && closeBracks > openBracks && prefix.substring (openBracks + 1, closeBracks).containsOnly ("0123456789")) { - num = prefix.substring (openBracks + 1, closeBracks).getIntValue() + 1; + number = prefix.substring (openBracks + 1, closeBracks).getIntValue(); prefix = prefix.substring (0, openBracks); } } // also use brackets if it ends in a digit. putNumbersInBrackets = putNumbersInBrackets - || CharacterFunctions::isDigit (prefix.getLastCharacter()); + || CharacterFunctions::isDigit (prefix.getLastCharacter()); do { String newName (prefix); if (putNumbersInBrackets) - newName << '(' << num++ << ')'; + newName << '(' << ++number << ')'; else - newName << num++; + newName << ++number; f = getChildFile (newName + suffix); @@ -603,12 +568,12 @@ File File::getNonexistentChildFile (const String& prefix_, File File::getNonexistentSibling (const bool putNumbersInBrackets) const { - if (exists()) - return getParentDirectory() - .getNonexistentChildFile (getFileNameWithoutExtension(), - getFileExtension(), - putNumbersInBrackets); - return *this; + if (! exists()) + return *this; + + return getParentDirectory().getNonexistentChildFile (getFileNameWithoutExtension(), + getFileExtension(), + putNumbersInBrackets); } //============================================================================== @@ -658,7 +623,7 @@ File File::withFileExtension (const String& newExtension) const String filePart (getFileName()); - int i = filePart.lastIndexOfChar ('.'); + const int i = filePart.lastIndexOfChar ('.'); if (i >= 0) filePart = filePart.substring (0, i); diff --git a/modules/juce_core/files/juce_File.h b/modules/juce_core/files/juce_File.h index 2e10bc6703..cc0a38f4f5 100644 --- a/modules/juce_core/files/juce_File.h +++ b/modules/juce_core/files/juce_File.h @@ -60,7 +60,7 @@ public: You can use its operator= method to point it at a proper file. */ - File() {} + File() noexcept {} /** Creates a file from an absolute path. @@ -78,7 +78,7 @@ public: File (const File& other); /** Destructor. */ - ~File() {} + ~File() noexcept {} /** Sets the file based on an absolute pathname. @@ -925,7 +925,7 @@ public: Best to avoid this unless you really know what you're doing. */ - static File createFileWithoutCheckingPath (const String& path); + static File createFileWithoutCheckingPath (const String& path) noexcept; /** Adds a separator character to the end of a path if it doesn't already have one. */ static String addTrailingSeparator (const String& path); diff --git a/modules/juce_core/juce_module_info b/modules/juce_core/juce_module_info index 13faf669d8..4a7b76ea8d 100644 --- a/modules/juce_core/juce_module_info +++ b/modules/juce_core/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_core", "name": "JUCE core classes", - "version": "2.0.20", + "version": "2.0.21", "description": "The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_core/system/juce_StandardHeader.h b/modules/juce_core/system/juce_StandardHeader.h index 1cf5c183c2..aaf0533744 100644 --- a/modules/juce_core/system/juce_StandardHeader.h +++ b/modules/juce_core/system/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 2 #define JUCE_MINOR_VERSION 0 -#define JUCE_BUILDNUMBER 20 +#define JUCE_BUILDNUMBER 21 /** Current Juce version number. diff --git a/modules/juce_cryptography/juce_module_info b/modules/juce_cryptography/juce_module_info index e8d65f5c71..dec54028db 100644 --- a/modules/juce_cryptography/juce_module_info +++ b/modules/juce_cryptography/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_cryptography", "name": "JUCE cryptography classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for various basic cryptography functions, including RSA, Blowfish, MD5, SHA, etc.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_data_structures/juce_module_info b/modules/juce_data_structures/juce_module_info index d1ad2481be..e11e9310d0 100644 --- a/modules/juce_data_structures/juce_module_info +++ b/modules/juce_data_structures/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_data_structures", "name": "JUCE data model helper classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for undo/redo management, and smart data structures.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_events/juce_module_info b/modules/juce_events/juce_module_info index abfed0d207..2557a95560 100644 --- a/modules/juce_events/juce_module_info +++ b/modules/juce_events/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_events", "name": "JUCE message and event handling classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for running an application's main event loop and sending/receiving messages, timers, etc.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_graphics/juce_module_info b/modules/juce_graphics/juce_module_info index 3e15ad3d52..05ba43afa8 100644 --- a/modules/juce_graphics/juce_module_info +++ b/modules/juce_graphics/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_graphics", "name": "JUCE graphics classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for 2D vector graphics, image loading/saving, font handling, etc.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_gui_basics/juce_module_info b/modules/juce_gui_basics/juce_module_info index 1bdb3b516d..2c45b2d254 100644 --- a/modules/juce_gui_basics/juce_module_info +++ b/modules/juce_gui_basics/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_gui_basics", "name": "JUCE GUI core classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Basic user-interface components and related classes.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_gui_extra/juce_module_info b/modules/juce_gui_extra/juce_module_info index 2621a1e28e..dc140edc5a 100644 --- a/modules/juce_gui_extra/juce_module_info +++ b/modules/juce_gui_extra/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_gui_extra", "name": "JUCE extended GUI classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Miscellaneous GUI classes for specialised tasks.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_opengl/juce_module_info b/modules/juce_opengl/juce_module_info index 8184cadf6d..68a5dfbcf9 100644 --- a/modules/juce_opengl/juce_module_info +++ b/modules/juce_opengl/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_opengl", "name": "JUCE OpenGL classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for rendering OpenGL in a JUCE window.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial", diff --git a/modules/juce_video/juce_module_info b/modules/juce_video/juce_module_info index 59192e6204..1e3c1a3d70 100644 --- a/modules/juce_video/juce_module_info +++ b/modules/juce_video/juce_module_info @@ -1,7 +1,7 @@ { "id": "juce_video", "name": "JUCE video playback and capture classes", - "version": "2.0.20", + "version": "2.0.21", "description": "Classes for playing video and capturing camera input.", "website": "http://www.juce.com/juce", "license": "GPL/Commercial",