Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
be1283e3
Commit
be1283e3
authored
Jul 27, 2018
by
Kip Warner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a lot of compiler warnings.
parent
957198b8
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
174 additions
and
92 deletions
+174
-92
CMakeLists.txt
CMakeLists.txt
+46
-0
include/pistache/async.h
include/pistache/async.h
+33
-33
include/pistache/common.h
include/pistache/common.h
+3
-0
include/pistache/cookie.h
include/pistache/cookie.h
+2
-2
include/pistache/description.h
include/pistache/description.h
+2
-2
include/pistache/flags.h
include/pistache/flags.h
+1
-1
include/pistache/http.h
include/pistache/http.h
+21
-18
include/pistache/iterator_adapter.h
include/pistache/iterator_adapter.h
+2
-2
include/pistache/mailbox.h
include/pistache/mailbox.h
+2
-2
include/pistache/optional.h
include/pistache/optional.h
+1
-1
include/pistache/os.h
include/pistache/os.h
+2
-2
include/pistache/reactor.h
include/pistache/reactor.h
+1
-1
include/pistache/router.h
include/pistache/router.h
+1
-1
include/pistache/stream.h
include/pistache/stream.h
+10
-10
include/pistache/transport.h
include/pistache/transport.h
+17
-17
include/pistache/version.h.in
include/pistache/version.h.in
+16
-0
libpistache.pc.in
libpistache.pc.in
+14
-0
No files found.
CMakeLists.txt
View file @
be1283e3
...
...
@@ -37,3 +37,49 @@ if (PISTACHE_BUILD_TESTS)
enable_testing
()
add_subdirectory
(
tests
)
endif
()
# Set version...
# Major and minor version...
set
(
VERSION_MAJOR 0
)
set
(
VERSION_MINOR 0
)
# Make available in a header file...
configure_file
(
"include/pistache/version.h.in"
"include/pistache/version.h"
@ONLY
)
# Install header...
install
(
FILES
${
CMAKE_BINARY_DIR
}
/include/pistache/version.h
DESTINATION
include/pistache/
)
# Configure the pkg-config metadata...
# Initialize the metadata variables to support remote builds...
set
(
prefix
${
CMAKE_INSTALL_PREFIX
}
)
set
(
exec_prefix
${
CMAKE_INSTALL_PREFIX
}
/bin
)
set
(
libdir
${
CMAKE_INSTALL_PREFIX
}
/lib
)
set
(
includedir
${
CMAKE_INSTALL_PREFIX
}
/include
)
set
(
version
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
)
# Perform substitutions...
configure_file
(
"libpistache.pc.in"
"libpistache.pc"
@ONLY
)
# Install pkg-config metadata into standard location within the prefix...
install
(
FILES
${
CMAKE_BINARY_DIR
}
/libpistache.pc
DESTINATION
lib/pkgconfig/
)
include/pistache/async.h
View file @
be1283e3
...
...
@@ -136,8 +136,8 @@ namespace Async {
namespace
Private
{
struct
InternalRethrow
{
InternalRethrow
(
std
::
exception_ptr
exc
)
:
exc
(
std
::
move
(
exc
))
InternalRethrow
(
std
::
exception_ptr
_
exc
)
:
exc
(
std
::
move
(
_
exc
))
{
}
std
::
exception_ptr
exc
;
...
...
@@ -166,9 +166,9 @@ namespace Async {
};
struct
Core
{
Core
(
State
state
,
TypeId
id
)
:
state
(
state
)
,
id
(
id
)
Core
(
State
_state
,
TypeId
_
id
)
:
state
(
_
state
)
,
id
(
_
id
)
{
}
State
state
;
...
...
@@ -839,9 +839,9 @@ namespace Async {
Deferred
(
Deferred
&&
other
)
=
default
;
Deferred
&
operator
=
(
Deferred
&&
other
)
=
default
;
Deferred
(
Resolver
resolver
,
Rejection
reject
)
:
resolver
(
std
::
move
(
resolver
))
,
rejection
(
std
::
move
(
reject
))
Deferred
(
Resolver
_resolver
,
Rejection
_
reject
)
:
resolver
(
std
::
move
(
_
resolver
))
,
rejection
(
std
::
move
(
_
reject
))
{
}
template
<
typename
U
>
...
...
@@ -888,9 +888,9 @@ namespace Async {
Deferred
(
Deferred
&&
other
)
=
default
;
Deferred
&
operator
=
(
Deferred
&&
other
)
=
default
;
Deferred
(
Resolver
resolver
,
Rejection
reject
)
:
resolver
(
std
::
move
(
resolver
))
,
rejection
(
std
::
move
(
reject
))
Deferred
(
Resolver
_resolver
,
Rejection
_
reject
)
:
resolver
(
std
::
move
(
_
resolver
))
,
rejection
(
std
::
move
(
_
reject
))
{
}
void
resolve
()
{
...
...
@@ -898,8 +898,8 @@ namespace Async {
}
template
<
typename
Exc
>
void
reject
(
Exc
exc
)
{
rejection
(
std
::
move
(
exc
));
void
reject
(
Exc
_
exc
)
{
rejection
(
std
::
move
(
_
exc
));
}
private:
...
...
@@ -1138,12 +1138,12 @@ namespace Async {
struct
All
{
struct
Data
{
Data
(
const
size_t
total
,
Resolver
resolver
,
Rejection
rejection
)
:
total
(
total
)
Data
(
const
size_t
_total
,
Resolver
_resolver
,
Rejection
_
rejection
)
:
total
(
_
total
)
,
resolved
(
0
)
,
rejected
(
false
)
,
resolve
(
std
::
move
(
resolver
))
,
reject
(
std
::
move
(
rejection
))
,
resolve
(
std
::
move
(
_
resolver
))
,
reject
(
std
::
move
(
_
rejection
))
{
}
const
size_t
total
;
...
...
@@ -1245,8 +1245,8 @@ namespace Async {
private:
template
<
typename
T
,
size_t
Index
,
typename
Data
>
struct
WhenContinuation
{
WhenContinuation
(
Data
data
)
:
data
(
std
::
move
(
data
))
WhenContinuation
(
Data
_
data
)
:
data
(
std
::
move
(
_
data
))
{
}
void
operator
()(
const
T
&
val
)
const
{
...
...
@@ -1258,8 +1258,8 @@ namespace Async {
template
<
size_t
Index
,
typename
Data
>
struct
WhenContinuation
<
void
,
Index
,
Data
>
{
WhenContinuation
(
Data
data
)
:
data
(
std
::
move
(
data
))
WhenContinuation
(
Data
_
data
)
:
data
(
std
::
move
(
_
data
))
{
}
void
operator
()()
const
{
...
...
@@ -1341,9 +1341,9 @@ namespace Async {
>
struct
WhenAllRange
{
WhenAllRange
(
Resolver
resolve
,
Rejection
reject
)
:
resolve
(
std
::
move
(
resolve
))
,
reject
(
std
::
move
(
reject
))
WhenAllRange
(
Resolver
_resolve
,
Rejection
_
reject
)
:
resolve
(
std
::
move
(
_
resolve
))
,
reject
(
std
::
move
(
_
reject
))
{
}
template
<
typename
Iterator
>
...
...
@@ -1373,12 +1373,12 @@ namespace Async {
private:
struct
Data
{
Data
(
size_t
total
,
Resolver
resolver
,
Rejection
rejection
)
:
total
(
total
)
Data
(
size_t
_total
,
Resolver
_resolver
,
Rejection
_
rejection
)
:
total
(
_
total
)
,
resolved
(
0
)
,
rejected
(
false
)
,
resolve
(
std
::
move
(
resolver
))
,
reject
(
std
::
move
(
rejection
))
,
resolve
(
std
::
move
(
_
resolver
))
,
reject
(
std
::
move
(
_
rejection
))
{
}
const
size_t
total
;
...
...
@@ -1419,9 +1419,9 @@ namespace Async {
typedef
std
::
shared_ptr
<
DataT
<
ValueType
>>
D
;
WhenContinuation
(
const
D
&
data
,
size_t
index
)
:
data
(
data
)
,
index
(
index
)
WhenContinuation
(
const
D
&
_data
,
size_t
_
index
)
:
data
(
_
data
)
,
index
(
_
index
)
{
}
void
operator
()(
const
ValueType
&
val
)
const
{
...
...
@@ -1444,8 +1444,8 @@ namespace Async {
typedef
std
::
shared_ptr
<
DataT
<
void
>>
D
;
WhenContinuation
(
const
D
&
data
,
size_t
)
:
data
(
data
)
WhenContinuation
(
const
D
&
_
data
,
size_t
)
:
data
(
_
data
)
{
}
void
operator
()()
const
{
...
...
include/pistache/common.h
View file @
be1283e3
...
...
@@ -49,6 +49,9 @@
#define unreachable() __builtin_unreachable()
// Until we require C++17 compiler with [[maybe_unused]]
#define UNUSED(x) (void)(x);
namespace
Pistache
{
namespace
Const
{
...
...
include/pistache/cookie.h
View file @
be1283e3
...
...
@@ -44,8 +44,8 @@ public:
typedef
std
::
unordered_map
<
std
::
string
,
Cookie
>
Storage
;
struct
iterator
:
std
::
iterator
<
std
::
bidirectional_iterator_tag
,
Cookie
>
{
iterator
(
const
Storage
::
const_iterator
&
iterator
)
:
it_
(
iterator
)
iterator
(
const
Storage
::
const_iterator
&
_
iterator
)
:
it_
(
_
iterator
)
{
}
Cookie
operator
*
()
const
{
...
...
include/pistache/description.h
View file @
be1283e3
...
...
@@ -379,8 +379,8 @@ public:
Description
&
basePath
(
std
::
string
value
);
template
<
typename
...
Schemes
>
Description
&
schemes
(
Schemes
...
schemes
)
{
Scheme
s
[
sizeof
...(
Schemes
)]
=
{
schemes
...
};
Description
&
schemes
(
Schemes
...
_
schemes
)
{
Scheme
s
[
sizeof
...(
Schemes
)]
=
{
_
schemes
...
};
std
::
copy
(
std
::
begin
(
s
),
std
::
end
(
s
),
std
::
back_inserter
(
schemes_
));
return
*
this
;
}
...
...
include/pistache/flags.h
View file @
be1283e3
...
...
@@ -58,7 +58,7 @@ public:
Flags
()
:
val
(
T
::
None
)
{
}
Flags
(
T
val
)
:
val
(
val
)
Flags
(
T
_val
)
:
val
(
_
val
)
{
}
...
...
include/pistache/http.h
View file @
be1283e3
...
...
@@ -230,19 +230,19 @@ public:
private:
Timeout
(
const
Timeout
&
other
)
:
transport
(
other
.
transport
)
,
handler
(
other
.
handler
)
:
handler
(
other
.
handler
)
,
request
(
other
.
request
)
,
transport
(
other
.
transport
)
,
armed
(
other
.
armed
)
,
timerFd
(
other
.
timerFd
)
{
}
Timeout
(
Tcp
::
Transport
*
transport
,
Handler
*
handler
,
Request
request
)
:
transport
(
transport
)
,
handler
(
handler
)
,
request
(
std
::
move
(
request
)
)
Timeout
(
Tcp
::
Transport
*
transport
_
,
Handler
*
handler
_
,
Request
request
_
)
:
handler
(
handler_
)
,
request
(
std
::
move
(
request_
)
)
,
transport
(
transport_
)
,
armed
(
false
)
,
timerFd
(
-
1
)
{
...
...
@@ -517,7 +517,8 @@ public:
return
&
buf_
;
}
DynamicStreamBuf
*
rdbuf
(
DynamicStreamBuf
*
other
)
{
DynamicStreamBuf
*
rdbuf
([[
maybe_unused
]]
DynamicStreamBuf
*
other
)
{
UNUSED
(
other
)
throw
std
::
domain_error
(
"Unimplemented"
);
}
...
...
@@ -613,9 +614,9 @@ namespace Private {
};
struct
BodyStep
:
public
Step
{
BodyStep
(
Message
*
message
)
:
Step
(
message
)
,
chunk
(
message
)
BodyStep
(
Message
*
message
_
)
:
Step
(
message
_
)
,
chunk
(
message
_
)
,
bytesRead
(
0
)
{
}
...
...
@@ -625,8 +626,8 @@ namespace Private {
struct
Chunk
{
enum
Result
{
Complete
,
Incomplete
,
Final
};
Chunk
(
Message
*
message
)
:
message
(
message
)
Chunk
(
Message
*
message
_
)
:
message
(
message
_
)
,
bytesRead
(
0
)
,
size
(
-
1
)
{
}
...
...
@@ -653,15 +654,17 @@ namespace Private {
struct
ParserBase
{
ParserBase
()
:
cur
rentStep
(
0
)
,
cur
sor
(
&
buffer
)
:
cur
sor
(
&
buffer
)
,
cur
rentStep
(
0
)
{
}
ParserBase
(
const
char
*
data
,
size_t
len
)
:
cur
rentStep
(
0
)
,
cur
sor
(
&
buffer
)
:
cur
sor
(
&
buffer
)
,
cur
rentStep
(
0
)
{
UNUSED
(
data
)
UNUSED
(
len
)
}
ParserBase
(
const
ParserBase
&
other
)
=
delete
;
...
...
include/pistache/iterator_adapter.h
View file @
be1283e3
...
...
@@ -14,8 +14,8 @@ struct FlatMapIteratorAdapter {
typedef
typename
Map
::
mapped_type
Value
;
typedef
typename
Map
::
const_iterator
const_iterator
;
FlatMapIteratorAdapter
(
const_iterator
it
)
:
it
(
it
)
FlatMapIteratorAdapter
(
const_iterator
_
it
)
:
it
(
_
it
)
{
}
FlatMapIteratorAdapter
operator
++
()
{
...
...
include/pistache/mailbox.h
View file @
be1283e3
...
...
@@ -90,14 +90,14 @@ public:
}
T
*
post
(
T
*
newData
)
{
auto
*
ret
=
Mailbox
<
T
>::
post
(
newData
);
auto
*
_
ret
=
Mailbox
<
T
>::
post
(
newData
);
if
(
isBound
())
{
uint64_t
val
=
1
;
TRY
(
write
(
event_fd
,
&
val
,
sizeof
val
));
}
return
ret
;
return
_
ret
;
}
T
*
clear
()
{
...
...
include/pistache/optional.h
View file @
be1283e3
...
...
@@ -227,7 +227,7 @@ public:
private:
T
*
const
const
Data
()
const
{
T
*
constData
()
const
{
return
const_cast
<
T
*
const
>
(
reinterpret_cast
<
const
T
*
const
>
(
bytes
));
}
...
...
include/pistache/os.h
View file @
be1283e3
...
...
@@ -87,8 +87,8 @@ inline constexpr bool operator==(Tag lhs, Tag rhs) {
}
struct
Event
{
explicit
Event
(
Tag
tag
)
:
tag
(
tag
)
explicit
Event
(
Tag
_
tag
)
:
tag
(
_
tag
)
{
}
Flags
<
NotifyOn
>
flags
;
...
...
include/pistache/reactor.h
View file @
be1283e3
...
...
@@ -204,7 +204,7 @@ public:
};
virtual
void
onReady
(
const
FdSet
&
fds
)
=
0
;
virtual
void
registerPoller
(
Polling
::
Epoll
&
poller
)
{
}
virtual
void
registerPoller
(
Polling
::
Epoll
&
poller
)
{
UNUSED
(
poller
)
}
Reactor
*
reactor
()
const
{
return
reactor_
;
...
...
include/pistache/router.h
View file @
be1283e3
...
...
@@ -228,7 +228,7 @@ namespace Routes {
template
<
typename
...
Args
>
void
static_checks
()
{
static_assert
(
sizeof
...(
Args
)
==
2
,
"Function should take 2 parameters"
);
typedef
details
::
TypeList
<
Args
...
>
Arguments
;
//
typedef details::TypeList<Args...> Arguments;
// Disabled now as it
// 1/ does not compile
// 2/ might not be relevant
...
...
include/pistache/stream.h
View file @
be1283e3
...
...
@@ -133,10 +133,10 @@ struct Buffer {
,
isOwned
(
false
)
{
}
Buffer
(
const
char
*
const
data
,
size_t
len
,
bool
own
=
false
)
:
data
(
data
)
,
len
(
len
)
,
isOwned
(
own
)
Buffer
(
const
char
*
const
_data
,
size_t
_len
,
bool
_
own
=
false
)
:
data
(
_
data
)
,
len
(
_
len
)
,
isOwned
(
_
own
)
{
}
Buffer
detach
(
size_t
fromIndex
=
0
)
const
{
...
...
@@ -226,8 +226,8 @@ private:
class
StreamCursor
{
public:
StreamCursor
(
StreamBuf
<
char
>*
buf
,
size_t
initialPos
=
0
)
:
buf
(
buf
)
StreamCursor
(
StreamBuf
<
char
>*
_
buf
,
size_t
initialPos
=
0
)
:
buf
(
_
buf
)
{
advance
(
initialPos
);
}
...
...
@@ -235,8 +235,8 @@ public:
static
constexpr
int
Eof
=
-
1
;
struct
Token
{
Token
(
StreamCursor
&
cursor
)
:
cursor
(
cursor
)
Token
(
StreamCursor
&
_
cursor
)
:
cursor
(
_
cursor
)
,
position
(
cursor
.
buf
->
position
())
,
eback
(
cursor
.
buf
->
begptr
())
,
gptr
(
cursor
.
buf
->
curptr
())
...
...
@@ -270,8 +270,8 @@ public:
};
struct
Revert
{
Revert
(
StreamCursor
&
cursor
)
:
cursor
(
cursor
)
Revert
(
StreamCursor
&
_
cursor
)
:
cursor
(
_
cursor
)
,
eback
(
cursor
.
buf
->
begptr
())
,
gptr
(
cursor
.
buf
->
curptr
())
,
egptr
(
cursor
.
buf
->
endptr
())
...
...
include/pistache/transport.h
View file @
be1283e3
...
...
@@ -88,16 +88,16 @@ private:
enum
Type
{
Raw
,
File
};
explicit
BufferHolder
(
const
Buffer
&
buffer
,
off_t
offset
=
0
)
:
type
(
Raw
)
,
u
(
buffer
)
:
u
(
buffer
)
,
type
(
Raw
)
{
offset_
=
offset
;
size_
=
buffer
.
len
;
}
explicit
BufferHolder
(
const
FileBuffer
&
buffer
,
off_t
offset
=
0
)
:
type
(
File
)
,
u
(
buffer
.
fd
()
)
:
u
(
buffer
.
fd
()
)
,
type
(
File
)
{
offset_
=
offset
;
size_
=
buffer
.
size
();
...
...
@@ -147,7 +147,7 @@ private:
Fd
fd
;
U
(
Buffer
buffer
)
:
raw
(
buffer
)
{
}
U
(
Fd
fd
)
:
fd
(
fd
)
{
}
U
(
Fd
fd
_
)
:
fd
(
fd_
)
{
}
}
u
;
size_t
size_
=
0
;
off_t
offset_
=
0
;
...
...
@@ -155,11 +155,11 @@ private:
};
struct
WriteEntry
{
WriteEntry
(
Async
::
Deferred
<
ssize_t
>
deferred
,
BufferHolder
buffer
,
int
flags
=
0
)
:
deferred
(
std
::
move
(
deferred
))
,
buffer
(
std
::
move
(
buffer
))
,
flags
(
flags
)
WriteEntry
(
Async
::
Deferred
<
ssize_t
>
deferred
_
,
BufferHolder
buffer
_
,
int
flags_
=
0
)
:
deferred
(
std
::
move
(
deferred
_
))
,
buffer
(
std
::
move
(
buffer
_
))
,
flags
(
flags
_
)
,
peerFd
(
-
1
)
{
}
...
...
@@ -170,11 +170,11 @@ private:
};
struct
TimerEntry
{
TimerEntry
(
Fd
fd
,
std
::
chrono
::
milliseconds
value
,
Async
::
Deferred
<
uint64_t
>
deferred
)
:
fd
(
fd
)
,
value
(
value
)
,
deferred
(
std
::
move
(
deferred
))
TimerEntry
(
Fd
fd
_
,
std
::
chrono
::
milliseconds
value_
,
Async
::
Deferred
<
uint64_t
>
deferred
_
)
:
fd
(
fd
_
)
,
value
(
value
_
)
,
deferred
(
std
::
move
(
deferred
_
))
{
active
.
store
(
true
,
std
::
memory_order_relaxed
);
}
...
...
@@ -201,8 +201,8 @@ private:
};
struct
PeerEntry
{
PeerEntry
(
std
::
shared_ptr
<
Peer
>
peer
)
:
peer
(
std
::
move
(
peer
))
PeerEntry
(
std
::
shared_ptr
<
Peer
>
peer
_
)
:
peer
(
std
::
move
(
peer
_
))
{
}
std
::
shared_ptr
<
Peer
>
peer
;
...
...
include/pistache/version.h.in
0 → 100644
View file @
be1283e3
/* version.h
Kip Warner, 29 May 2018
Version constants
*/
#pragma once
namespace Pistache {
namespace Version {
static constexpr int Major = @VERSION_MAJOR@;
static constexpr int Minor = @VERSION_MINOR@;
} // namespace Version
} // namespace Pistache
libpistache.pc.in
0 → 100644
View file @
be1283e3
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libpistache
URL: http://pistache.io/
Description: An elegant C++ REST framework.
Version: @version@
Requires:
Libs: -L'${libdir}/' -lpistache -lpthread
Libs.private:
Cflags: -I'${includedir}/'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment