posix/fd: increment iterators by sizeof(ValueT) not byte count
This commit is contained in:
parent
db4f09628f
commit
1f270f760f
12
posix/fd.hpp
12
posix/fd.hpp
@ -11,12 +11,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Copyright 2017 Danny Robson <danny@nerdcruft.net>
|
||||
* Copyright 2017-2018 Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
#ifndef __CRUFT_UTIL_POSIX_FD_HPP
|
||||
#define __CRUFT_UTIL_POSIX_FD_HPP
|
||||
#ifndef CRUFT_UTIL_POSIX_FD_HPP
|
||||
#define CRUFT_UTIL_POSIX_FD_HPP
|
||||
|
||||
#include "../debug.hpp"
|
||||
#include "../view.hpp"
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -99,9 +100,12 @@ namespace util::posix {
|
||||
const ValueT*
|
||||
write (const util::view<const ValueT*> &src)
|
||||
{
|
||||
return src.begin () + write (
|
||||
const auto written = write (
|
||||
&*std::data (src), std::size (src) * sizeof (ValueT)
|
||||
);
|
||||
|
||||
CHECK_MOD (written, sizeof (ValueT));
|
||||
return src.begin () + written / sizeof (ValueT);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user