Remove some redundant casts.

This commit is contained in:
Markus Armbruster 2005-06-12 08:17:13 +00:00
parent 4f59fc9967
commit 8585ec930f
7 changed files with 13 additions and 14 deletions

View file

@ -105,8 +105,8 @@ turn(void)
if (msgfilepath == downfil) if (msgfilepath == downfil)
pr("Logins disabled.\n"); pr("Logins disabled.\n");
if ((fwrite((void *)&tgm, sizeof(tgm), 1, fptr) != 1) || if ((fwrite(&tgm, sizeof(tgm), 1, fptr) != 1) ||
(fwrite((void *)buf, tgm.tel_length, 1, fptr) != 1)) { (fwrite(buf, tgm.tel_length, 1, fptr) != 1)) {
fclose(fptr); fclose(fptr);
pr("Something went wrong writing the message file.\n"); pr("Something went wrong writing the message file.\n");
logerror("Could not properly write message file (%s).\n", logerror("Could not properly write message file (%s).\n",

View file

@ -481,8 +481,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
if (size < loc_MIN_THREAD_STACK) if (size < loc_MIN_THREAD_STACK)
size = loc_MIN_THREAD_STACK; size = loc_MIN_THREAD_STACK;
pThread->ulThreadID = _beginthread(empth_threadMain, size, pThread->ulThreadID = _beginthread(empth_threadMain, size, pThread);
(void *)pThread);
if (pThread->ulThreadID == -1) { if (pThread->ulThreadID == -1) {
logerror("can not create thread: %s (%s): %s", name, desc, logerror("can not create thread: %s (%s): %s", name, desc,
strerror(errno)); strerror(errno));

View file

@ -215,9 +215,9 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
#ifdef _DECTHREADS_ #ifdef _DECTHREADS_
eno = pthread_create(&t, attr, empth_start, (void *)ctx) ? errno : 0; eno = pthread_create(&t, attr, empth_start, ctx) ? errno : 0;
#else #else
eno = pthread_create(&t, &attr, empth_start, (void *)ctx); eno = pthread_create(&t, &attr, empth_start, ctx);
#endif #endif
if (eno) { if (eno) {
logerror("can not create thread: %s (%s): %s", name, desc, 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); ctx_ptr = (empth_t *)pthread_getspecific(ctx_key);
#endif #endif
ctx_ptr->ud = ct; ctx_ptr->ud = ct;
*udata = ((empth_t *)ctx_ptr)->ud; *udata = ctx_ptr->ud;
pthread_setspecific(ctx_key, (void *)ctx_ptr); pthread_setspecific(ctx_key, ctx_ptr);
empth_status("context saved"); empth_status("context saved");
} }
#endif #endif

View file

@ -160,7 +160,7 @@ gamedown(void)
return 0; return 0;
if ((down_fp = fopen(downfil, "rb")) == NULL) if ((down_fp = fopen(downfil, "rb")) == NULL)
return 0; 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)"); logerror("bad header on login message (downfil)");
fclose(down_fp); fclose(down_fp);
return 1; return 1;

View file

@ -358,7 +358,7 @@ show_motd(void)
return RET_SYS; 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)"); logerror("bad header on login message (motdfil)");
fclose(motd_fp); fclose(motd_fp);
return RET_FAIL; return RET_FAIL;

View file

@ -114,7 +114,7 @@ copy_and_expire(FILE *annfp, FILE *tmpfp, char *tmp_filename,
int saved = 0; int saved = 0;
int first = 1; int first = 1;
while (fread((void *)&tgm, sizeof(tgm), 1, annfp) == 1) { while (fread(&tgm, sizeof(tgm), 1, annfp) == 1) {
writeit = 1; writeit = 1;
if (tgm.tel_length < 0 || tgm.tel_length > MAXTELSIZE) { if (tgm.tel_length < 0 || tgm.tel_length > MAXTELSIZE) {
logerror("bad telegram file header (length=%ld)", logerror("bad telegram file header (length=%ld)",
@ -136,7 +136,7 @@ copy_and_expire(FILE *annfp, FILE *tmpfp, char *tmp_filename,
writeit = 0; writeit = 0;
if (writeit) { 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 " logerror("error writing header to temporary "
"telegram file %s", tmp_filename); "telegram file %s", tmp_filename);
return 0; return 0;

View file

@ -1115,8 +1115,8 @@ write_file(void)
{ {
int n; int n;
if ((n = fwrite((void *)sectsbuf, sizeof(struct sctstr), n = fwrite(sectsbuf, sizeof(struct sctstr), YSIZE * XSIZE, sect_fptr);
YSIZE * XSIZE, sect_fptr)) <= 0) { if (n <= 0) {
perror(empfile[EF_SECTOR].file); perror(empfile[EF_SECTOR].file);
return -1; return -1;
} }