diff --git a/src/lib/commands/turn.c b/src/lib/commands/turn.c index 6a365eff..1c35ef53 100644 --- a/src/lib/commands/turn.c +++ b/src/lib/commands/turn.c @@ -105,8 +105,8 @@ turn(void) if (msgfilepath == downfil) pr("Logins disabled.\n"); - if ((fwrite((void *)&tgm, sizeof(tgm), 1, fptr) != 1) || - (fwrite((void *)buf, tgm.tel_length, 1, fptr) != 1)) { + if ((fwrite(&tgm, sizeof(tgm), 1, fptr) != 1) || + (fwrite(buf, tgm.tel_length, 1, fptr) != 1)) { fclose(fptr); pr("Something went wrong writing the message file.\n"); logerror("Could not properly write message file (%s).\n", diff --git a/src/lib/empthread/ntthread.c b/src/lib/empthread/ntthread.c index 5d87ed73..529cbf86 100644 --- a/src/lib/empthread/ntthread.c +++ b/src/lib/empthread/ntthread.c @@ -481,8 +481,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags, if (size < loc_MIN_THREAD_STACK) size = loc_MIN_THREAD_STACK; - pThread->ulThreadID = _beginthread(empth_threadMain, size, - (void *)pThread); + pThread->ulThreadID = _beginthread(empth_threadMain, size, pThread); if (pThread->ulThreadID == -1) { logerror("can not create thread: %s (%s): %s", name, desc, strerror(errno)); diff --git a/src/lib/empthread/pthread.c b/src/lib/empthread/pthread.c index 6379d5b0..a01c1b5e 100644 --- a/src/lib/empthread/pthread.c +++ b/src/lib/empthread/pthread.c @@ -215,9 +215,9 @@ empth_create(int prio, void (*entry)(void *), int size, int flags, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); #ifdef _DECTHREADS_ - eno = pthread_create(&t, attr, empth_start, (void *)ctx) ? errno : 0; + eno = pthread_create(&t, attr, empth_start, ctx) ? errno : 0; #else - eno = pthread_create(&t, &attr, empth_start, (void *)ctx); + eno = pthread_create(&t, &attr, empth_start, ctx); #endif if (eno) { logerror("can not create thread: %s (%s): %s", name, desc, @@ -246,8 +246,8 @@ empth_setctx(void *ct) ctx_ptr = (empth_t *)pthread_getspecific(ctx_key); #endif ctx_ptr->ud = ct; - *udata = ((empth_t *)ctx_ptr)->ud; - pthread_setspecific(ctx_key, (void *)ctx_ptr); + *udata = ctx_ptr->ud; + pthread_setspecific(ctx_key, ctx_ptr); empth_status("context saved"); } #endif diff --git a/src/lib/player/empdis.c b/src/lib/player/empdis.c index 831710a9..56a75163 100644 --- a/src/lib/player/empdis.c +++ b/src/lib/player/empdis.c @@ -160,7 +160,7 @@ gamedown(void) return 0; if ((down_fp = fopen(downfil, "rb")) == NULL) return 0; - if (fread((void *)&tgm, sizeof(tgm), 1, down_fp) != 1) { + if (fread(&tgm, sizeof(tgm), 1, down_fp) != 1) { logerror("bad header on login message (downfil)"); fclose(down_fp); return 1; diff --git a/src/lib/player/player.c b/src/lib/player/player.c index ae4447ab..51932422 100644 --- a/src/lib/player/player.c +++ b/src/lib/player/player.c @@ -358,7 +358,7 @@ show_motd(void) return RET_SYS; } } - if (fread((void *)&tgm, sizeof(tgm), 1, motd_fp) != 1) { + if (fread(&tgm, sizeof(tgm), 1, motd_fp) != 1) { logerror("bad header on login message (motdfil)"); fclose(motd_fp); return RET_FAIL; diff --git a/src/lib/update/anno.c b/src/lib/update/anno.c index 46b0a02c..8895ef4b 100644 --- a/src/lib/update/anno.c +++ b/src/lib/update/anno.c @@ -114,7 +114,7 @@ copy_and_expire(FILE *annfp, FILE *tmpfp, char *tmp_filename, int saved = 0; int first = 1; - while (fread((void *)&tgm, sizeof(tgm), 1, annfp) == 1) { + while (fread(&tgm, sizeof(tgm), 1, annfp) == 1) { writeit = 1; if (tgm.tel_length < 0 || tgm.tel_length > MAXTELSIZE) { logerror("bad telegram file header (length=%ld)", @@ -136,7 +136,7 @@ copy_and_expire(FILE *annfp, FILE *tmpfp, char *tmp_filename, writeit = 0; if (writeit) { - if (fwrite((void *)&tgm, sizeof(tgm), 1, tmpfp) != 1) { + if (fwrite(&tgm, sizeof(tgm), 1, tmpfp) != 1) { logerror("error writing header to temporary " "telegram file %s", tmp_filename); return 0; diff --git a/src/util/fairland.c b/src/util/fairland.c index 088aca3c..b6f0d7a1 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -1115,8 +1115,8 @@ write_file(void) { int n; - if ((n = fwrite((void *)sectsbuf, sizeof(struct sctstr), - YSIZE * XSIZE, sect_fptr)) <= 0) { + n = fwrite(sectsbuf, sizeof(struct sctstr), YSIZE * XSIZE, sect_fptr); + if (n <= 0) { perror(empfile[EF_SECTOR].file); return -1; }