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
9c63ffa5
Commit
9c63ffa5
authored
Mar 27, 2009
by
Sean McNamara
Committed by
Max Kellermann
Mar 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Winsock2 is needed on MinGW (or other pure Win32 toolchains) for
networking, select(), ntohl(), etc.
parent
b91517e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
main.c
src/main.c
+36
-0
No files found.
src/main.c
View file @
9c63ffa5
...
...
@@ -75,6 +75,11 @@
#include <locale.h>
#endif
#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
enum
{
DEFAULT_BUFFER_SIZE
=
2048
,
DEFAULT_BUFFER_BEFORE_PLAY
=
10
,
...
...
@@ -136,6 +141,31 @@ openDB(const Options *options)
}
/**
* Windows-only initialization of the Winsock2 library.
*/
#ifdef WIN32
static
void
winsock_init
(
void
)
{
WSADATA
sockinfo
;
int
retval
;
retval
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
sockinfo
);
if
(
retval
!=
0
)
{
g_error
(
"Attempt to open Winsock2 failed; error code %d
\n
"
,
retval
);
}
if
(
LOBYTE
(
sockinfo
.
wVersion
)
!=
2
)
{
g_error
(
"We use Winsock2 but your version is either too new or "
"old; please install Winsock 2.x
\n
"
);
}
}
#endif
/**
* Initialize the decoder and player core, including the music pipe.
*/
static
void
...
...
@@ -212,6 +242,9 @@ int main(int argc, char *argv[])
/* enable GLib's thread safety code */
g_thread_init
(
NULL
);
#ifdef WIN32
winsock_init
();
#endif
idle_init
();
dirvec_init
();
songvec_init
();
...
...
@@ -339,6 +372,9 @@ int main(int argc, char *argv[])
idle_deinit
();
stats_global_finish
();
daemonize_finish
();
#ifdef WIN32
WSACleanup
();
#endif
close_log_files
();
return
EXIT_SUCCESS
;
...
...
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