Skip to content

Commit

Permalink
Created ojph_threads. Rename socket to sockets, and fixed a warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
aous72 committed Apr 22, 2024
1 parent 11800fb commit 7fdd911
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 11 deletions.
File renamed without changes.
54 changes: 54 additions & 0 deletions src/apps/common/ojph_threads.h
Original file line number Diff line number Diff line change
@@ -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
12 changes: 7 additions & 5 deletions src/apps/ojph_stream_expand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ojph_stream_expand/ojph_stream_expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <iostream>
#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
Expand Down
2 changes: 1 addition & 1 deletion src/apps/ojph_stream_expand/stream_expand_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//***************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/apps/ojph_stream_expand/stream_expand_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//***************************************************************************/
Expand All @@ -41,7 +41,7 @@
#include <atomic>
#include "ojph_base.h"
#include "ojph_file.h"
#include "ojph_socket.h"
#include "ojph_sockets.h"

namespace ojph
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <cassert>
#include <string.h>
#include "ojph_message.h"
#include "ojph_socket.h"
#include "ojph_sockets.h"

int ojph_socket_manager_counter = 0;

Expand Down
38 changes: 38 additions & 0 deletions src/apps/others/ojph_threads.cpp
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 4 additions & 1 deletion src/core/common/ojph_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
};
Expand Down

0 comments on commit 7fdd911

Please sign in to comment.