From 7fdd911c0bf10b56f29f744049d4c95879a12787 Mon Sep 17 00:00:00 2001 From: Aous Naman Date: Mon, 22 Apr 2024 13:06:20 +1000 Subject: [PATCH] Created ojph_threads. Rename socket to sockets, and fixed a warning. --- .../common/{ojph_socket.h => ojph_sockets.h} | 0 src/apps/common/ojph_threads.h | 54 +++++++++++++++++++ src/apps/ojph_stream_expand/CMakeLists.txt | 12 +++-- .../ojph_stream_expand/ojph_stream_expand.cpp | 2 +- .../stream_expand_support.cpp | 2 +- .../stream_expand_support.h | 4 +- .../{ojph_socket.cpp => ojph_sockets.cpp} | 2 +- src/apps/others/ojph_threads.cpp | 38 +++++++++++++ src/core/common/ojph_file.h | 5 +- 9 files changed, 108 insertions(+), 11 deletions(-) rename src/apps/common/{ojph_socket.h => ojph_sockets.h} (100%) create mode 100644 src/apps/common/ojph_threads.h rename src/apps/others/{ojph_socket.cpp => ojph_sockets.cpp} (99%) create mode 100644 src/apps/others/ojph_threads.cpp diff --git a/src/apps/common/ojph_socket.h b/src/apps/common/ojph_sockets.h similarity index 100% rename from src/apps/common/ojph_socket.h rename to src/apps/common/ojph_sockets.h diff --git a/src/apps/common/ojph_threads.h b/src/apps/common/ojph_threads.h new file mode 100644 index 0000000..8ea1b0d --- /dev/null +++ b/src/apps/common/ojph_threads.h @@ -0,0 +1,54 @@ +//***************************************************************************/ +// This software is released under the 2-Clause BSD license, included +// below. +// +// Copyright (c) 2024, Aous Naman +// Copyright (c) 2024, Kakadu Software Pty Ltd, Australia +// Copyright (c) 2024, The University of New South Wales, Australia +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//***************************************************************************/ +// This file is part of the OpenJPH software implementation. +// File: ojph_threads.h +// Author: Aous Naman +// Date: 22 April 2024 +//***************************************************************************/ + +#ifndef OJPH_THREADS_H +#define OJPH_THREADS_H + +namespace ojph +{ +namespace thds +{ + +} // !thds namespace +} // !ojph namespace + + + + + + +#endif // !OJPH_THREADS_H \ No newline at end of file diff --git a/src/apps/ojph_stream_expand/CMakeLists.txt b/src/apps/ojph_stream_expand/CMakeLists.txt index a32a3f8..bbc8105 100644 --- a/src/apps/ojph_stream_expand/CMakeLists.txt +++ b/src/apps/ojph_stream_expand/CMakeLists.txt @@ -8,14 +8,16 @@ if (OJPH_BUILD_STREAM_EXPAND) set(CMAKE_CXX_STANDARD 14) file(GLOB OJPH_STREAM_EXPAND "*.cpp") - file(GLOB OJPH_SOCKET "../others/ojph_socket.cpp") - file(GLOB OJPH_SOCKET_H "../common/ojph_socket.h") + file(GLOB OJPH_SOCKETS "../others/ojph_sockets.cpp") + file(GLOB OJPH_SOCKETS_H "../common/ojph_sockets.h") + file(GLOB OJPH_THREADS "../others/ojph_threads.cpp") + file(GLOB OJPH_THREADS_H "../common/ojph_threads.h") - list(APPEND SOURCES ${OJPH_STREAM_EXPAND} ${OJPH_SOCKET} ${OJPH_SOCKET_H}) + list(APPEND SOURCES ${OJPH_STREAM_EXPAND} ${OJPH_SOCKETS} ${OJPH_SOCKETS_H} ${OJPH_THREADS} ${OJPH_THREADS_H}) source_group("main" FILES ${OJPH_STREAM_EXPAND}) - source_group("others" FILES ${OJPH_SOCKET}) - source_group("common" FILES ${OJPH_SOCKET_H}) + source_group("others" FILES ${OJPH_SOCKETS} ${OJPH_THREADS}) + source_group("common" FILES ${OJPH_SOCKETS_H} ${OJPH_THREADS_H}) add_executable(ojph_stream_expand ${SOURCES}) if(MSVC) diff --git a/src/apps/ojph_stream_expand/ojph_stream_expand.cpp b/src/apps/ojph_stream_expand/ojph_stream_expand.cpp index 7e4f91a..cd0b458 100644 --- a/src/apps/ojph_stream_expand/ojph_stream_expand.cpp +++ b/src/apps/ojph_stream_expand/ojph_stream_expand.cpp @@ -38,7 +38,7 @@ #include #include "ojph_message.h" #include "ojph_arg.h" -#include "ojph_socket.h" +#include "ojph_sockets.h" #include "stream_expand_support.h" #ifdef OJPH_OS_WINDOWS diff --git a/src/apps/ojph_stream_expand/stream_expand_support.cpp b/src/apps/ojph_stream_expand/stream_expand_support.cpp index 0191ca6..05ebd60 100644 --- a/src/apps/ojph_stream_expand/stream_expand_support.cpp +++ b/src/apps/ojph_stream_expand/stream_expand_support.cpp @@ -30,7 +30,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************/ // This file is part of the OpenJPH software implementation. -// File: ojph_str_ex_support.h +// File: stream_expand_support.h // Author: Aous Naman // Date: 18 April 2024 //***************************************************************************/ diff --git a/src/apps/ojph_stream_expand/stream_expand_support.h b/src/apps/ojph_stream_expand/stream_expand_support.h index 6d3d01f..a9862be 100644 --- a/src/apps/ojph_stream_expand/stream_expand_support.h +++ b/src/apps/ojph_stream_expand/stream_expand_support.h @@ -30,7 +30,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //***************************************************************************/ // This file is part of the OpenJPH software implementation. -// File: ojph_str_ex_support.cpp +// File: stream_expand_support.cpp // Author: Aous Naman // Date: 18 April 2024 //***************************************************************************/ @@ -41,7 +41,7 @@ #include #include "ojph_base.h" #include "ojph_file.h" -#include "ojph_socket.h" +#include "ojph_sockets.h" namespace ojph { diff --git a/src/apps/others/ojph_socket.cpp b/src/apps/others/ojph_sockets.cpp similarity index 99% rename from src/apps/others/ojph_socket.cpp rename to src/apps/others/ojph_sockets.cpp index a1ce6f3..ef01a22 100644 --- a/src/apps/others/ojph_socket.cpp +++ b/src/apps/others/ojph_sockets.cpp @@ -38,7 +38,7 @@ #include #include #include "ojph_message.h" -#include "ojph_socket.h" +#include "ojph_sockets.h" int ojph_socket_manager_counter = 0; diff --git a/src/apps/others/ojph_threads.cpp b/src/apps/others/ojph_threads.cpp new file mode 100644 index 0000000..1672c0c --- /dev/null +++ b/src/apps/others/ojph_threads.cpp @@ -0,0 +1,38 @@ +//***************************************************************************/ +// This software is released under the 2-Clause BSD license, included +// below. +// +// Copyright (c) 2024, Aous Naman +// Copyright (c) 2024, Kakadu Software Pty Ltd, Australia +// Copyright (c) 2024, The University of New South Wales, Australia +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//***************************************************************************/ +// This file is part of the OpenJPH software implementation. +// File: ojph_threads.h +// Author: Aous Naman +// Date: 22 April 2024 +//***************************************************************************/ + +#include "ojph_threads.h" \ No newline at end of file diff --git a/src/core/common/ojph_file.h b/src/core/common/ojph_file.h index c4c8dc1..e82ebc4 100644 --- a/src/core/common/ojph_file.h +++ b/src/core/common/ojph_file.h @@ -85,7 +85,10 @@ namespace ojph { virtual size_t write(const void *ptr, size_t size) = 0; virtual si64 tell() { return 0; } virtual int seek(si64 offset, enum outfile_base::seek origin) - { return -1; /* always fail, to remind you to write an implementation */ } + { + ojph_unused(offset); ojph_unused(origin); + return -1; /* always fail, to remind you to write an implementation */ + } virtual void flush() {} virtual void close() {} };