From ba3e966984bc8864bccb247daa9d78d5165e13bf Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 8 Jan 2011 16:05:32 +0000 Subject: Code clean-up (cpplint). git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2796 a436a847-0d15-0410-975c-d299462d15a1 --- raul/ArrayStack.hpp | 7 ++++--- raul/AtomLiblo.hpp | 4 +++- raul/Configuration.hpp | 7 ++++--- raul/List.hpp | 6 ++++-- raul/MIDISink.hpp | 2 +- raul/Path.hpp | 1 - raul/Process.hpp | 11 +++++++---- raul/RingBuffer.hpp | 2 +- raul/SMFWriter.hpp | 2 ++ raul/SRMWQueue.hpp | 2 ++ raul/SRSWQueue.hpp | 2 ++ raul/SharedPtr.hpp | 28 ++++++++++------------------ raul/Symbol.hpp | 7 ++++--- raul/Table.hpp | 7 +++++-- raul/TableImpl.hpp | 7 +++++-- raul/Thread.hpp | 4 +++- raul/TimeSlice.hpp | 2 ++ raul/log.hpp | 1 + raul/midi_events.h | 4 ++++ raul/midi_names.h | 2 +- src/Configuration.cpp | 6 +++++- src/Path.cpp | 4 +++- src/SMFReader.cpp | 17 ++++++++++------- src/SMFWriter.cpp | 29 +++++++++++++++++------------ src/Symbol.cpp | 4 +++- src/Thread.cpp | 4 +++- src/log.cpp | 2 ++ 27 files changed, 108 insertions(+), 66 deletions(-) diff --git a/raul/ArrayStack.hpp b/raul/ArrayStack.hpp index 2204b69..6d34426 100644 --- a/raul/ArrayStack.hpp +++ b/raul/ArrayStack.hpp @@ -18,11 +18,12 @@ #ifndef RAUL_ARRAYSTACK_HPP #define RAUL_ARRAYSTACK_HPP -#include "raul/Array.hpp" +#include #include #include -#include -#include "Deletable.hpp" + +#include "raul/Array.hpp" +#include "raul/Deletable.hpp" namespace Raul { diff --git a/raul/AtomLiblo.hpp b/raul/AtomLiblo.hpp index 02bbee9..87a5dda 100644 --- a/raul/AtomLiblo.hpp +++ b/raul/AtomLiblo.hpp @@ -18,8 +18,10 @@ #ifndef RAUL_ATOM_LIBLO_HPP #define RAUL_ATOM_LIBLO_HPP -#include #include + +#include + #include "raul/log.hpp" #include "raul/Atom.hpp" diff --git a/raul/Configuration.hpp b/raul/Configuration.hpp index e26de9d..c851d08 100644 --- a/raul/Configuration.hpp +++ b/raul/Configuration.hpp @@ -18,11 +18,12 @@ #ifndef RAUL_CONFIGURATION_HPP #define RAUL_CONFIGURATION_HPP -#include -#include +#include #include +#include #include -#include +#include + #include "raul/Atom.hpp" namespace Raul { diff --git a/raul/List.hpp b/raul/List.hpp index 27e88f5..aa4ddb3 100644 --- a/raul/List.hpp +++ b/raul/List.hpp @@ -20,10 +20,12 @@ #include #include + #include -#include "raul/Deletable.hpp" -#include "raul/AtomicPtr.hpp" + #include "raul/AtomicInt.hpp" +#include "raul/AtomicPtr.hpp" +#include "raul/Deletable.hpp" namespace Raul { diff --git a/raul/MIDISink.hpp b/raul/MIDISink.hpp index 23815f6..6d39823 100644 --- a/raul/MIDISink.hpp +++ b/raul/MIDISink.hpp @@ -31,7 +31,7 @@ class MIDISink : public Deletable { public: virtual void write_event(TimeStamp time, size_t ev_size, - const uint8_t* ev) throw (std::logic_error) = 0; + const uint8_t* ev) = 0; }; diff --git a/raul/Path.hpp b/raul/Path.hpp index ce94cae..e59da60 100644 --- a/raul/Path.hpp +++ b/raul/Path.hpp @@ -96,7 +96,6 @@ public: */ Path(const char* cpath); - /** Construct a Path from another path. * * This is faster than constructing a path from the other path's string diff --git a/raul/Process.hpp b/raul/Process.hpp index f9f12b0..f0ceffc 100644 --- a/raul/Process.hpp +++ b/raul/Process.hpp @@ -18,12 +18,15 @@ #ifndef RAUL_PROCESS_HPP #define RAUL_PROCESS_HPP -#include -#include -#include -#include #include +#include +#include + +#include +#include + #include + #include "raul/log.hpp" namespace Raul { diff --git a/raul/RingBuffer.hpp b/raul/RingBuffer.hpp index 4bae30a..e2647fc 100644 --- a/raul/RingBuffer.hpp +++ b/raul/RingBuffer.hpp @@ -21,8 +21,8 @@ #include #include -#include #include +#include #include #include diff --git a/raul/SMFWriter.hpp b/raul/SMFWriter.hpp index 4643624..ae62a1d 100644 --- a/raul/SMFWriter.hpp +++ b/raul/SMFWriter.hpp @@ -19,6 +19,8 @@ #define RAUL_SMF_WRITER_HPP #include +#include + #include "raul/MIDISink.hpp" #include "raul/TimeStamp.hpp" diff --git a/raul/SRMWQueue.hpp b/raul/SRMWQueue.hpp index 7257ec3..82606f2 100644 --- a/raul/SRMWQueue.hpp +++ b/raul/SRMWQueue.hpp @@ -21,7 +21,9 @@ #include #include #include + #include + #include "raul/AtomicInt.hpp" namespace Raul { diff --git a/raul/SRSWQueue.hpp b/raul/SRSWQueue.hpp index e089f07..0b843bc 100644 --- a/raul/SRSWQueue.hpp +++ b/raul/SRSWQueue.hpp @@ -19,7 +19,9 @@ #define RAUL_SRSW_QUEUE_HPP #include + #include + #include "raul/AtomicInt.hpp" namespace Raul { diff --git a/raul/SharedPtr.hpp b/raul/SharedPtr.hpp index 8e803ed..ae41b17 100644 --- a/raul/SharedPtr.hpp +++ b/raul/SharedPtr.hpp @@ -18,33 +18,25 @@ #ifndef RAUL_SHARED_PTR_HPP #define RAUL_SHARED_PTR_HPP +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS +#include #include #include - -#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS #include -#include -#include +#include -static std::list shared_ptr_counters; +static std::set shared_ptr_counters; // Use debug hooks to ensure 2 shared_ptrs never point to the same thing namespace boost { - - inline void sp_scalar_constructor_hook(void* object, unsigned long cnt, void* ptr) { - assert(std::find(shared_ptr_counters.begin(), shared_ptr_counters.end(), - (void*)object) == shared_ptr_counters.end()); - shared_ptr_counters.push_back(object); - //std::cerr << "Creating SharedPtr to " - // << object << ", count = " << cnt << std::endl; + inline void sp_scalar_constructor_hook(void* px, std::size_t size, void* pn) { + assert(shared_ptr_counters.find(px) == shared_ptr_counters.end()); + shared_ptr_counters.push_back(px); } - inline void sp_scalar_destructor_hook(void* object, unsigned long cnt, void* ptr) { - shared_ptr_counters.remove(object); - //std::cerr << "Destroying SharedPtr to " - // << object << ", count = " << cnt << std::endl; + inline void sp_scalar_destructor_hook(void* px, std::size_t size, void* pn) { + shared_ptr_counters.remove(px); } - } #endif // BOOST_SP_ENABLE_DEBUG_HOOKS @@ -52,7 +44,7 @@ namespace boost { #include #ifdef BOOST_AC_USE_PTHREADS -#error "Boost is using mutex locking for pointer reference counting." +#error "Boost is using mutexes for shared_ptr reference counting." #error "This is VERY slow. Please report your platform to d@drobilla.net" #endif diff --git a/raul/Symbol.hpp b/raul/Symbol.hpp index 7c650ee..735d901 100644 --- a/raul/Symbol.hpp +++ b/raul/Symbol.hpp @@ -18,11 +18,12 @@ #ifndef RAUL_SYMBOL_HPP #define RAUL_SYMBOL_HPP -#include +#include #include -#include #include -#include +#include +#include + #include namespace Raul { diff --git a/raul/Table.hpp b/raul/Table.hpp index 177b2d9..79817ed 100644 --- a/raul/Table.hpp +++ b/raul/Table.hpp @@ -18,10 +18,13 @@ #ifndef RAUL_TABLE_HPP #define RAUL_TABLE_HPP -#include #include +#include +#include + #include -#include "SharedPtr.hpp" + +#include "raul/SharedPtr.hpp" //#define TABLE_SORT_DEBUG diff --git a/raul/TableImpl.hpp b/raul/TableImpl.hpp index 3c53385..e123e6e 100644 --- a/raul/TableImpl.hpp +++ b/raul/TableImpl.hpp @@ -18,10 +18,13 @@ #ifndef RAUL_TABLE_IMPL_HPP #define RAUL_TABLE_IMPL_HPP -#include -#include #include +#include #include +#include +#include +#include + #include "raul/Table.hpp" namespace Raul { diff --git a/raul/Thread.hpp b/raul/Thread.hpp index 757b791..b81d32a 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -18,10 +18,12 @@ #ifndef RAUL_THREAD_HPP #define RAUL_THREAD_HPP +#include #include #include -#include + #include + #include namespace Raul { diff --git a/raul/TimeSlice.hpp b/raul/TimeSlice.hpp index 901b3db..cd8381f 100644 --- a/raul/TimeSlice.hpp +++ b/raul/TimeSlice.hpp @@ -20,7 +20,9 @@ #include #include + #include + #include "raul/TimeStamp.hpp" namespace Raul { diff --git a/raul/log.hpp b/raul/log.hpp index f7e1253..187df64 100644 --- a/raul/log.hpp +++ b/raul/log.hpp @@ -20,6 +20,7 @@ #include #include +#include namespace Raul { diff --git a/raul/midi_events.h b/raul/midi_events.h index 1c786aa..a269c2a 100644 --- a/raul/midi_events.h +++ b/raul/midi_events.h @@ -1,6 +1,10 @@ /* Definitions to ease working with raw MIDI. + * Copyright (C) 2005-2011 David Robillard * * Adapted from ALSA's asounddef.h + * Copyright (C) 1998-2001 Jaroslav Kysela + * Abramo Bagnara + * Takashi Iwai * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/raul/midi_names.h b/raul/midi_names.h index cbc7ef6..205a8ec 100644 --- a/raul/midi_names.h +++ b/raul/midi_names.h @@ -20,7 +20,7 @@ #ifndef RAUL_MIDI_NAMES_H #define RAUL_MIDI_NAMES_H -#include "midi_events.h" +#include "raul/midi_events.h" #ifdef __cplusplus namespace Raul { diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 624274f..a471441 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -15,9 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include + #include "raul/Configuration.hpp" -using namespace std; +using std::endl; +using std::string; namespace Raul { diff --git a/src/Path.cpp b/src/Path.cpp index de17cdf..9f1bcb7 100644 --- a/src/Path.cpp +++ b/src/Path.cpp @@ -15,9 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "raul/Path.hpp" -using namespace std; +using std::string; namespace Raul { diff --git a/src/SMFReader.cpp b/src/SMFReader.cpp index 6fda04a..5a20470 100644 --- a/src/SMFReader.cpp +++ b/src/SMFReader.cpp @@ -15,15 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include #include #include -#include +#include + #include "raul/log.hpp" #include "raul/SMFReader.hpp" #include "raul/midi_events.h" -using namespace std; +using std::endl; namespace Raul { @@ -90,10 +93,10 @@ SMFReader::~SMFReader() bool -SMFReader::open(const std::string& filename) throw (logic_error, UnsupportedTime) +SMFReader::open(const std::string& filename) throw (std::logic_error, UnsupportedTime) { if (_fd) - throw logic_error("Attempt to start new read while write in progress."); + throw std::logic_error("Attempt to start new read while write in progress."); info << "Opening SMF file " << filename << " for reading." << endl; @@ -148,10 +151,10 @@ bool SMFReader::seek_to_track(unsigned track) throw (std::logic_error) { if (track == 0) - throw logic_error("Seek to track 0 out of range (must be >= 1)"); + throw std::logic_error("Seek to track 0 out of range (must be >= 1)"); if (!_fd) - throw logic_error("Attempt to seek to track on unopened SMF file."); + throw std::logic_error("Attempt to seek to track on unopened SMF file."); unsigned track_pos = 0; @@ -210,7 +213,7 @@ SMFReader::read_event(size_t buf_len, throw (std::logic_error, PrematureEOF, CorruptFile) { if (_track == 0) - throw logic_error("Attempt to read from unopened SMF file"); + throw std::logic_error("Attempt to read from unopened SMF file"); if (!_fd || feof(_fd)) { return -1; diff --git a/src/SMFWriter.cpp b/src/SMFWriter.cpp index ebb1380..0c343b6 100644 --- a/src/SMFWriter.cpp +++ b/src/SMFWriter.cpp @@ -14,16 +14,21 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include + +#include #include +#include + #include -#include #include -#include +#include +#include +#include + #include "raul/log.hpp" #include "raul/SMFWriter.hpp" -using namespace std; +using std::endl; namespace Raul { @@ -63,10 +68,10 @@ SMFWriter::~SMFWriter() */ bool SMFWriter::start(const std::string& filename, - Raul::TimeStamp start_time) throw (logic_error) + Raul::TimeStamp start_time) throw (std::logic_error) { if (_fd) - throw logic_error("Attempt to start new write while write in progress."); + throw std::logic_error("Attempt to start new write while write in progress."); info << "Opening SMF file " << filename << " for writing." << endl; @@ -94,14 +99,14 @@ SMFWriter::start(const std::string& filename, void SMFWriter::write_event(Raul::TimeStamp time, size_t ev_size, - const unsigned char* ev) throw (logic_error) + const unsigned char* ev) throw (std::logic_error) { if (time < _start_time) - throw logic_error("Event time is before file start time"); + throw std::logic_error("Event time is before file start time"); else if (time < _last_ev_time) - throw logic_error("Event time not monotonically increasing"); + throw std::logic_error("Event time not monotonically increasing"); else if (time.unit() != _unit) - throw logic_error("Event has unexpected time unit"); + throw std::logic_error("Event has unexpected time unit"); Raul::TimeStamp delta_time = time; delta_time -= _start_time; @@ -141,10 +146,10 @@ SMFWriter::flush() void -SMFWriter::finish() throw (logic_error) +SMFWriter::finish() throw (std::logic_error) { if (!_fd) - throw logic_error("Attempt to finish write with no write in progress."); + throw std::logic_error("Attempt to finish write with no write in progress."); write_footer(); fclose(_fd); diff --git a/src/Symbol.cpp b/src/Symbol.cpp index fb6bf7f..2005074 100644 --- a/src/Symbol.cpp +++ b/src/Symbol.cpp @@ -15,10 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "raul/Symbol.hpp" #include "raul/Path.hpp" -using namespace std; +using std::string; namespace Raul { diff --git a/src/Thread.cpp b/src/Thread.cpp index 35cb569..d45f363 100644 --- a/src/Thread.cpp +++ b/src/Thread.cpp @@ -16,12 +16,14 @@ */ #include +#include + #include "raul/log.hpp" #include "raul/Thread.hpp" #define LOG(s) s << "[" << _name << "] " -using namespace std; +using std::endl; namespace Raul { diff --git a/src/log.cpp b/src/log.cpp index 01620ee..201f8f1 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -15,6 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "raul/log.hpp" #include "raul-config.h" -- cgit v1.2.1