Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ee9e2381
Commit
ee9e2381
authored
Sep 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system/SocketError: un-inline constructor
Reduces header dependencies.
parent
29030b54
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
ServerSocket.cxx
src/event/ServerSocket.cxx
+2
-0
SocketError.cxx
src/system/SocketError.cxx
+22
-0
SocketError.hxx
src/system/SocketError.hxx
+2
-13
No files found.
src/event/ServerSocket.cxx
View file @
ee9e2381
...
...
@@ -32,6 +32,8 @@
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include <glib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
...
...
src/system/SocketError.cxx
View file @
ee9e2381
...
...
@@ -21,4 +21,26 @@
#include "SocketError.hxx"
#include "util/Domain.hxx"
#include <glib.h>
const
Domain
socket_domain
(
"socket"
);
#ifdef WIN32
SocketErrorMessage
::
SocketErrorMessage
(
socket_error_t
code
)
{
DWORD
nbytes
=
FormatMessage
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
NULL
,
code
,
0
,
(
LPSTR
)
msg
,
sizeof
(
msg
),
NULL
);
if
(
nbytes
==
0
)
strcpy
(
msg
,
"Unknown error"
);
}
#else
SocketErrorMessage
::
SocketErrorMessage
(
socket_error_t
code
)
:
msg
(
g_strerror
(
code
))
{}
#endif
src/system/SocketError.hxx
View file @
ee9e2381
...
...
@@ -23,8 +23,6 @@
#include "gcc.h"
#include "util/Error.hxx"
#include <glib.h>
#ifdef WIN32
#include <winsock2.h>
typedef
DWORD
socket_error_t
;
...
...
@@ -97,18 +95,9 @@ class SocketErrorMessage {
public
:
#ifdef WIN32
explicit
SocketErrorMessage
(
socket_error_t
code
=
GetSocketError
())
{
DWORD
nbytes
=
FormatMessage
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_MAX_WIDTH_MASK
,
NULL
,
code
,
0
,
(
LPSTR
)
msg
,
sizeof
(
msg
),
NULL
);
if
(
nbytes
==
0
)
strcpy
(
msg
,
"Unknown error"
);
}
explicit
SocketErrorMessage
(
socket_error_t
code
=
GetSocketError
());
#else
explicit
SocketErrorMessage
(
socket_error_t
code
=
GetSocketError
())
:
msg
(
g_strerror
(
code
))
{}
explicit
SocketErrorMessage
(
socket_error_t
code
=
GetSocketError
());
#endif
operator
const
char
*
()
const
{
...
...
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