Commit 6b2b5af3 authored by Max Kellermann's avatar Max Kellermann

util/byte_reverse: convert to C++

parent f32fbd9e
...@@ -266,7 +266,7 @@ libutil_a_SOURCES = \ ...@@ -266,7 +266,7 @@ libutil_a_SOURCES = \
src/util/PeakBuffer.cxx src/util/PeakBuffer.hxx \ src/util/PeakBuffer.cxx src/util/PeakBuffer.hxx \
src/util/list.h \ src/util/list.h \
src/util/list_sort.c src/util/list_sort.h \ src/util/list_sort.c src/util/list_sort.h \
src/util/byte_reverse.c src/util/byte_reverse.h \ src/util/ByteReverse.cxx src/util/ByteReverse.hxx \
src/util/bit_reverse.c src/util/bit_reverse.h src/util/bit_reverse.c src/util/bit_reverse.h
# System library # System library
...@@ -1408,7 +1408,7 @@ test_run_inotify_LDADD = \ ...@@ -1408,7 +1408,7 @@ test_run_inotify_LDADD = \
endif endif
test_test_byte_reverse_SOURCES = \ test_test_byte_reverse_SOURCES = \
test/test_byte_reverse.c test/test_byte_reverse.cxx
test_test_byte_reverse_LDADD = \ test_test_byte_reverse_LDADD = \
libutil.a \ libutil.a \
$(GLIB_LIBS) $(GLIB_LIBS)
......
...@@ -22,12 +22,9 @@ ...@@ -22,12 +22,9 @@
#include "DecoderAPI.hxx" #include "DecoderAPI.hxx"
#include "InputStream.hxx" #include "InputStream.hxx"
#include "util/Error.hxx" #include "util/Error.hxx"
#include "util/ByteReverse.hxx"
#include "Log.hxx" #include "Log.hxx"
extern "C" {
#include "util/byte_reverse.h"
}
#include <glib.h> #include <glib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
......
...@@ -21,10 +21,7 @@ ...@@ -21,10 +21,7 @@
#include "PcmExport.hxx" #include "PcmExport.hxx"
#include "PcmDsdUsb.hxx" #include "PcmDsdUsb.hxx"
#include "PcmPack.hxx" #include "PcmPack.hxx"
#include "util/ByteReverse.hxx"
extern "C" {
#include "util/byte_reverse.h"
}
void void
PcmExport::Open(SampleFormat sample_format, unsigned _channels, PcmExport::Open(SampleFormat sample_format, unsigned _channels,
......
/* /*
* Copyright (C) 2003-2012 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "byte_reverse.h" #include "ByteReverse.hxx"
#include <glib.h> #include <glib.h>
#include <assert.h> #include <assert.h>
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
void void
reverse_bytes_16(uint16_t *dest, const uint16_t *src, const uint16_t *src_end) reverse_bytes_16(uint16_t *dest, const uint16_t *src, const uint16_t *src_end)
{ {
assert(dest != NULL); assert(dest != nullptr);
assert(src != NULL); assert(src != nullptr);
assert(src_end >= src); assert(src_end >= src);
while (src < src_end) { while (src < src_end) {
...@@ -38,8 +38,8 @@ reverse_bytes_16(uint16_t *dest, const uint16_t *src, const uint16_t *src_end) ...@@ -38,8 +38,8 @@ reverse_bytes_16(uint16_t *dest, const uint16_t *src, const uint16_t *src_end)
void void
reverse_bytes_32(uint32_t *dest, const uint32_t *src, const uint32_t *src_end) reverse_bytes_32(uint32_t *dest, const uint32_t *src, const uint32_t *src_end)
{ {
assert(dest != NULL); assert(dest != nullptr);
assert(src != NULL); assert(src != nullptr);
assert(src_end >= src); assert(src_end >= src);
while (src < src_end) { while (src < src_end) {
...@@ -51,8 +51,8 @@ reverse_bytes_32(uint32_t *dest, const uint32_t *src, const uint32_t *src_end) ...@@ -51,8 +51,8 @@ reverse_bytes_32(uint32_t *dest, const uint32_t *src, const uint32_t *src_end)
void void
reverse_bytes_64(uint64_t *dest, const uint64_t *src, const uint64_t *src_end) reverse_bytes_64(uint64_t *dest, const uint64_t *src, const uint64_t *src_end)
{ {
assert(dest != NULL); assert(dest != nullptr);
assert(src != NULL); assert(src != nullptr);
assert(src_end >= src); assert(src_end >= src);
while (src < src_end) { while (src < src_end) {
...@@ -75,8 +75,8 @@ reverse_bytes_generic(uint8_t *dest, ...@@ -75,8 +75,8 @@ reverse_bytes_generic(uint8_t *dest,
const uint8_t *src, const uint8_t *src_end, const uint8_t *src, const uint8_t *src_end,
size_t frame_size) size_t frame_size)
{ {
assert(dest != NULL); assert(dest != nullptr);
assert(src != NULL); assert(src != nullptr);
assert(src_end >= src); assert(src_end >= src);
assert(frame_size > 0); assert(frame_size > 0);
assert((src_end - src) % frame_size == 0); assert((src_end - src) % frame_size == 0);
...@@ -92,8 +92,8 @@ void ...@@ -92,8 +92,8 @@ void
reverse_bytes(uint8_t *dest, const uint8_t *src, const uint8_t *src_end, reverse_bytes(uint8_t *dest, const uint8_t *src, const uint8_t *src_end,
size_t frame_size) size_t frame_size)
{ {
assert(dest != NULL); assert(dest != nullptr);
assert(src != NULL); assert(src != nullptr);
assert(src_end >= src); assert(src_end >= src);
assert(frame_size > 0); assert(frame_size > 0);
assert((src_end - src) % frame_size == 0); assert((src_end - src) % frame_size == 0);
......
/* /*
* Copyright (C) 2003-2012 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef MPD_BYTE_REVERSE_H #ifndef MPD_BYTE_REVERSE_HXX
#define MPD_BYTE_REVERSE_H #define MPD_BYTE_REVERSE_HXX
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
......
/* /*
* Copyright (C) 2003-2012 The Music Player Daemon Project * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "util/byte_reverse.h" #include "util/ByteReverse.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include <glib.h> #include <glib.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment