From aa9a6dec89d33b69176124c739bd1898983e2115 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Mon, 9 Mar 2015 10:47:20 +0100 Subject: [PATCH] Fixed a few typos/style issues --- include/SFML/Audio/InputSoundFile.hpp | 14 +++++----- include/SFML/Audio/Music.hpp | 10 +++---- include/SFML/Audio/OutputSoundFile.hpp | 2 +- include/SFML/Audio/SoundBuffer.hpp | 16 ++++++------ include/SFML/Audio/SoundFileFactory.hpp | 22 +++++++++++----- include/SFML/Audio/SoundFileReader.hpp | 2 +- include/SFML/Audio/SoundFileWriter.hpp | 2 +- include/SFML/System/FileInputStream.hpp | 8 +++--- include/SFML/System/MemoryInputStream.hpp | 2 +- src/SFML/Audio/InputSoundFile.cpp | 2 +- src/SFML/Audio/SoundFileFactory.cpp | 2 +- src/SFML/Audio/SoundFileReaderFlac.hpp | 2 +- src/SFML/Audio/SoundFileReaderOgg.hpp | 2 +- src/SFML/Audio/SoundFileReaderWav.hpp | 2 +- src/SFML/Audio/SoundFileWriterFlac.hpp | 2 +- src/SFML/Audio/SoundFileWriterOgg.hpp | 2 +- src/SFML/Audio/SoundFileWriterWav.hpp | 2 +- src/SFML/System/FileInputStream.cpp | 32 +++++++++++------------ src/SFML/Window/iOS/SFAppDelegate.mm | 2 +- src/SFML/Window/iOS/SFView.mm | 2 +- src/SFML/Window/iOS/SFViewController.mm | 2 +- src/SFML/Window/iOS/VideoModeImpl.mm | 2 +- src/SFML/Window/iOS/WindowImplUIKit.mm | 2 +- 23 files changed, 72 insertions(+), 64 deletions(-) diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index 05d96a379..5e306aec8 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -45,7 +45,7 @@ class SoundFileReader; //////////////////////////////////////////////////////////// class SFML_AUDIO_API InputSoundFile : NonCopyable { -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor @@ -161,7 +161,7 @@ public : //////////////////////////////////////////////////////////// /// \brief Change the current read position to the given time offset /// - /// Using a time offset is handy but unprecise. If you need an accurate + /// Using a time offset is handy but imprecise. If you need an accurate /// result, consider using the overload which takes a sample offset. /// /// If the given time exceeds to total duration, this function jumps @@ -227,10 +227,10 @@ private: /// /* error */; /// /// // Print the sound attributes -/// std::cout << "duration: " << file.getDuration().asSeconds() << std::endl; -/// std::cout << "channels: " << file.getChannelCount() << std::endl; -/// std::cout << "sample rate: " << file.getSampleRate() << std::endl; -/// std::cout << "sample count: " << file.getSampleCount() << std::endl; +/// std::cout << "duration: " << file.getDuration().asSeconds() << std::endl; +/// std::cout << "channels: " << file.getChannelCount() << std::endl; +/// std::cout << "sample rate: " << file.getSampleRate() << std::endl; +/// std::cout << "sample count: " << file.getSampleCount() << std::endl; /// /// // Read and process batches of samples until the end of file is reached /// sf::Int16 samples[1024]; @@ -239,7 +239,7 @@ private: /// { /// count = file.read(samples, 1024); /// -/// // process, analyse, play, convert, or whatever +/// // process, analyze, play, convert, or whatever /// // you want to do with the samples... /// } /// while (count > 0); diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 66b3c3c45..a50272445 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -47,7 +47,7 @@ class InputStream; //////////////////////////////////////////////////////////// class SFML_AUDIO_API Music : public SoundStream { -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor @@ -87,7 +87,7 @@ public : /// of supported formats. /// Since the music is not loaded completely but rather streamed /// continuously, the \a data must remain available as long as the - /// music is playing (ie. you can't deallocate it right after calling + /// music is playing (i.e. you can't deallocate it right after calling /// this function). /// /// \param data Pointer to the file data in memory @@ -109,7 +109,7 @@ public : /// of supported formats. /// Since the music is not loaded completely but rather streamed /// continuously, the \a stream must remain alive as long as the - /// music is playing (ie. you can't destroy it right after calling + /// music is playing (i.e. you can't destroy it right after calling /// this function). /// /// \param stream Source stream to read from @@ -129,7 +129,7 @@ public : //////////////////////////////////////////////////////////// Time getDuration() const; -protected : +protected: //////////////////////////////////////////////////////////// /// \brief Request a new chunk of audio samples from the stream source @@ -152,7 +152,7 @@ protected : //////////////////////////////////////////////////////////// virtual void onSeek(Time timeOffset); -private : +private: //////////////////////////////////////////////////////////// /// \brief Initialize the internal state after loading a new music diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp index f848655a0..8f60498c3 100644 --- a/include/SFML/Audio/OutputSoundFile.hpp +++ b/include/SFML/Audio/OutputSoundFile.hpp @@ -43,7 +43,7 @@ class SoundFileWriter; //////////////////////////////////////////////////////////// class SFML_AUDIO_API OutputSoundFile : NonCopyable { -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index 41fd2b1db..42eda6faa 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -48,7 +48,7 @@ class InputStream; //////////////////////////////////////////////////////////// class SFML_AUDIO_API SoundBuffer : AlResource { -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor @@ -223,7 +223,7 @@ public : //////////////////////////////////////////////////////////// SoundBuffer& operator =(const SoundBuffer& right); -private : +private: friend class Sound; @@ -232,7 +232,7 @@ private : /// /// \param file Sound file providing access to the new loaded sound /// - /// \return True on succesful initialization, false on failure + /// \return True on successful initialization, false on failure /// //////////////////////////////////////////////////////////// bool initialize(InputSoundFile& file); @@ -291,7 +291,7 @@ private : /// A sound buffer holds the data of a sound, which is /// an array of audio samples. A sample is a 16 bits signed integer /// that defines the amplitude of the sound at a given time. -/// The sound is then restituted by playing these samples at +/// The sound is then reconstituted by playing these samples at /// a high rate (for example, 44100 samples per second is the /// standard rate used for playing CDs). In short, audio samples /// are like texture pixels, and a sf::SoundBuffer is similar to @@ -324,20 +324,20 @@ private : /// \code /// // Declare a new sound buffer /// sf::SoundBuffer buffer; -/// +/// /// // Load it from a file /// if (!buffer.loadFromFile("sound.wav")) /// { /// // error... /// } -/// +/// /// // Create a sound source and bind it to the buffer /// sf::Sound sound1; /// sound1.setBuffer(buffer); -/// +/// /// // Play the sound /// sound1.play(); -/// +/// /// // Create another sound source bound to the same buffer /// sf::Sound sound2; /// sound2.setBuffer(buffer); diff --git a/include/SFML/Audio/SoundFileFactory.hpp b/include/SFML/Audio/SoundFileFactory.hpp index 1c1ccf95b..bd346cc13 100644 --- a/include/SFML/Audio/SoundFileFactory.hpp +++ b/include/SFML/Audio/SoundFileFactory.hpp @@ -40,12 +40,12 @@ class SoundFileReader; class SoundFileWriter; //////////////////////////////////////////////////////////// -/// \brief Manages and instanciates sound file readers and writers +/// \brief Manages and instantiates sound file readers and writers /// //////////////////////////////////////////////////////////// class SFML_AUDIO_API SoundFileFactory { -public : +public: //////////////////////////////////////////////////////////// /// \brief Register a new reader @@ -84,7 +84,9 @@ public : static void unregisterWriter(); //////////////////////////////////////////////////////////// - /// \brief Instanciate the right reader for the given file on disk + /// \brief Instantiate the right reader for the given file on disk + /// + /// It's up to the caller to release the returned reader /// /// \param filename Path of the sound file /// @@ -96,7 +98,9 @@ public : static SoundFileReader* createReaderFromFilename(const std::string& filename); //////////////////////////////////////////////////////////// - /// \brief Instanciate the right codec for the given file in memory + /// \brief Instantiate the right codec for the given file in memory + /// + /// It's up to the caller to release the returned reader /// /// \param data Pointer to the file data in memory /// \param sizeInBytes Total size of the file data, in bytes @@ -109,7 +113,9 @@ public : static SoundFileReader* createReaderFromMemory(const void* data, std::size_t sizeInBytes); //////////////////////////////////////////////////////////// - /// \brief Instanciate the right codec for the given file in stream + /// \brief Instantiate the right codec for the given file in stream + /// + /// It's up to the caller to release the returned reader /// /// \param stream Source stream to read from /// @@ -121,7 +127,9 @@ public : static SoundFileReader* createReaderFromStream(InputStream& stream); //////////////////////////////////////////////////////////// - /// \brief Instanciate the right writer for the given file on disk + /// \brief Instantiate the right writer for the given file on disk + /// + /// It's up to the caller to release the returned writer /// /// \param filename Path of the sound file /// @@ -168,7 +176,7 @@ private: /// \ingroup audio /// /// This class is where all the sound file readers and writers are -/// registered. You should normally only need to use its regitration +/// registered. You should normally only need to use its registration /// and unregistration functions; readers/writers creation and manipulation /// are wrapped into the higher-level classes sf::InputSoundFile and /// sf::OutputSoundFile. diff --git a/include/SFML/Audio/SoundFileReader.hpp b/include/SFML/Audio/SoundFileReader.hpp index 8cd2ce252..549f50b6a 100644 --- a/include/SFML/Audio/SoundFileReader.hpp +++ b/include/SFML/Audio/SoundFileReader.hpp @@ -42,7 +42,7 @@ class InputStream; //////////////////////////////////////////////////////////// class SFML_AUDIO_API SoundFileReader { -public : +public: //////////////////////////////////////////////////////////// /// \brief Structure holding the audio properties of a sound file diff --git a/include/SFML/Audio/SoundFileWriter.hpp b/include/SFML/Audio/SoundFileWriter.hpp index a0de778c1..36a267840 100644 --- a/include/SFML/Audio/SoundFileWriter.hpp +++ b/include/SFML/Audio/SoundFileWriter.hpp @@ -40,7 +40,7 @@ namespace sf //////////////////////////////////////////////////////////// class SFML_AUDIO_API SoundFileWriter { -public : +public: //////////////////////////////////////////////////////////// /// \brief Virtual destructor diff --git a/include/SFML/System/FileInputStream.hpp b/include/SFML/System/FileInputStream.hpp index 4404fec58..a3b359204 100644 --- a/include/SFML/System/FileInputStream.hpp +++ b/include/SFML/System/FileInputStream.hpp @@ -52,7 +52,7 @@ namespace sf //////////////////////////////////////////////////////////// class SFML_SYSTEM_API FileInputStream : public InputStream { -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor /// @@ -120,10 +120,10 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// -#ifndef ANDROID - std::ifstream m_file; ///< Standard file stream -#else +#ifdef ANDROID sf::priv::ResourceStream *m_file; +#else + std::ifstream m_file; ///< Standard file stream #endif }; diff --git a/include/SFML/System/MemoryInputStream.hpp b/include/SFML/System/MemoryInputStream.hpp index fe4463c63..250466ce7 100644 --- a/include/SFML/System/MemoryInputStream.hpp +++ b/include/SFML/System/MemoryInputStream.hpp @@ -42,7 +42,7 @@ namespace sf //////////////////////////////////////////////////////////// class SFML_SYSTEM_API MemoryInputStream : public InputStream { -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/Audio/InputSoundFile.cpp b/src/SFML/Audio/InputSoundFile.cpp index 1b839073e..2f281f569 100644 --- a/src/SFML/Audio/InputSoundFile.cpp +++ b/src/SFML/Audio/InputSoundFile.cpp @@ -244,9 +244,9 @@ void InputSoundFile::close() if (m_streamOwned) { delete m_stream; - m_stream = NULL; m_streamOwned = false; } + m_stream = NULL; // Reset the sound file attributes m_sampleCount = 0; diff --git a/src/SFML/Audio/SoundFileFactory.cpp b/src/SFML/Audio/SoundFileFactory.cpp index 5719a6b4a..f773e26a7 100644 --- a/src/SFML/Audio/SoundFileFactory.cpp +++ b/src/SFML/Audio/SoundFileFactory.cpp @@ -38,7 +38,7 @@ namespace { - // register all the built-in readers and writers if not already done + // Register all the built-in readers and writers if not already done void ensureDefaultReadersWritersRegistered() { static bool registered = false; diff --git a/src/SFML/Audio/SoundFileReaderFlac.hpp b/src/SFML/Audio/SoundFileReaderFlac.hpp index f2f64eac5..ee9079a31 100644 --- a/src/SFML/Audio/SoundFileReaderFlac.hpp +++ b/src/SFML/Audio/SoundFileReaderFlac.hpp @@ -56,7 +56,7 @@ public: //////////////////////////////////////////////////////////// static bool check(InputStream& stream); -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/Audio/SoundFileReaderOgg.hpp b/src/SFML/Audio/SoundFileReaderOgg.hpp index 8d299521a..2b9917b86 100644 --- a/src/SFML/Audio/SoundFileReaderOgg.hpp +++ b/src/SFML/Audio/SoundFileReaderOgg.hpp @@ -54,7 +54,7 @@ public: //////////////////////////////////////////////////////////// static bool check(InputStream& stream); -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/Audio/SoundFileReaderWav.hpp b/src/SFML/Audio/SoundFileReaderWav.hpp index 9956b2b61..a52bc1f4e 100644 --- a/src/SFML/Audio/SoundFileReaderWav.hpp +++ b/src/SFML/Audio/SoundFileReaderWav.hpp @@ -54,7 +54,7 @@ public: //////////////////////////////////////////////////////////// static bool check(InputStream& stream); -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/Audio/SoundFileWriterFlac.hpp b/src/SFML/Audio/SoundFileWriterFlac.hpp index e8c39c35d..494656414 100644 --- a/src/SFML/Audio/SoundFileWriterFlac.hpp +++ b/src/SFML/Audio/SoundFileWriterFlac.hpp @@ -55,7 +55,7 @@ public: //////////////////////////////////////////////////////////// static bool check(const std::string& filename); -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/Audio/SoundFileWriterOgg.hpp b/src/SFML/Audio/SoundFileWriterOgg.hpp index 4088280d7..bac570d71 100644 --- a/src/SFML/Audio/SoundFileWriterOgg.hpp +++ b/src/SFML/Audio/SoundFileWriterOgg.hpp @@ -55,7 +55,7 @@ public: //////////////////////////////////////////////////////////// static bool check(const std::string& filename); -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/Audio/SoundFileWriterWav.hpp b/src/SFML/Audio/SoundFileWriterWav.hpp index 356be2ff1..d96b4d39f 100644 --- a/src/SFML/Audio/SoundFileWriterWav.hpp +++ b/src/SFML/Audio/SoundFileWriterWav.hpp @@ -55,7 +55,7 @@ public: //////////////////////////////////////////////////////////// static bool check(const std::string& filename); -public : +public: //////////////////////////////////////////////////////////// /// \brief Default constructor diff --git a/src/SFML/System/FileInputStream.cpp b/src/SFML/System/FileInputStream.cpp index ae6c87e75..ac84e3478 100644 --- a/src/SFML/System/FileInputStream.cpp +++ b/src/SFML/System/FileInputStream.cpp @@ -56,13 +56,13 @@ FileInputStream::~FileInputStream() //////////////////////////////////////////////////////////// bool FileInputStream::open(const std::string& filename) { -#ifndef ANDROID - m_file.open(filename.c_str(), std::ios::binary); - return m_file.good(); -#else +#ifdef ANDROID if (m_file) delete m_file; m_file = new sf::priv::ResourceStream(filename); +#else + m_file.open(filename.c_str(), std::ios::binary); + return m_file.good(); #endif } @@ -70,11 +70,11 @@ bool FileInputStream::open(const std::string& filename) //////////////////////////////////////////////////////////// Int64 FileInputStream::read(void* data, Int64 size) { -#ifndef ANDROID +#ifdef ANDROID + return m_file->read(data, size); +#else m_file.read(static_cast(data), size); return m_file.gcount(); -#else - return m_file->read(data, size); #endif } @@ -82,13 +82,13 @@ Int64 FileInputStream::read(void* data, Int64 size) //////////////////////////////////////////////////////////// Int64 FileInputStream::seek(Int64 position) { -#ifndef ANDROID +#ifdef ANDROID + return m_file->seek(position); +#else if (m_file.eof() || m_file.fail()) m_file.clear(); m_file.seekg(position); return tell(); -#else - return m_file->seek(position); #endif } @@ -96,10 +96,10 @@ Int64 FileInputStream::seek(Int64 position) //////////////////////////////////////////////////////////// Int64 FileInputStream::tell() { -#ifndef ANDROID - return m_file.tellg(); -#else +#ifdef ANDROID return m_file->tell(); +#else + return m_file.tellg(); #endif } @@ -107,14 +107,14 @@ Int64 FileInputStream::tell() //////////////////////////////////////////////////////////// Int64 FileInputStream::getSize() { -#ifndef ANDROID +#ifdef ANDROID + return m_file->getSize(); +#else std::ifstream::pos_type pos = m_file.tellg(); m_file.seekg(0, std::ios::end); std::ifstream::pos_type size = m_file.tellg(); m_file.seekg(pos); return size; -#else - return m_file->getSize(); #endif } diff --git a/src/SFML/Window/iOS/SFAppDelegate.mm b/src/SFML/Window/iOS/SFAppDelegate.mm index c16e55287..48ea2c36c 100644 --- a/src/SFML/Window/iOS/SFAppDelegate.mm +++ b/src/SFML/Window/iOS/SFAppDelegate.mm @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) +// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. diff --git a/src/SFML/Window/iOS/SFView.mm b/src/SFML/Window/iOS/SFView.mm index 7fbb34a52..56c129c4c 100644 --- a/src/SFML/Window/iOS/SFView.mm +++ b/src/SFML/Window/iOS/SFView.mm @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) +// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. diff --git a/src/SFML/Window/iOS/SFViewController.mm b/src/SFML/Window/iOS/SFViewController.mm index fa67cc2f5..01422974f 100644 --- a/src/SFML/Window/iOS/SFViewController.mm +++ b/src/SFML/Window/iOS/SFViewController.mm @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) +// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. diff --git a/src/SFML/Window/iOS/VideoModeImpl.mm b/src/SFML/Window/iOS/VideoModeImpl.mm index 737414d78..dd3d13487 100644 --- a/src/SFML/Window/iOS/VideoModeImpl.mm +++ b/src/SFML/Window/iOS/VideoModeImpl.mm @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) +// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. diff --git a/src/SFML/Window/iOS/WindowImplUIKit.mm b/src/SFML/Window/iOS/WindowImplUIKit.mm index e91232a04..3e7c833f3 100644 --- a/src/SFML/Window/iOS/WindowImplUIKit.mm +++ b/src/SFML/Window/iOS/WindowImplUIKit.mm @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2013 Laurent Gomila (laurent@sfml-dev.org) +// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software.