aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-14 16:55:28 -0700
committerChris Robinson <[email protected]>2019-09-14 18:35:23 -0700
commit2c348cecb68bd3a71d388547d6b3330f9cebbfad (patch)
tree445e6387a7356da79c93db166ca8da057a0a0cfc /examples
parent1c45b1791b784fb9b70e8c6ce8a1ea158e9004ff (diff)
Fix some more implicit conversions noted by GCC
Diffstat (limited to 'examples')
-rw-r--r--examples/alrecord.c5
-rw-r--r--examples/altonegen.c2
-rw-r--r--examples/common/alhelpers.c4
3 files changed, 6 insertions, 5 deletions
diff --git a/examples/alrecord.c b/examples/alrecord.c
index 627f8540..a66e5471 100644
--- a/examples/alrecord.c
+++ b/examples/alrecord.c
@@ -54,13 +54,14 @@ static float msvc_strtof(const char *str, char **end)
static void fwrite16le(ALushort val, FILE *f)
{
- ALubyte data[2] = { val&0xff, (val>>8)&0xff };
+ ALubyte data[2] = { (ALubyte)(val&0xff), (ALubyte)((val>>8)&0xff) };
fwrite(data, 1, 2, f);
}
static void fwrite32le(ALuint val, FILE *f)
{
- ALubyte data[4] = { val&0xff, (val>>8)&0xff, (val>>16)&0xff, (val>>24)&0xff };
+ ALubyte data[4] = { (ALubyte)(val&0xff), (ALubyte)((val>>8)&0xff), (ALubyte)((val>>16)&0xff),
+ (ALubyte)((val>>24)&0xff) };
fwrite(data, 1, 4, f);
}
diff --git a/examples/altonegen.c b/examples/altonegen.c
index aacc3496..26ae788d 100644
--- a/examples/altonegen.c
+++ b/examples/altonegen.c
@@ -97,7 +97,7 @@ static ALuint CreateWave(enum WaveType type, ALuint freq, ALuint srate)
ALenum err;
ALuint i;
- data_size = srate * sizeof(ALfloat);
+ data_size = (ALuint)(srate * sizeof(ALfloat));
data = calloc(1, data_size);
switch(type)
{
diff --git a/examples/common/alhelpers.c b/examples/common/alhelpers.c
index 730d2e13..0febef43 100644
--- a/examples/common/alhelpers.c
+++ b/examples/common/alhelpers.c
@@ -175,8 +175,8 @@ int altime_get(void)
void al_nssleep(unsigned long nsec)
{
struct timespec ts, rem;
- ts.tv_sec = nsec / 1000000000ul;
- ts.tv_nsec = nsec % 1000000000ul;
+ ts.tv_sec = (time_t)(nsec / 1000000000ul);
+ ts.tv_nsec = (long)(nsec % 1000000000ul);
while(nanosleep(&ts, &rem) == -1 && errno == EINTR)
ts = rem;
}