diff options
author | Max Kellermann <max@musicpd.org> | 2018-12-28 17:05:06 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-12-28 17:06:01 +0100 |
commit | 53a4de35c4c4a1629a9367f4c9daa421c4316587 (patch) | |
tree | 6987c40ce00deafdd3d1450f740fa912d71626aa | |
parent | 22e6d95c4bbae15dd7f635eabe5fdde1ce06ba73 (diff) |
util/DynamicFifoBuffer: add `noexcept`
-rw-r--r-- | src/util/DynamicFifoBuffer.hxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/util/DynamicFifoBuffer.hxx b/src/util/DynamicFifoBuffer.hxx index 3d64b4cf4..ede6ad537 100644 --- a/src/util/DynamicFifoBuffer.hxx +++ b/src/util/DynamicFifoBuffer.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2015 Max Kellermann <max.kellermann@gmail.com> + * Copyright 2003-2018 Max Kellermann <max.kellermann@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,9 +45,9 @@ public: typedef typename ForeignFifoBuffer<T>::const_pointer_type const_pointer_type; typedef typename ForeignFifoBuffer<T>::Range Range; - explicit DynamicFifoBuffer(size_type _capacity) + explicit DynamicFifoBuffer(size_type _capacity) noexcept :ForeignFifoBuffer<T>(new T[_capacity], _capacity) {} - ~DynamicFifoBuffer() { + ~DynamicFifoBuffer() noexcept { delete[] GetBuffer(); } @@ -63,7 +63,7 @@ public: using ForeignFifoBuffer<T>::Write; using ForeignFifoBuffer<T>::Append; - void Grow(size_type new_capacity) { + void Grow(size_type new_capacity) noexcept { assert(new_capacity > GetCapacity()); T *old_data = GetBuffer(); @@ -72,7 +72,7 @@ public: delete[] old_data; } - void WantWrite(size_type n) { + void WantWrite(size_type n) noexcept { if (ForeignFifoBuffer<T>::WantWrite(n)) /* we already have enough space */ return; @@ -91,7 +91,7 @@ public: * Write data to the buffer, growing it as needed. Returns a * writable pointer. */ - pointer_type Write(size_type n) { + pointer_type Write(size_type n) noexcept { WantWrite(n); return Write().data; } @@ -99,7 +99,7 @@ public: /** * Append data to the buffer, growing it as needed. */ - void Append(const_pointer_type p, size_type n) { + void Append(const_pointer_type p, size_type n) noexcept { std::copy_n(p, n, Write(n)); Append(n); } |