diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-15 21:36:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-15 21:36:27 +0000 |
commit | d54ab5595153b3dc57560077ff3551ffd4406b30 (patch) | |
tree | 9c48320521bf9ec3cb310c4046289d5a28ec3213 | |
parent | 4b12a38f6e566f44f5549b4a85e3ae9e715e0d08 (diff) | |
download | tdebase-d54ab5595153b3dc57560077ff3551ffd4406b30.tar.gz tdebase-d54ab5595153b3dc57560077ff3551ffd4406b30.zip |
Fix a number of issues in kdebase caused by C style casts
This includes Bug #492
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1247425 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
29 files changed, 101 insertions, 101 deletions
diff --git a/kcontrol/fonts/kxftconfig.cpp b/kcontrol/fonts/kxftconfig.cpp index fa4dc788e..6b7d166db 100644 --- a/kcontrol/fonts/kxftconfig.cpp +++ b/kcontrol/fonts/kxftconfig.cpp @@ -1147,7 +1147,7 @@ void KXftConfig::readContents() if(*ptr=='\"') { ptr++; - if(NULL!=(eostr=(char*)strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) + if(NULL!=(eostr=strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) { memcpy(data, ptr, eostr-ptr); data[eostr-ptr]='\0'; @@ -1183,7 +1183,7 @@ void KXftConfig::readContents() if(*ptr=='\"') { ptr++; - if(NULL!=(eostr=(char*)strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) + if(NULL!=(eostr=strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) { memcpy(data, ptr, eostr-ptr); data[eostr-ptr]='\0'; diff --git a/kcontrol/kfontinst/kfontinst/Fontmap.cpp b/kcontrol/kfontinst/kfontinst/Fontmap.cpp index 8b04ef7bd..2c8b80201 100644 --- a/kcontrol/kfontinst/kfontinst/Fontmap.cpp +++ b/kcontrol/kfontinst/kfontinst/Fontmap.cpp @@ -65,13 +65,13 @@ static bool parseLine(const char *line, TQString &ps, TQString &fname, bool &isA char a[constMaxLen+1], b[constFileMaxLen+1]; - char *slash1=(char*)strchr(line, '/'), + char *slash1=const_cast<char*>(strchr(line, '/')), *space1=slash1 ? (char*)findSpace(slash1) : NULL, //strchr(slash1, ' ') : NULL, - *ob=slash1 ? (char*)strchr(slash1, '(') : NULL, - *cb=ob ? (char*)strchr(ob, ')') : NULL, - *slash2=space1 && !ob && !cb ? (char*)strchr(space1, '/') : NULL, + *ob=slash1 ? strchr(slash1, '(') : NULL, + *cb=ob ? strchr(ob, ')') : NULL, + *slash2=space1 && !ob && !cb ? strchr(space1, '/') : NULL, *space2=slash2 ? (char*)findSpace(slash2) : NULL, // strchr(slash2, ' ') : NULL, - *semic=cb || space2 ? (char*)strchr(cb ? cb : space2, ';') : NULL; + *semic=cb || space2 ? strchr(cb ? cb : space2, ';') : NULL; if(semic && space1-slash1<constMaxLen) { diff --git a/kcontrol/kfontinst/kfontinst/XConfig.cpp b/kcontrol/kfontinst/kfontinst/XConfig.cpp index 112ab3d3c..7572e3894 100644 --- a/kcontrol/kfontinst/kfontinst/XConfig.cpp +++ b/kcontrol/kfontinst/kfontinst/XConfig.cpp @@ -356,8 +356,8 @@ static char * getItem(char **start, char **end, const char *key, unsigned int &s if(s && *s=='\"' && s<*end) { - char *e=(char*)strchr(s+1, '\"'), - *nl=(char*)strchr(s+1, '\n'); + char *e=strchr(s+1, '\"'), + *nl=strchr(s+1, '\n'); if(e && e<*end && (!nl || nl>e) && e-s<=constMaxItemLen) { diff --git a/kcontrol/samba/ksmbstatus.cpp b/kcontrol/samba/ksmbstatus.cpp index c94bc5129..bf775deab 100644 --- a/kcontrol/samba/ksmbstatus.cpp +++ b/kcontrol/samba/ksmbstatus.cpp @@ -136,7 +136,7 @@ void NetMon::slotReceivedData(KProcess *, char *buffer, int ) char s[250],*start,*end; size_t len; start = buffer; - while ((end = (char*)strchr(start,'\n'))) // look for '\n' + while ((end = strchr(start,'\n'))) // look for '\n' { len = end-start; if (len>=sizeof(s)) diff --git a/kdm/backend/auth.c b/kdm/backend/auth.c index 3fb18ac4c..bd183142c 100644 --- a/kdm/backend/auth.c +++ b/kdm/backend/auth.c @@ -944,7 +944,7 @@ setAuthNumber( Xauth *auth, const char *name ) colon = strrchr( name, ':' ); if (colon) { ++colon; - dot = (char*)strchr( colon, '.' ); + dot = strchr( colon, '.' ); if (dot) auth->number_length = dot - colon; else diff --git a/kdm/backend/client.c b/kdm/backend/client.c index 0807b2ce7..56d9fa09f 100644 --- a/kdm/backend/client.c +++ b/kdm/backend/client.c @@ -376,7 +376,7 @@ doPAMAuth( const char *psrv, struct pam_data *pdata ) V_RET_FAIL( 0 ); } if ((td->displayType & d_location) == dForeign) { - char *cp = (char*)strchr( td->name, ':' ); + char *cp = strchr( td->name, ':' ); *cp = 0; pretc = pam_set_item( pamh, PAM_RHOST, td->name ); *cp = ':'; @@ -566,7 +566,7 @@ Verify( GConvFunc gconv, int rootok ) char *tmpch; strncpy( hostname, td->name, sizeof(hostname) - 1 ); hostname[sizeof(hostname)-1] = '\0'; - if ((tmpch = (char*)strchr( hostname, ':' ))) + if ((tmpch = strchr( hostname, ':' ))) *tmpch = '\0'; } else hostname[0] = '\0'; diff --git a/kdm/backend/dm.c b/kdm/backend/dm.c index a372686df..d372dd472 100644 --- a/kdm/backend/dm.c +++ b/kdm/backend/dm.c @@ -133,7 +133,7 @@ main( int argc, char **argv ) memcpy( name, argv[0], len + 1 ); *--name = '/'; do { - if (!(pathe = (char*)strchr( path, ':' ))) + if (!(pathe = strchr( path, ':' ))) pathe = path + strlen( path ); len = pathe - path; if (!len || (len == 1 && *path == '.')) { diff --git a/kdm/backend/process.c b/kdm/backend/process.c index 8e21d789b..f9d34fe7f 100644 --- a/kdm/backend/process.c +++ b/kdm/backend/process.c @@ -276,7 +276,7 @@ locate( const char *exe ) memcpy( name, exe, len + 1 ); *--name = '/'; do { - if (!(pathe = (char*)strchr( path, ':' ))) + if (!(pathe = strchr( path, ':' ))) pathe = path + strlen( path ); len = pathe - path; if (len && !(len == 1 && *path == '.')) { diff --git a/kdm/backend/sessreg.c b/kdm/backend/sessreg.c index e603ff4c6..b507f8141 100644 --- a/kdm/backend/sessreg.c +++ b/kdm/backend/sessreg.c @@ -134,7 +134,7 @@ sessreg( struct display *d, int pid, const char *user, int uid ) } ut_ent.ut_time = time( 0 ); - colon = (char*)strchr( d->name, ':' ); + colon = strchr( d->name, ':' ); clen = strlen( colon ); if (clen > (int)(sizeof(ut_ent.ut_line) - UTL_OFF) - 2) return; /* uhm, well ... */ @@ -175,7 +175,7 @@ sessreg( struct display *d, int pid, const char *user, int uid ) colon = d->name; left = 0; } else { - dot = (char*)strchr( d->name, '.' ); + dot = strchr( d->name, '.' ); if (dot && dot - d->name < left) { memcpy( ut_ent.ut_line + UTL_OFF, d->name, left - 1 ); ut_ent.ut_line[UTL_OFF + left - 1] = '~'; diff --git a/kdm/backend/util.c b/kdm/backend/util.c index b980862f1..7dd58f031 100644 --- a/kdm/backend/util.c +++ b/kdm/backend/util.c @@ -413,7 +413,7 @@ putEnv( const char *string, char **env ) char *n; char *b; - if (!(b = (char*)strchr( string, '=' ))) + if (!(b = strchr( string, '=' ))) return NULL; if (!StrNDup( &n, string, b - string )) return NULL; diff --git a/kdm/backend/xdmcp.c b/kdm/backend/xdmcp.c index e82305f89..6abaf5fc8 100644 --- a/kdm/backend/xdmcp.c +++ b/kdm/backend/xdmcp.c @@ -395,8 +395,8 @@ NetworkAddressToName( CARD16 connectionType, ARRAY8Ptr connectionAddress, * this is as useful, and will confuse more * people */ - if ((localDot = (char*)strchr( localhost, '.' )) && - (remoteDot = (char*)strchr( hostname, '.' ))) + if ((localDot = strchr( localhost, '.' )) && + (remoteDot = strchr( hostname, '.' ))) { /* smash the name in place; it won't * be needed later. @@ -1099,7 +1099,7 @@ NetworkAddressToHostname( CARD16 connectionType, ARRAY8Ptr connectionAddress ) oki: if (StrDup( &name, he->h_name ) && !strchr( name, '.' ) && - (myDot = (char*)strchr( localHostname(), '.' ))) + (myDot = strchr( localHostname(), '.' ))) { if (ASPrintf( &lname, "%s%s", name, myDot )) { #if defined(IPv6) && defined(AF_INET6) diff --git a/kdm/kfrontend/genkdmconf.c b/kdm/kfrontend/genkdmconf.c index f0981afe8..d10fe754b 100644 --- a/kdm/kfrontend/genkdmconf.c +++ b/kdm/kfrontend/genkdmconf.c @@ -332,7 +332,7 @@ locate( const char *exe ) memcpy( name, exe, len + 1 ); *--name = '/'; do { - if (!(pathe = (char*)strchr( path, ':' ))) + if (!(pathe = strchr( path, ':' ))) pathe = path + strlen( path ); len = pathe - path; if (len && !(len == 1 && *path == '.')) { @@ -1345,7 +1345,7 @@ mk_willing( Entry *ce, Section *cs ATTR_UNUSED ) if (!ce->active) /* there is only the Global one */ goto dflt; else { - if (!(fname = (char*)strchr( ce->value, '/' ))) + if (!(fname = strchr( ce->value, '/' ))) return; /* obviously in-line (or empty) */ if (old_scripts || inNewDir( fname )) dlinkfile( fname ); diff --git a/kdm/kfrontend/kdmctl.c b/kdm/kfrontend/kdmctl.c index 82a12e653..72e133162 100644 --- a/kdm/kfrontend/kdmctl.c +++ b/kdm/kfrontend/kdmctl.c @@ -219,7 +219,7 @@ main( int argc, char **argv ) fprintf( stderr, "Cannot create UNIX socket\n" ); return 1; } - if (dpy && (ptr = (char*)strchr( dpy, ':' )) && (ptr = (char*)strchr( ptr, '.' ))) + if (dpy && (ptr = strchr( dpy, ':' )) && (ptr = strchr( ptr, '.' ))) *ptr = 0; if (ctl && *ctl) { if (!openctl( fd, 1, ctl, dpy )) diff --git a/kdmlib/dmctl.cpp b/kdmlib/dmctl.cpp index 5f3bd26f0..255a7b2ea 100644 --- a/kdmlib/dmctl.cpp +++ b/kdmlib/dmctl.cpp @@ -77,8 +77,8 @@ DM::DM() : fd( -1 ) } GDMAuthenticate(); } else { - if ((ptr = (char*)strchr( dpy, ':' ))) - ptr = (char*)strchr( ptr, '.' ); + if ((ptr = const_cast<char*>(strchr( dpy, ':' )))) + ptr = strchr( ptr, '.' ); snprintf( sa.sun_path, sizeof(sa.sun_path), "%s/dmctl-%.*s/socket", ctl, ptr ? int(ptr - dpy) : 512, dpy ); diff --git a/kioslave/man/man2html.cpp b/kioslave/man/man2html.cpp index c08a51443..ed0b39dd4 100644 --- a/kioslave/man/man2html.cpp +++ b/kioslave/man/man2html.cpp @@ -713,10 +713,10 @@ static void add_links(char *c) /* search for (section) */ nr=0; idtest[0]=strstr(c+1,"://"); - idtest[1]=(char*)strchr(c+1,'@'); + idtest[1]=strchr(c+1,'@'); idtest[2]=strstr(c,"www."); idtest[3]=strstr(c,"ftp."); - idtest[4]=(char*)strchr(c+1,'('); + idtest[4]=strchr(c+1,'('); idtest[5]=strstr(c+1,".h>"); for (i=0; i<numtests; ++i) nr += (idtest[i]!=NULL); while (nr) { @@ -771,7 +771,7 @@ static void add_links(char *c) case 4: /* manpage */ f=idtest[j]; /* check section */ - g=(char*)strchr(f,')'); + g=strchr(f,')'); // The character before f must alphanumeric, the end of a HTML tag or the end of a if (g!=NULL && f>c && (g-f)<12 && (isalnum(f[-1]) || f[-1]=='>' || ( f[-1] == ';' ) ) && isdigit(f[1]) && f[1]!='0' && ((g-f)<=2 || isalpha(f[2]))) @@ -937,10 +937,10 @@ static void add_links(char *c) } nr=0; if (idtest[0] && idtest[0]<=c) idtest[0]=strstr(c+1,"://"); - if (idtest[1] && idtest[1]<=c) idtest[1]=(char*)strchr(c+1,'@'); + if (idtest[1] && idtest[1]<=c) idtest[1]=strchr(c+1,'@'); if (idtest[2] && idtest[2]<c) idtest[2]=strstr(c,"www."); if (idtest[3] && idtest[3]<c) idtest[3]=strstr(c,"ftp."); - if (idtest[4] && idtest[4]<=c) idtest[4]=(char*)strchr(c+1,'('); + if (idtest[4] && idtest[4]<=c) idtest[4]=strchr(c+1,'('); if (idtest[5] && idtest[5]<=c) idtest[5]=strstr(c+1,".h>"); for (i=0; i<numtests; i++) nr += (idtest[i]!=NULL); } @@ -3715,8 +3715,8 @@ static char *scan_request(char *c) char* font[2] = { "B", "R" }; c+=j; if (*c=='\n') c++; - char *eol=(char*)strchr(c,'\n'); - char *semicolon=(char*)strchr(c,';'); + char *eol=strchr(c,'\n'); + char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); @@ -4340,7 +4340,7 @@ static char *scan_request(char *c) case REQ_Bl: // mdoc(7) "Begin List" { char list_options[NULL_TERMINATED(MED_STR_MAX)]; - char *nl = (char*)strchr(c,'\n'); + char *nl = strchr(c,'\n'); c=c+j; if (dl_set[itemdepth]) /* These things can nest. */ @@ -4521,7 +4521,7 @@ static char *scan_request(char *c) case REQ_Bd: /* mdoc(7) */ { /* Seems like a kind of example/literal mode */ char bd_options[NULL_TERMINATED(MED_STR_MAX)]; - char *nl = (char*)strchr(c,'\n'); + char *nl = strchr(c,'\n'); c=c+j; if (nl) strlimitcpy(bd_options, c, nl - c, MED_STR_MAX); @@ -4879,8 +4879,8 @@ static char *scan_request(char *c) } else if (!mandoc_name_count) { - char *nextbreak = (char*)strchr(c, '\n'); - char *nextspace = (char*)strchr(c, ' '); + char *nextbreak = strchr(c, '\n'); + char *nextspace = strchr(c, ' '); if (nextspace < nextbreak) nextbreak = nextspace; diff --git a/kioslave/nfs/kio_nfs.cpp b/kioslave/nfs/kio_nfs.cpp index ad19f70a7..7c3a67e9d 100644 --- a/kioslave/nfs/kio_nfs.cpp +++ b/kioslave/nfs/kio_nfs.cpp @@ -89,7 +89,7 @@ int x_getdomainname(char *name, size_t len) { if ((hent = gethostbyname(uts.nodename)) != 0L) { - char *p = (char*)strchr(hent->h_name, '.'); + char *p = strchr(hent->h_name, '.'); if (p != 0L) { ++p; diff --git a/konsole/konsole/keytrans.cpp b/konsole/konsole/keytrans.cpp index da197a695..b3aa76e9f 100644 --- a/konsole/konsole/keytrans.cpp +++ b/konsole/konsole/keytrans.cpp @@ -143,7 +143,7 @@ bool KeyTrans::findEntry(int key, int bits, int* cmd, const char** txt, int* len char *c; char mask = '1' + BITS(0, bits&(1<<BITS_Shift)) + BITS(1, bits&(1<<BITS_Alt)) + BITS(2, bits&(1<<BITS_Control)); strcpy(buf, it.current()->txt.ascii()); - c = (char*)strchr(buf, '*'); + c = strchr(buf, '*'); if (c) *c = mask; *txt = buf; } diff --git a/konsole/konsole/main.cpp b/konsole/konsole/main.cpp index 5b391a5e5..d37a43be3 100644 --- a/konsole/konsole/main.cpp +++ b/konsole/konsole/main.cpp @@ -111,7 +111,7 @@ const char *konsole_shell(TQStrList &args) if (shell == NULL || *shell == '\0') shell = "/bin/sh"; if (login_shell) { - char* t = (char*)strrchr(shell,'/'); + char* t = const_cast<char*>(strrchr(shell,'/')); if (t) // see sh(1) { t = strdup(t); @@ -451,7 +451,7 @@ extern "C" int KDE_EXPORT kdemain(int argc, char* argv[]) int c = 0, l = 0; if ( !sz.isEmpty() ) { - char *ls = (char*)strchr( sz.data(), 'x' ); + char *ls = strchr( sz.data(), 'x' ); if ( ls != NULL ) { *ls='\0'; diff --git a/ksmserver/legacy.cpp b/ksmserver/legacy.cpp index 1a1cea765..186fdcf64 100644 --- a/ksmserver/legacy.cpp +++ b/ksmserver/legacy.cpp @@ -356,7 +356,7 @@ TQString KSMServer::windowWmClientMachine(WId w) hostnamebuf[sizeof(hostnamebuf)-1] = 0; if (result == hostnamebuf) result = "localhost"; - if(char *dot = (char*)strchr(hostnamebuf, '.')) { + if(char *dot = strchr(hostnamebuf, '.')) { *dot = '\0'; if(result == hostnamebuf) result = "localhost"; diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index ecb3cdcde..f4068a8f3 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -366,12 +366,12 @@ Status SetAuthentication_local (int count, IceListenObj *listenObjs) for (i = 0; i < count; i ++) { char *prot = IceGetListenConnectionString(listenObjs[i]); if (!prot) continue; - char *host = (char*)strchr(prot, '/'); + char *host = strchr(prot, '/'); char *sock = 0; if (host) { *host=0; host++; - sock = (char*)strchr(host, ':'); + sock = strchr(host, ':'); if (sock) { *sock = 0; sock++; diff --git a/ksysguard/ksysguardd/Linux/ProcessList.c b/ksysguard/ksysguardd/Linux/ProcessList.c index e9e8c1315..b267c7005 100644 --- a/ksysguard/ksysguardd/Linux/ProcessList.c +++ b/ksysguard/ksysguardd/Linux/ProcessList.c @@ -292,7 +292,7 @@ static int updateProcess( int pid ) strncmp( ps->cmdline, "kdeinit: ", KDEINITLEN ) == 0 && strcmp( ps->cmdline + KDEINITLEN, "Running..." ) != 0 ) { size_t len; - char* end = (char*)strchr( ps->cmdline + KDEINITLEN, ' ' ); + char* end = strchr( ps->cmdline + KDEINITLEN, ' ' ); if ( end ) len = ( end - ps->cmdline ) - KDEINITLEN; else diff --git a/ksysguard/ksysguardd/Linux/acpi.c b/ksysguard/ksysguardd/Linux/acpi.c index 6e9470b59..b3100c363 100644 --- a/ksysguard/ksysguardd/Linux/acpi.c +++ b/ksysguard/ksysguardd/Linux/acpi.c @@ -130,7 +130,7 @@ int updateAcpiBattery( void ) p = AcpiBatInfoBuf; while ( ( p!= NULL ) && ( sscanf( p, "last full capacity: %d ", &AcpiBatCapacity ) != 1 ) ) { - p = (char*)strchr( p, '\n' ); + p = strchr( p, '\n' ); if ( p ) p++; } @@ -152,7 +152,7 @@ int updateAcpiBattery( void ) p = AcpiBatStateBuf; while ( ( p!= NULL ) && ( sscanf( p, "remaining capacity: %d ", &AcpiBatRemainingCapacity ) != 1 ) ) { - p = (char*)strchr( p, '\n' ); + p = strchr( p, '\n' ); if ( p ) p++; } @@ -161,7 +161,7 @@ int updateAcpiBattery( void ) p = AcpiBatStateBuf; while ( ( p!= NULL ) && ( sscanf( p, "present rate: %d ", &AcpiBatteryUsage[i] ) != 1 ) ) { - p = (char*)strchr( p, '\n' ); + p = strchr( p, '\n' ); if ( p ) p++; } @@ -229,12 +229,12 @@ void printAcpiBatUsageInfo( const char* cmd) static int extract_zone_name(char **startidx, const char *cmd) { char *idx = NULL; - idx = (char*)strchr(cmd, '/'); + idx = strchr(cmd, '/'); if (idx == NULL) return 0; - idx = (char*)strchr(idx+1, '/'); + idx = strchr(idx+1, '/'); if (idx == NULL) return 0; *startidx = idx+1; - idx = (char*)strchr(*startidx, '/'); + idx = strchr(*startidx, '/'); if (idx == NULL) return 0; return idx - *startidx; } diff --git a/ksysguard/ksysguardd/Linux/cpuinfo.c b/ksysguard/ksysguardd/Linux/cpuinfo.c index fa55aabd9..de5deb80f 100644 --- a/ksysguard/ksysguardd/Linux/cpuinfo.c +++ b/ksysguard/ksysguardd/Linux/cpuinfo.c @@ -83,7 +83,7 @@ static void processCpuInfo( void ) sscanf( value, "%f", &Clocks[ cpuId ] ); /* Move cibp to begining of next line, if there is one. */ - cibp = (char*)strchr( cibp, '\n' ); + cibp = strchr( cibp, '\n' ); if ( cibp ) cibp++; else diff --git a/ksysguard/ksysguardd/Linux/netdev.c b/ksysguard/ksysguardd/Linux/netdev.c index bba927e19..c2ef2d16f 100644 --- a/ksysguard/ksysguardd/Linux/netdev.c +++ b/ksysguard/ksysguardd/Linux/netdev.c @@ -165,7 +165,7 @@ static int processNetDev_( void ) netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */ if ( sscanf( buf, devFormat, tag ) ) { - char* pos = (char*)strchr( tag, ':' ); + char* pos = strchr( tag, ':' ); if ( pos ) { FORALL( DEFVARS ); *pos = '\0'; @@ -289,7 +289,7 @@ void initNetDev( struct SensorModul* sm ) netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */ if ( sscanf( buf, devFormat, tag ) ) { - char* pos = (char*)strchr( tag, ':' ); + char* pos = strchr( tag, ':' ); if ( pos ) { char mon[ MON_SIZE ]; *pos = '\0'; @@ -450,9 +450,9 @@ void printNetDev##a( const char* cmd ) \ char* end; \ char dev[ 64 ]; \ \ - beg = (char*)strchr( cmd, '/' ); \ - beg = (char*)strchr( beg + 1, '/' ); \ - end = (char*)strchr( beg + 1, '/' ); \ + beg = strchr( cmd, '/' ); \ + beg = strchr( beg + 1, '/' ); \ + end = strchr( beg + 1, '/' ); \ strncpy( dev, beg + 1, end - beg - 1 ); \ dev[ end - beg - 1 ] = '\0'; \ \ diff --git a/ksysguard/ksysguardd/Linux/stat.c b/ksysguard/ksysguardd/Linux/stat.c index 9bc576deb..0e03e4d53 100644 --- a/ksysguard/ksysguardd/Linux/stat.c +++ b/ksysguard/ksysguardd/Linux/stat.c @@ -267,10 +267,10 @@ static int processDiskIO( const char* buf ) } /* Move p after the sencond ')'. We can safely assume that * those two ')' exist. */ - p = (char*)strchr( p, ')' ) + 1; - p = (char*)strchr( p, ')' ) + 1; + p = strchr( p, ')' ) + 1; + p = strchr( p, ')' ) + 1; if ( p && *p ) - p = (char*)strchr( p, '(' ); + p = strchr( p, '(' ); } return 0; diff --git a/ksysguard/ksysguardd/Solaris/NetDev.c b/ksysguard/ksysguardd/Solaris/NetDev.c index 836e2832b..89db266cb 100644 --- a/ksysguard/ksysguardd/Solaris/NetDev.c +++ b/ksysguard/ksysguardd/Solaris/NetDev.c @@ -436,9 +436,9 @@ void printIPackets( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -464,9 +464,9 @@ void printOPackets( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -492,9 +492,9 @@ void printIErrors( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -520,9 +520,9 @@ void printOErrors( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -548,9 +548,9 @@ void printCollisions( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -576,9 +576,9 @@ void printMultiXmits( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -604,9 +604,9 @@ void printMultiRecvs( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -632,9 +632,9 @@ void printBcastXmits( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -660,9 +660,9 @@ void printBcastRecvs( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { diff --git a/ksysguard/ksysguardd/Tru64/NetDev.c b/ksysguard/ksysguardd/Tru64/NetDev.c index a28c7ecf7..0699b929a 100644 --- a/ksysguard/ksysguardd/Tru64/NetDev.c +++ b/ksysguard/ksysguardd/Tru64/NetDev.c @@ -435,9 +435,9 @@ void printIPackets( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -463,9 +463,9 @@ void printOPackets( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -491,9 +491,9 @@ void printIErrors( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -519,9 +519,9 @@ void printOErrors( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -547,9 +547,9 @@ void printCollisions( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -575,9 +575,9 @@ void printMultiXmits( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -603,9 +603,9 @@ void printMultiRecvs( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -631,9 +631,9 @@ void printBcastXmits( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { @@ -659,9 +659,9 @@ void printBcastRecvs( const char *cmd ) { char *name, *ptr; int i; - ptr = (char*)strchr( cmdcopy, (int) '/' ); + ptr = strchr( cmdcopy, (int) '/' ); name = ++ptr; - ptr = (char*)strchr( name, (int) '/' ); + ptr = strchr( name, (int) '/' ); *ptr = '\0'; for( i = 0; i < NetDevCount; i++ ) { diff --git a/ksysguard/ksysguardd/conf.c b/ksysguard/ksysguardd/conf.c index 7f48ee590..1d857137b 100644 --- a/ksysguard/ksysguardd/conf.c +++ b/ksysguard/ksysguardd/conf.c @@ -93,9 +93,9 @@ void parseConfigFile( const char *filename ) if ( line[ strlen( line ) - 1 ] == '\n' ) line[ strlen( line ) - 1 ] = '\0'; - if ( !strncmp( line, "RegisterDomain",14) && (begin = (char*)strchr( line, '=' )) ) RegisterDomain=strdup(begin+1); + if ( !strncmp( line, "RegisterDomain",14) && (begin = strchr( line, '=' )) ) RegisterDomain=strdup(begin+1); - if ( !strncmp( line, "LogFiles", 8 ) && (begin = (char*)strchr( line, '=' )) ) { + if ( !strncmp( line, "LogFiles", 8 ) && (begin = strchr( line, '=' )) ) { begin++; for ( token = strtok( begin, "," ); token; token = strtok( NULL, "," ) ) { @@ -104,7 +104,7 @@ void parseConfigFile( const char *filename ) continue; } confLog->name = strdup( token ); - tmp = (char*)strchr( confLog->name, ':' ); + tmp = strchr( confLog->name, ':' ); *tmp = '\0'; confLog->path = tmp; confLog->path++; @@ -113,7 +113,7 @@ void parseConfigFile( const char *filename ) } } - if ( !strncmp( line, "Sensors", 7 ) && (begin = (char*)strchr( line, '=' )) ) { + if ( !strncmp( line, "Sensors", 7 ) && (begin = strchr( line, '=' )) ) { begin++; for ( token = strtok( begin, ","); token; token = strtok( NULL, "," ) ) diff --git a/kwin/utils.cpp b/kwin/utils.cpp index 8e43901f3..de422f40e 100644 --- a/kwin/utils.cpp +++ b/kwin/utils.cpp @@ -317,7 +317,7 @@ bool isLocalMachine( const TQCString& host ) hostnamebuf[sizeof(hostnamebuf)-1] = 0; if (host == hostnamebuf) return true; - if( char *dot = (char*)strchr(hostnamebuf, '.')) + if( char *dot = strchr(hostnamebuf, '.')) { *dot = '\0'; if( host == hostnamebuf ) |