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
1d974c2b
Commit
1d974c2b
authored
1 year ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Resolve more MSVC warnings.
parent
b7d8315a
No related branches found
No related tags found
No related merge requests found
Pipeline
#5745
canceled
1 year ago
Stage: build
Stage: test
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/conio/cterm.c
+2
-0
2 additions, 0 deletions
src/conio/cterm.c
src/xpdev/xp_dl.c
+2
-0
2 additions, 0 deletions
src/xpdev/xp_dl.c
src/xpdev/xpbeep.c
+10
-18
10 additions, 18 deletions
src/xpdev/xpbeep.c
src/xpdev/xpbeep.h
+1
-1
1 addition, 1 deletion
src/xpdev/xpbeep.h
with
15 additions
and
19 deletions
src/conio/cterm.c
+
2
−
0
View file @
1d974c2b
...
@@ -59,6 +59,8 @@
...
@@ -59,6 +59,8 @@
* 4244 appears to be for implicit conversions
* 4244 appears to be for implicit conversions
* warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
* warning C4244: '=': conversion from 'uint64_t' to 'int', possible loss of data
* 4267 is the same thing, but from size_t.
* 4267 is the same thing, but from size_t.
* 4018 warns when comparing signed and unsigned if the signed is implicitly
* converted to unsigned (so more sane than -Wsign-compare)
*/
*/
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(disable : 4244 4267 4018)
#pragma warning(disable : 4244 4267 4018)
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/xp_dl.c
+
2
−
0
View file @
1d974c2b
...
@@ -64,6 +64,8 @@ DLLEXPORT dll_handle xp_dlopen(const char **names, int mode, int major)
...
@@ -64,6 +64,8 @@ DLLEXPORT dll_handle xp_dlopen(const char **names, int mode, int major)
char
fname
[
MAX_PATH
+
1
];
char
fname
[
MAX_PATH
+
1
];
dll_handle
ret
=
NULL
;
dll_handle
ret
=
NULL
;
(
void
)
mode
;
// Not used on Win32.
(
void
)
major
;
// Not used on Win32.
for
(;
*
names
&&
(
*
names
)[
0
];
names
++
)
{
for
(;
*
names
&&
(
*
names
)[
0
];
names
++
)
{
sprintf
(
fname
,
"%s.dll"
,
*
names
);
sprintf
(
fname
,
"%s.dll"
,
*
names
);
if
((
ret
=
LoadLibrary
(
fname
))
!=
NULL
)
if
((
ret
=
LoadLibrary
(
fname
))
!=
NULL
)
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/xpbeep.c
+
10
−
18
View file @
1d974c2b
...
@@ -83,6 +83,10 @@ static size_t sample_size;
...
@@ -83,6 +83,10 @@ static size_t sample_size;
#endif
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4244 4267 4018)
#endif
static
bool
sound_device_open_failed
=
false
;
static
bool
sound_device_open_failed
=
false
;
#ifdef USE_ALSA_SOUND
#ifdef USE_ALSA_SOUND
static
bool
alsa_device_open_failed
=
false
;
static
bool
alsa_device_open_failed
=
false
;
...
@@ -215,7 +219,7 @@ struct alsa_api_struct *alsa_api=NULL;
...
@@ -215,7 +219,7 @@ struct alsa_api_struct *alsa_api=NULL;
#ifdef XPDEV_THREAD_SAFE
#ifdef XPDEV_THREAD_SAFE
static
void
init_sample
(
void
);
static
void
init_sample
(
void
);
static
bool
xp_play_sample_locked
(
const
unsigned
char
*
sample
,
size_t
size
,
bool
background
);
static
bool
xp_play_sample_locked
(
unsigned
char
*
sample
,
size_t
size
,
bool
background
);
#endif
#endif
/********************************************************************************/
/********************************************************************************/
...
@@ -239,10 +243,6 @@ void xptone_makewave(double freq, unsigned char *wave, int samples, enum WAVE_SH
...
@@ -239,10 +243,6 @@ void xptone_makewave(double freq, unsigned char *wave, int samples, enum WAVE_SH
inc
=
8
.
0
*
atan
(
1
.
0
);
inc
=
8
.
0
*
atan
(
1
.
0
);
inc
*=
((
double
)
freq
/
(
double
)
S_RATE
);
inc
*=
((
double
)
freq
/
(
double
)
S_RATE
);
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#endif
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
pos
=
(
inc
*
(
double
)
i
);
pos
=
(
inc
*
(
double
)
i
);
pos
-=
(
int
)(
pos
/
WAVE_TPI
)
*
WAVE_TPI
;
pos
-=
(
int
)(
pos
/
WAVE_TPI
)
*
WAVE_TPI
;
...
@@ -276,9 +276,6 @@ void xptone_makewave(double freq, unsigned char *wave, int samples, enum WAVE_SH
...
@@ -276,9 +276,6 @@ void xptone_makewave(double freq, unsigned char *wave, int samples, enum WAVE_SH
break
;
break
;
}
}
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/* Now we have a "perfect" wave...
/* Now we have a "perfect" wave...
* we must clean it up now to avoid click/pop
* we must clean it up now to avoid click/pop
...
@@ -997,6 +994,7 @@ void xp_play_sample_thread(void *data)
...
@@ -997,6 +994,7 @@ void xp_play_sample_thread(void *data)
size_t
this_sample_size
;
size_t
this_sample_size
;
int
freed
;
int
freed
;
(
void
)
data
;
// Unused
SetThreadName
(
"Sample Play"
);
SetThreadName
(
"Sample Play"
);
sample_thread_running
=
true
;
sample_thread_running
=
true
;
sem_post
(
&
sample_complete_sem
);
sem_post
(
&
sample_complete_sem
);
...
@@ -1082,7 +1080,7 @@ init_sample(void)
...
@@ -1082,7 +1080,7 @@ init_sample(void)
sem_init
(
&
sample_complete_sem
,
0
,
0
);
sem_init
(
&
sample_complete_sem
,
0
,
0
);
}
}
static
bool
xp_play_sample_locked
(
const
unsigned
char
*
sample
,
size_t
size
,
bool
background
)
static
bool
xp_play_sample_locked
(
unsigned
char
*
sample
,
size_t
size
,
bool
background
)
{
{
if
(
!
sample_thread_running
)
{
if
(
!
sample_thread_running
)
{
_beginthread
(
xp_play_sample_thread
,
0
,
NULL
);
_beginthread
(
xp_play_sample_thread
,
0
,
NULL
);
...
@@ -1114,7 +1112,7 @@ static bool xp_play_sample_locked(const unsigned char *sample, size_t size, bool
...
@@ -1114,7 +1112,7 @@ static bool xp_play_sample_locked(const unsigned char *sample, size_t size, bool
* This MUST not return false after sample goes into the sample buffer in the background.
* This MUST not return false after sample goes into the sample buffer in the background.
* If it does, the caller won't be able to free() it.
* If it does, the caller won't be able to free() it.
*/
*/
bool
xp_play_sample
(
const
unsigned
char
*
sample
,
size_t
size
,
bool
background
)
bool
xp_play_sample
(
unsigned
char
*
sample
,
size_t
size
,
bool
background
)
{
{
bool
ret
;
bool
ret
;
pthread_once
(
&
sample_initialized_pto
,
init_sample
);
pthread_once
(
&
sample_initialized_pto
,
init_sample
);
...
@@ -1125,11 +1123,12 @@ bool xp_play_sample(const unsigned char *sample, size_t size, bool background)
...
@@ -1125,11 +1123,12 @@ bool xp_play_sample(const unsigned char *sample, size_t size, bool background)
return
(
ret
);
return
(
ret
);
}
}
#else
#else
bool
xp_play_sample
(
const
unsigned
char
*
sample
,
size_t
sample_size
,
bool
background
)
bool
xp_play_sample
(
unsigned
char
*
sample
,
size_t
sample_size
,
bool
background
)
{
{
bool
must_close
=
false
;
bool
must_close
=
false
;
bool
ret
;
bool
ret
;
(
void
)
background
;
// Never used when single-threaded
if
(
handle_type
==
SOUND_DEVICE_CLOSED
)
{
if
(
handle_type
==
SOUND_DEVICE_CLOSED
)
{
must_close
=
true
;
must_close
=
true
;
if
(
!
xptone_open
())
if
(
!
xptone_open
())
...
@@ -1160,15 +1159,8 @@ bool xptone(double freq, DWORD duration, enum WAVE_SHAPE shape)
...
@@ -1160,15 +1159,8 @@ bool xptone(double freq, DWORD duration, enum WAVE_SHAPE shape)
freq
=
17
;
freq
=
17
;
samples
=
S_RATE
*
duration
/
1000
;
samples
=
S_RATE
*
duration
/
1000
;
if
(
freq
)
{
if
(
freq
)
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#endif
if
(
samples
<=
S_RATE
/
freq
*
2
)
if
(
samples
<=
S_RATE
/
freq
*
2
)
samples
=
S_RATE
/
freq
*
2
;
samples
=
S_RATE
/
freq
*
2
;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
}
if
(
freq
==
0
||
samples
>
S_RATE
/
freq
*
2
)
{
if
(
freq
==
0
||
samples
>
S_RATE
/
freq
*
2
)
{
int
sample_len
;
int
sample_len
;
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/xpbeep.h
+
1
−
1
View file @
1d974c2b
...
@@ -38,7 +38,7 @@ DLLEXPORT void xptone_makewave(double freq, unsigned char *wave, int samples, en
...
@@ -38,7 +38,7 @@ DLLEXPORT void xptone_makewave(double freq, unsigned char *wave, int samples, en
DLLEXPORT
bool
xptone_open
(
void
);
DLLEXPORT
bool
xptone_open
(
void
);
DLLEXPORT
bool
xptone_close
(
void
);
DLLEXPORT
bool
xptone_close
(
void
);
DLLEXPORT
void
xpbeep
(
double
freq
,
DWORD
duration
);
DLLEXPORT
void
xpbeep
(
double
freq
,
DWORD
duration
);
DLLEXPORT
bool
xp_play_sample
(
const
unsigned
char
*
sample
,
size_t
sample_size
,
bool
background
);
DLLEXPORT
bool
xp_play_sample
(
unsigned
char
*
sample
,
size_t
sample_size
,
bool
background
);
DLLEXPORT
void
xptone_complete
(
void
);
DLLEXPORT
void
xptone_complete
(
void
);
DLLEXPORT
bool
xptone
(
double
freq
,
DWORD
duration
,
enum
WAVE_SHAPE
);
DLLEXPORT
bool
xptone
(
double
freq
,
DWORD
duration
,
enum
WAVE_SHAPE
);
#ifdef __unix__
#ifdef __unix__
...
...
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