Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rlib
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
rlib
Commits
8d6199be
There was an error fetching the commit references. Please try again later.
Commit
8d6199be
authored
4 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
tiny bug fix
parent
01fb2ba5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
opt.hpp
+2
-2
2 additions, 2 deletions
opt.hpp
string.hpp
+3
-3
3 additions, 3 deletions
string.hpp
sys/sio.hpp
+14
-0
14 additions, 0 deletions
sys/sio.hpp
with
19 additions
and
5 deletions
opt.hpp
+
2
−
2
View file @
8d6199be
...
...
@@ -67,7 +67,7 @@ namespace rlib {
if
(
required
&&
pos
==
args
.
cend
())
throw
std
::
invalid_argument
(
"Required argument '{}' not provided."
_format
(
argName
));
if
(
pos
==
args
.
cend
())
return
std
::
move
(
def
)
;
return
def
;
rlib_defer
(([
&
,
pos
]{
if
(
!
useEqualSym
)
args
.
erase
(
pos
+
1
);
args
.
erase
(
pos
);}));
if
(
useEqualSym
)
return
pos
->
substr
(
argName
.
size
()
+
1
);
...
...
@@ -91,7 +91,7 @@ namespace rlib {
else
return
def
;
}
return
std
::
move
(
value
)
;
return
value
;
}
rlib
::
string
getValueArg
(
const
std
::
string
&
longName
,
const
char
*
shortName
)
...
...
This diff is collapsed.
Click to expand it.
string.hpp
+
3
−
3
View file @
8d6199be
...
...
@@ -131,7 +131,7 @@ namespace rlib {
inline
char
*
_format_string_c_helper
(
const
char
*
fmt
,
...)
{
int
n
;
in
t
size
=
std
::
strlen
(
fmt
);
size_
t
size
=
std
::
strlen
(
fmt
);
char
*
p
,
*
np
;
va_list
ap
;
...
...
@@ -186,10 +186,10 @@ namespace rlib {
return
this
->
c_str
();
}
std
::
string
as
(
as_helper
<
std
::
string
>
)
const
{
return
std
::
move
(
*
this
)
;
return
*
this
;
}
rlib
::
string
as
(
as_helper
<
rlib
::
string
>
)
const
{
return
std
::
move
(
*
this
)
;
return
*
this
;
}
char
as
(
as_helper
<
char
>
)
const
{
if
(
size
()
>
1
)
...
...
This diff is collapsed.
Click to expand it.
sys/sio.hpp
+
14
−
0
View file @
8d6199be
...
...
@@ -7,12 +7,16 @@
#include
<winsock2.h>
#include
<windows.h>
#include
<ws2tcpip.h>
namespace
rlib
{
using
ssize_t
=
int
;
}
#else
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<netdb.h>
#include
<fcntl.h>
#include
<arpa/inet.h>
#include
<unistd.h>
#endif
// Include winsock2.h before windows.h
...
...
@@ -501,6 +505,11 @@ namespace rlib {
currvptr
=
(
char
*
)
vptr
+
current
/
2
;
}
}
static
void
close_ex
(
sockfd_t
fd
)
{
if
(
closesocket
(
fd
)
==
SOCKET_ERROR
)
{
throw
std
::
runtime_error
(
"closeSocket failed. error code: "
+
std
::
to_string
(
WSAGetLastError
()));
}
}
#else
// POSIX sockIO
public
:
...
...
@@ -586,6 +595,11 @@ namespace rlib {
currvptr
=
(
char
*
)
vptr
+
current
/
2
;
}
}
static
void
close_ex
(
sockfd_t
fd
)
{
if
(
close
(
fd
)
==
-
1
)
{
throw
std
::
runtime_error
(
"close failed. error code: "
+
std
::
to_string
(
errno
));
}
}
#endif
#ifndef MSG_NOSIGNAL
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment