Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
2aebfd81
Commit
2aebfd81
authored
11 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
DLLEXPORT/DLLCALL-ify
parent
f7e3ae48
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/xpdev/threadwrap.c
+13
-13
13 additions, 13 deletions
src/xpdev/threadwrap.c
src/xpdev/threadwrap.h
+11
-11
11 additions, 11 deletions
src/xpdev/threadwrap.h
src/xpdev/xpbeep.c
+7
-7
7 additions, 7 deletions
src/xpdev/xpbeep.c
src/xpdev/xpbeep.h
+7
-7
7 additions, 7 deletions
src/xpdev/xpbeep.h
with
38 additions
and
38 deletions
src/xpdev/threadwrap.c
+
13
−
13
View file @
2aebfd81
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
/****************************************************************************/
/****************************************************************************/
#if defined(__unix__)
#if defined(__unix__)
#if defined(_POSIX_THREADS)
#if defined(_POSIX_THREADS)
ulong
_beginthread
(
void
(
*
start_address
)(
void
*
)
ulong
DLLCALL
_beginthread
(
void
(
*
start_address
)(
void
*
)
,
unsigned
stack_size
,
void
*
arglist
)
,
unsigned
stack_size
,
void
*
arglist
)
{
{
pthread_t
thread
;
pthread_t
thread
;
...
@@ -104,7 +104,7 @@ ulong _beginthread(void( *start_address )( void * )
...
@@ -104,7 +104,7 @@ ulong _beginthread(void( *start_address )( void * )
/****************************************************************************/
/****************************************************************************/
/* Wrappers for POSIX thread (pthread) mutexes */
/* Wrappers for POSIX thread (pthread) mutexes */
/****************************************************************************/
/****************************************************************************/
pthread_mutex_t
pthread_mutex_initializer_np
(
BOOL
recursive
)
pthread_mutex_t
DLLCALL
pthread_mutex_initializer_np
(
BOOL
recursive
)
{
{
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
#if defined(_POSIX_THREADS)
#if defined(_POSIX_THREADS)
...
@@ -126,7 +126,7 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive)
...
@@ -126,7 +126,7 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive)
#if !defined(_POSIX_THREADS)
#if !defined(_POSIX_THREADS)
int
pthread_mutex_init
(
pthread_mutex_t
*
mutex
,
void
*
attr
)
int
DLLCALL
pthread_mutex_init
(
pthread_mutex_t
*
mutex
,
void
*
attr
)
{
{
(
void
)
attr
;
(
void
)
attr
;
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
...
@@ -139,7 +139,7 @@ int pthread_mutex_init(pthread_mutex_t* mutex, void* attr)
...
@@ -139,7 +139,7 @@ int pthread_mutex_init(pthread_mutex_t* mutex, void* attr)
#endif
#endif
}
}
int
pthread_mutex_lock
(
pthread_mutex_t
*
mutex
)
int
DLLCALL
pthread_mutex_lock
(
pthread_mutex_t
*
mutex
)
{
{
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
return
(
WaitForSingleObject
(
*
mutex
,
INFINITE
)
==
WAIT_OBJECT_0
?
0
:
EBUSY
);
return
(
WaitForSingleObject
(
*
mutex
,
INFINITE
)
==
WAIT_OBJECT_0
?
0
:
EBUSY
);
...
@@ -151,7 +151,7 @@ int pthread_mutex_lock(pthread_mutex_t* mutex)
...
@@ -151,7 +151,7 @@ int pthread_mutex_lock(pthread_mutex_t* mutex)
#endif
#endif
}
}
int
pthread_mutex_trylock
(
pthread_mutex_t
*
mutex
)
int
DLLCALL
pthread_mutex_trylock
(
pthread_mutex_t
*
mutex
)
{
{
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
return
(
WaitForSingleObject
(
*
mutex
,
0
)
==
WAIT_OBJECT_0
?
0
:
EBUSY
);
return
(
WaitForSingleObject
(
*
mutex
,
0
)
==
WAIT_OBJECT_0
?
0
:
EBUSY
);
...
@@ -163,7 +163,7 @@ int pthread_mutex_trylock(pthread_mutex_t* mutex)
...
@@ -163,7 +163,7 @@ int pthread_mutex_trylock(pthread_mutex_t* mutex)
#endif
#endif
}
}
int
pthread_mutex_unlock
(
pthread_mutex_t
*
mutex
)
int
DLLCALL
pthread_mutex_unlock
(
pthread_mutex_t
*
mutex
)
{
{
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
return
(
ReleaseMutex
(
*
mutex
)
?
0
:
GetLastError
());
return
(
ReleaseMutex
(
*
mutex
)
?
0
:
GetLastError
());
...
@@ -175,7 +175,7 @@ int pthread_mutex_unlock(pthread_mutex_t* mutex)
...
@@ -175,7 +175,7 @@ int pthread_mutex_unlock(pthread_mutex_t* mutex)
#endif
#endif
}
}
int
pthread_mutex_destroy
(
pthread_mutex_t
*
mutex
)
int
DLLCALL
pthread_mutex_destroy
(
pthread_mutex_t
*
mutex
)
{
{
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
#if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX)
return
(
CloseHandle
(
*
mutex
)
?
0
:
GetLastError
());
return
(
CloseHandle
(
*
mutex
)
?
0
:
GetLastError
());
...
@@ -193,19 +193,19 @@ int pthread_mutex_destroy(pthread_mutex_t* mutex)
...
@@ -193,19 +193,19 @@ int pthread_mutex_destroy(pthread_mutex_t* mutex)
/* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */
/* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */
/************************************************************************/
/************************************************************************/
int
protected_int32_init
(
protected_int32_t
*
prot
,
int32_t
value
)
int
DLLCALL
protected_int32_init
(
protected_int32_t
*
prot
,
int32_t
value
)
{
{
prot
->
value
=
value
;
prot
->
value
=
value
;
return
pthread_mutex_init
(
&
prot
->
mutex
,
NULL
);
return
pthread_mutex_init
(
&
prot
->
mutex
,
NULL
);
}
}
int
protected_int64_init
(
protected_int64_t
*
prot
,
int64_t
value
)
int
DLLCALL
protected_int64_init
(
protected_int64_t
*
prot
,
int64_t
value
)
{
{
prot
->
value
=
value
;
prot
->
value
=
value
;
return
pthread_mutex_init
(
&
prot
->
mutex
,
NULL
);
return
pthread_mutex_init
(
&
prot
->
mutex
,
NULL
);
}
}
int32_t
protected_int32_adjust
(
protected_int32_t
*
i
,
int32_t
adjustment
)
int32_t
DLLCALL
protected_int32_adjust
(
protected_int32_t
*
i
,
int32_t
adjustment
)
{
{
int32_t
newval
;
int32_t
newval
;
pthread_mutex_lock
(
&
i
->
mutex
);
pthread_mutex_lock
(
&
i
->
mutex
);
...
@@ -214,7 +214,7 @@ int32_t protected_int32_adjust(protected_int32_t* i, int32_t adjustment)
...
@@ -214,7 +214,7 @@ int32_t protected_int32_adjust(protected_int32_t* i, int32_t adjustment)
return
newval
;
return
newval
;
}
}
uint32_t
protected_uint32_adjust
(
protected_uint32_t
*
i
,
int32_t
adjustment
)
uint32_t
DLLCALL
protected_uint32_adjust
(
protected_uint32_t
*
i
,
int32_t
adjustment
)
{
{
uint32_t
newval
;
uint32_t
newval
;
pthread_mutex_lock
(
&
i
->
mutex
);
pthread_mutex_lock
(
&
i
->
mutex
);
...
@@ -223,7 +223,7 @@ uint32_t protected_uint32_adjust(protected_uint32_t* i, int32_t adjustment)
...
@@ -223,7 +223,7 @@ uint32_t protected_uint32_adjust(protected_uint32_t* i, int32_t adjustment)
return
newval
;
return
newval
;
}
}
int64_t
protected_int64_adjust
(
protected_int64_t
*
i
,
int64_t
adjustment
)
int64_t
DLLCALL
protected_int64_adjust
(
protected_int64_t
*
i
,
int64_t
adjustment
)
{
{
int64_t
newval
;
int64_t
newval
;
pthread_mutex_lock
(
&
i
->
mutex
);
pthread_mutex_lock
(
&
i
->
mutex
);
...
@@ -232,7 +232,7 @@ int64_t protected_int64_adjust(protected_int64_t* i, int64_t adjustment)
...
@@ -232,7 +232,7 @@ int64_t protected_int64_adjust(protected_int64_t* i, int64_t adjustment)
return
newval
;
return
newval
;
}
}
uint64_t
protected_uint64_adjust
(
protected_uint64_t
*
i
,
int64_t
adjustment
)
uint64_t
DLLCALL
protected_uint64_adjust
(
protected_uint64_t
*
i
,
int64_t
adjustment
)
{
{
uint64_t
newval
;
uint64_t
newval
;
pthread_mutex_lock
(
&
i
->
mutex
);
pthread_mutex_lock
(
&
i
->
mutex
);
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/threadwrap.h
+
11
−
11
View file @
2aebfd81
...
@@ -115,11 +115,11 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive);
...
@@ -115,11 +115,11 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive);
#else
#else
int
pthread_mutex_init
(
pthread_mutex_t
*
,
void
*
attr
);
DLLEXPORT
int
DLLCALL
pthread_mutex_init
(
pthread_mutex_t
*
,
void
*
attr
);
int
pthread_mutex_lock
(
pthread_mutex_t
*
);
DLLEXPORT
int
DLLCALL
pthread_mutex_lock
(
pthread_mutex_t
*
);
int
pthread_mutex_trylock
(
pthread_mutex_t
*
);
DLLEXPORT
int
DLLCALL
pthread_mutex_trylock
(
pthread_mutex_t
*
);
int
pthread_mutex_unlock
(
pthread_mutex_t
*
);
DLLEXPORT
int
DLLCALL
pthread_mutex_unlock
(
pthread_mutex_t
*
);
int
pthread_mutex_destroy
(
pthread_mutex_t
*
);
DLLEXPORT
int
DLLCALL
pthread_mutex_destroy
(
pthread_mutex_t
*
);
#define SetThreadName(c)
#define SetThreadName(c)
...
@@ -162,19 +162,19 @@ typedef struct {
...
@@ -162,19 +162,19 @@ typedef struct {
}
protected_uint64_t
;
}
protected_uint64_t
;
/* Return 0 on success, non-zero on failure (see pthread_mutex_init): */
/* Return 0 on success, non-zero on failure (see pthread_mutex_init): */
int
protected_int32_init
(
protected_int32_t
*
,
int32_t
value
);
DLLEXPORT
int
DLLCALL
protected_int32_init
(
protected_int32_t
*
,
int32_t
value
);
#define protected_uint32_init(i, val) protected_int32_init((protected_int32_t*)i, val)
#define protected_uint32_init(i, val) protected_int32_init((protected_int32_t*)i, val)
int
protected_int64_init
(
protected_int64_t
*
,
int64_t
value
);
DLLEXPORT
int
DLLCALL
protected_int64_init
(
protected_int64_t
*
,
int64_t
value
);
#define protected_uint64_init(i, val) protected_int64_init((protected_int64_t*)i, val)
#define protected_uint64_init(i, val) protected_int64_init((protected_int64_t*)i, val)
/* Return new value: */
/* Return new value: */
int32_t
protected_int32_adjust
(
protected_int32_t
*
,
int32_t
adjustment
);
DLLEXPORT
int32_t
DLLCALL
protected_int32_adjust
(
protected_int32_t
*
,
int32_t
adjustment
);
#define protected_int32_value(i) protected_int32_adjust(&i,0)
#define protected_int32_value(i) protected_int32_adjust(&i,0)
uint32_t
protected_uint32_adjust
(
protected_uint32_t
*
,
int32_t
adjustment
);
DLLEXPORT
uint32_t
DLLCALL
protected_uint32_adjust
(
protected_uint32_t
*
,
int32_t
adjustment
);
#define protected_uint32_value(i) protected_uint32_adjust(&i,0)
#define protected_uint32_value(i) protected_uint32_adjust(&i,0)
int64_t
protected_int64_adjust
(
protected_int64_t
*
,
int64_t
adjustment
);
DLLEXPORT
int64_t
DLLCALL
protected_int64_adjust
(
protected_int64_t
*
,
int64_t
adjustment
);
#define protected_int64_value(i) protected_int64_adjust(&i,0)
#define protected_int64_value(i) protected_int64_adjust(&i,0)
uint64_t
protected_uint64_adjust
(
protected_uint64_t
*
,
int64_t
adjustment
);
DLLEXPORT
uint64_t
DLLCALL
protected_uint64_adjust
(
protected_uint64_t
*
,
int64_t
adjustment
);
#define protected_uint64_value(i) protected_uint64_adjust(&i,0)
#define protected_uint64_value(i) protected_uint64_adjust(&i,0)
/* Return 0 on success, non-zero on failure (see pthread_mutex_destroy): */
/* Return 0 on success, non-zero on failure (see pthread_mutex_destroy): */
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/xpbeep.c
+
7
−
7
View file @
2aebfd81
...
@@ -189,7 +189,7 @@ struct alsa_api_struct *alsa_api=NULL;
...
@@ -189,7 +189,7 @@ struct alsa_api_struct *alsa_api=NULL;
/********************************************************************************/
/********************************************************************************/
/* Calculate and generate a sound wave pattern (thanks to Deuce!) */
/* Calculate and generate a sound wave pattern (thanks to Deuce!) */
/********************************************************************************/
/********************************************************************************/
void
makewave
(
double
freq
,
unsigned
char
*
wave
,
int
samples
,
enum
WAVE_SHAPE
shape
)
void
DLLCALL
makewave
(
double
freq
,
unsigned
char
*
wave
,
int
samples
,
enum
WAVE_SHAPE
shape
)
{
{
int
i
;
int
i
;
int
midpoint
;
int
midpoint
;
...
@@ -315,7 +315,7 @@ static int portaudio_callback(void *inputBuffer
...
@@ -315,7 +315,7 @@ static int portaudio_callback(void *inputBuffer
#endif
#endif
#ifdef WITH_SDL_AUDIO
#ifdef WITH_SDL_AUDIO
void
sdl_fillbuf
(
void
*
userdata
,
Uint8
*
stream
,
int
len
)
void
DLLCALL
sdl_fillbuf
(
void
*
userdata
,
Uint8
*
stream
,
int
len
)
{
{
int
copylen
=
len
;
int
copylen
=
len
;
int
maxlen
=
sdl_audio_buf_len
-
sdl_audio_buf_pos
;
int
maxlen
=
sdl_audio_buf_len
-
sdl_audio_buf_pos
;
...
@@ -340,7 +340,7 @@ void sdl_fillbuf(void *userdata, Uint8 *stream, int len)
...
@@ -340,7 +340,7 @@ void sdl_fillbuf(void *userdata, Uint8 *stream, int len)
}
}
#endif
#endif
BOOL
xptone_open
(
void
)
BOOL
DLLCALL
xptone_open
(
void
)
{
{
#ifdef _WIN32
#ifdef _WIN32
WAVEFORMATEX
w
;
WAVEFORMATEX
w
;
...
@@ -562,7 +562,7 @@ BOOL xptone_open(void)
...
@@ -562,7 +562,7 @@ BOOL xptone_open(void)
return
(
FALSE
);
return
(
FALSE
);
}
}
void
xptone_complete
(
void
)
void
DLLCALL
xptone_complete
(
void
)
{
{
if
(
handle_type
==
SOUND_DEVICE_CLOSED
)
if
(
handle_type
==
SOUND_DEVICE_CLOSED
)
return
;
return
;
...
@@ -614,7 +614,7 @@ void xptone_complete(void)
...
@@ -614,7 +614,7 @@ void xptone_complete(void)
}
}
BOOL
xptone_close
(
void
)
BOOL
DLLCALL
xptone_close
(
void
)
{
{
xptone_complete
();
xptone_complete
();
#ifdef WITH_PORTAUDIO
#ifdef WITH_PORTAUDIO
...
@@ -664,7 +664,7 @@ BOOL xptone_close(void)
...
@@ -664,7 +664,7 @@ BOOL xptone_close(void)
}
}
#ifdef XPDEV_THREAD_SAFE
#ifdef XPDEV_THREAD_SAFE
void
xp_play_sample_thread
(
void
*
data
)
void
DLLCALL
xp_play_sample_thread
(
void
*
data
)
{
{
BOOL
must_close
=
FALSE
;
BOOL
must_close
=
FALSE
;
BOOL
posted_last
=
TRUE
;
BOOL
posted_last
=
TRUE
;
...
@@ -1034,7 +1034,7 @@ void DLLCALL unix_beep(int freq, int dur)
...
@@ -1034,7 +1034,7 @@ void DLLCALL unix_beep(int freq, int dur)
/********************************************************************************/
/********************************************************************************/
/* Play sound through DSP/wave device, if unsuccessful, play through PC speaker */
/* Play sound through DSP/wave device, if unsuccessful, play through PC speaker */
/********************************************************************************/
/********************************************************************************/
void
xpbeep
(
double
freq
,
DWORD
duration
)
void
DLLCALL
xpbeep
(
double
freq
,
DWORD
duration
)
{
{
if
(
xptone
(
freq
,
duration
,
WAVE_SHAPE_SINE_SAW_HARM
))
if
(
xptone
(
freq
,
duration
,
WAVE_SHAPE_SINE_SAW_HARM
))
return
;
return
;
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/xpbeep.h
+
7
−
7
View file @
2aebfd81
...
@@ -33,14 +33,14 @@ enum WAVE_SHAPE {
...
@@ -33,14 +33,14 @@ enum WAVE_SHAPE {
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
BOO
L
xptone_open
(
void
);
DLLEXPORT
BOOL
DLLCAL
L
xptone_open
(
void
);
BOO
L
xptone_close
(
void
);
DLLEXPORT
BOOL
DLLCAL
L
xptone_close
(
void
);
void
xpbeep
(
double
freq
,
DWORD
duration
);
DLLEXPORT
void
DLLCALL
xpbeep
(
double
freq
,
DWORD
duration
);
BOO
L
xp_play_sample
(
const
unsigned
char
*
sample
,
size_t
sample_size
,
BOOL
background
);
DLLEXPORT
BOOL
DLLCAL
L
xp_play_sample
(
const
unsigned
char
*
sample
,
size_t
sample_size
,
BOOL
background
);
void
xptone_complete
(
void
);
DLLEXPORT
void
DLLCALL
xptone_complete
(
void
);
BOO
L
xptone
(
double
freq
,
DWORD
duration
,
enum
WAVE_SHAPE
);
DLLEXPORT
BOOL
DLLCAL
L
xptone
(
double
freq
,
DWORD
duration
,
enum
WAVE_SHAPE
);
#ifdef __unix__
#ifdef __unix__
void
unix_beep
(
int
freq
,
int
dur
);
DLLEXPORT
void
DLLCALL
unix_beep
(
int
freq
,
int
dur
);
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
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