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
v3.5.13-sru
tpearson 13 years ago
parent 4b12a38f6e
commit d54ab55951

@ -1147,7 +1147,7 @@ void KXftConfig::readContents()
if(*ptr=='\"') if(*ptr=='\"')
{ {
ptr++; ptr++;
if(NULL!=(eostr=(char*)strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) if(NULL!=(eostr=strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen)
{ {
memcpy(data, ptr, eostr-ptr); memcpy(data, ptr, eostr-ptr);
data[eostr-ptr]='\0'; data[eostr-ptr]='\0';
@ -1183,7 +1183,7 @@ void KXftConfig::readContents()
if(*ptr=='\"') if(*ptr=='\"')
{ {
ptr++; ptr++;
if(NULL!=(eostr=(char*)strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) if(NULL!=(eostr=strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen)
{ {
memcpy(data, ptr, eostr-ptr); memcpy(data, ptr, eostr-ptr);
data[eostr-ptr]='\0'; data[eostr-ptr]='\0';

@ -65,13 +65,13 @@ static bool parseLine(const char *line, TQString &ps, TQString &fname, bool &isA
char a[constMaxLen+1], char a[constMaxLen+1],
b[constFileMaxLen+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, *space1=slash1 ? (char*)findSpace(slash1) : NULL, //strchr(slash1, ' ') : NULL,
*ob=slash1 ? (char*)strchr(slash1, '(') : NULL, *ob=slash1 ? strchr(slash1, '(') : NULL,
*cb=ob ? (char*)strchr(ob, ')') : NULL, *cb=ob ? strchr(ob, ')') : NULL,
*slash2=space1 && !ob && !cb ? (char*)strchr(space1, '/') : NULL, *slash2=space1 && !ob && !cb ? strchr(space1, '/') : NULL,
*space2=slash2 ? (char*)findSpace(slash2) : NULL, // strchr(slash2, ' ') : 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) if(semic && space1-slash1<constMaxLen)
{ {

@ -356,8 +356,8 @@ static char * getItem(char **start, char **end, const char *key, unsigned int &s
if(s && *s=='\"' && s<*end) if(s && *s=='\"' && s<*end)
{ {
char *e=(char*)strchr(s+1, '\"'), char *e=strchr(s+1, '\"'),
*nl=(char*)strchr(s+1, '\n'); *nl=strchr(s+1, '\n');
if(e && e<*end && (!nl || nl>e) && e-s<=constMaxItemLen) if(e && e<*end && (!nl || nl>e) && e-s<=constMaxItemLen)
{ {

@ -136,7 +136,7 @@ void NetMon::slotReceivedData(KProcess *, char *buffer, int )
char s[250],*start,*end; char s[250],*start,*end;
size_t len; size_t len;
start = buffer; start = buffer;
while ((end = (char*)strchr(start,'\n'))) // look for '\n' while ((end = strchr(start,'\n'))) // look for '\n'
{ {
len = end-start; len = end-start;
if (len>=sizeof(s)) if (len>=sizeof(s))

@ -944,7 +944,7 @@ setAuthNumber( Xauth *auth, const char *name )
colon = strrchr( name, ':' ); colon = strrchr( name, ':' );
if (colon) { if (colon) {
++colon; ++colon;
dot = (char*)strchr( colon, '.' ); dot = strchr( colon, '.' );
if (dot) if (dot)
auth->number_length = dot - colon; auth->number_length = dot - colon;
else else

@ -376,7 +376,7 @@ doPAMAuth( const char *psrv, struct pam_data *pdata )
V_RET_FAIL( 0 ); V_RET_FAIL( 0 );
} }
if ((td->displayType & d_location) == dForeign) { if ((td->displayType & d_location) == dForeign) {
char *cp = (char*)strchr( td->name, ':' ); char *cp = strchr( td->name, ':' );
*cp = 0; *cp = 0;
pretc = pam_set_item( pamh, PAM_RHOST, td->name ); pretc = pam_set_item( pamh, PAM_RHOST, td->name );
*cp = ':'; *cp = ':';
@ -566,7 +566,7 @@ Verify( GConvFunc gconv, int rootok )
char *tmpch; char *tmpch;
strncpy( hostname, td->name, sizeof(hostname) - 1 ); strncpy( hostname, td->name, sizeof(hostname) - 1 );
hostname[sizeof(hostname)-1] = '\0'; hostname[sizeof(hostname)-1] = '\0';
if ((tmpch = (char*)strchr( hostname, ':' ))) if ((tmpch = strchr( hostname, ':' )))
*tmpch = '\0'; *tmpch = '\0';
} else } else
hostname[0] = '\0'; hostname[0] = '\0';

@ -133,7 +133,7 @@ main( int argc, char **argv )
memcpy( name, argv[0], len + 1 ); memcpy( name, argv[0], len + 1 );
*--name = '/'; *--name = '/';
do { do {
if (!(pathe = (char*)strchr( path, ':' ))) if (!(pathe = strchr( path, ':' )))
pathe = path + strlen( path ); pathe = path + strlen( path );
len = pathe - path; len = pathe - path;
if (!len || (len == 1 && *path == '.')) { if (!len || (len == 1 && *path == '.')) {

@ -276,7 +276,7 @@ locate( const char *exe )
memcpy( name, exe, len + 1 ); memcpy( name, exe, len + 1 );
*--name = '/'; *--name = '/';
do { do {
if (!(pathe = (char*)strchr( path, ':' ))) if (!(pathe = strchr( path, ':' )))
pathe = path + strlen( path ); pathe = path + strlen( path );
len = pathe - path; len = pathe - path;
if (len && !(len == 1 && *path == '.')) { if (len && !(len == 1 && *path == '.')) {

@ -134,7 +134,7 @@ sessreg( struct display *d, int pid, const char *user, int uid )
} }
ut_ent.ut_time = time( 0 ); ut_ent.ut_time = time( 0 );
colon = (char*)strchr( d->name, ':' ); colon = strchr( d->name, ':' );
clen = strlen( colon ); clen = strlen( colon );
if (clen > (int)(sizeof(ut_ent.ut_line) - UTL_OFF) - 2) if (clen > (int)(sizeof(ut_ent.ut_line) - UTL_OFF) - 2)
return; /* uhm, well ... */ return; /* uhm, well ... */
@ -175,7 +175,7 @@ sessreg( struct display *d, int pid, const char *user, int uid )
colon = d->name; colon = d->name;
left = 0; left = 0;
} else { } else {
dot = (char*)strchr( d->name, '.' ); dot = strchr( d->name, '.' );
if (dot && dot - d->name < left) { if (dot && dot - d->name < left) {
memcpy( ut_ent.ut_line + UTL_OFF, d->name, left - 1 ); memcpy( ut_ent.ut_line + UTL_OFF, d->name, left - 1 );
ut_ent.ut_line[UTL_OFF + left - 1] = '~'; ut_ent.ut_line[UTL_OFF + left - 1] = '~';

@ -413,7 +413,7 @@ putEnv( const char *string, char **env )
char *n; char *n;
char *b; char *b;
if (!(b = (char*)strchr( string, '=' ))) if (!(b = strchr( string, '=' )))
return NULL; return NULL;
if (!StrNDup( &n, string, b - string )) if (!StrNDup( &n, string, b - string ))
return NULL; return NULL;

@ -395,8 +395,8 @@ NetworkAddressToName( CARD16 connectionType, ARRAY8Ptr connectionAddress,
* this is as useful, and will confuse more * this is as useful, and will confuse more
* people * people
*/ */
if ((localDot = (char*)strchr( localhost, '.' )) && if ((localDot = strchr( localhost, '.' )) &&
(remoteDot = (char*)strchr( hostname, '.' ))) (remoteDot = strchr( hostname, '.' )))
{ {
/* smash the name in place; it won't /* smash the name in place; it won't
* be needed later. * be needed later.
@ -1099,7 +1099,7 @@ NetworkAddressToHostname( CARD16 connectionType, ARRAY8Ptr connectionAddress )
oki: oki:
if (StrDup( &name, he->h_name ) && if (StrDup( &name, he->h_name ) &&
!strchr( name, '.' ) && !strchr( name, '.' ) &&
(myDot = (char*)strchr( localHostname(), '.' ))) (myDot = strchr( localHostname(), '.' )))
{ {
if (ASPrintf( &lname, "%s%s", name, myDot )) { if (ASPrintf( &lname, "%s%s", name, myDot )) {
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)

@ -332,7 +332,7 @@ locate( const char *exe )
memcpy( name, exe, len + 1 ); memcpy( name, exe, len + 1 );
*--name = '/'; *--name = '/';
do { do {
if (!(pathe = (char*)strchr( path, ':' ))) if (!(pathe = strchr( path, ':' )))
pathe = path + strlen( path ); pathe = path + strlen( path );
len = pathe - path; len = pathe - path;
if (len && !(len == 1 && *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 */ if (!ce->active) /* there is only the Global one */
goto dflt; goto dflt;
else { else {
if (!(fname = (char*)strchr( ce->value, '/' ))) if (!(fname = strchr( ce->value, '/' )))
return; /* obviously in-line (or empty) */ return; /* obviously in-line (or empty) */
if (old_scripts || inNewDir( fname )) if (old_scripts || inNewDir( fname ))
dlinkfile( fname ); dlinkfile( fname );

@ -219,7 +219,7 @@ main( int argc, char **argv )
fprintf( stderr, "Cannot create UNIX socket\n" ); fprintf( stderr, "Cannot create UNIX socket\n" );
return 1; return 1;
} }
if (dpy && (ptr = (char*)strchr( dpy, ':' )) && (ptr = (char*)strchr( ptr, '.' ))) if (dpy && (ptr = strchr( dpy, ':' )) && (ptr = strchr( ptr, '.' )))
*ptr = 0; *ptr = 0;
if (ctl && *ctl) { if (ctl && *ctl) {
if (!openctl( fd, 1, ctl, dpy )) if (!openctl( fd, 1, ctl, dpy ))

@ -77,8 +77,8 @@ DM::DM() : fd( -1 )
} }
GDMAuthenticate(); GDMAuthenticate();
} else { } else {
if ((ptr = (char*)strchr( dpy, ':' ))) if ((ptr = const_cast<char*>(strchr( dpy, ':' ))))
ptr = (char*)strchr( ptr, '.' ); ptr = strchr( ptr, '.' );
snprintf( sa.sun_path, sizeof(sa.sun_path), snprintf( sa.sun_path, sizeof(sa.sun_path),
"%s/dmctl-%.*s/socket", "%s/dmctl-%.*s/socket",
ctl, ptr ? int(ptr - dpy) : 512, dpy ); ctl, ptr ? int(ptr - dpy) : 512, dpy );

@ -713,10 +713,10 @@ static void add_links(char *c)
/* search for (section) */ /* search for (section) */
nr=0; nr=0;
idtest[0]=strstr(c+1,"://"); idtest[0]=strstr(c+1,"://");
idtest[1]=(char*)strchr(c+1,'@'); idtest[1]=strchr(c+1,'@');
idtest[2]=strstr(c,"www."); idtest[2]=strstr(c,"www.");
idtest[3]=strstr(c,"ftp."); idtest[3]=strstr(c,"ftp.");
idtest[4]=(char*)strchr(c+1,'('); idtest[4]=strchr(c+1,'(');
idtest[5]=strstr(c+1,".h&gt;"); idtest[5]=strstr(c+1,".h&gt;");
for (i=0; i<numtests; ++i) nr += (idtest[i]!=NULL); for (i=0; i<numtests; ++i) nr += (idtest[i]!=NULL);
while (nr) { while (nr) {
@ -771,7 +771,7 @@ static void add_links(char *c)
case 4: /* manpage */ case 4: /* manpage */
f=idtest[j]; f=idtest[j];
/* check section */ /* 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 &nbsp; // The character before f must alphanumeric, the end of a HTML tag or the end of a &nbsp;
if (g!=NULL && f>c && (g-f)<12 && (isalnum(f[-1]) || f[-1]=='>' || ( f[-1] == ';' ) ) && 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]))) isdigit(f[1]) && f[1]!='0' && ((g-f)<=2 || isalpha(f[2])))
@ -937,10 +937,10 @@ static void add_links(char *c)
} }
nr=0; nr=0;
if (idtest[0] && idtest[0]<=c) idtest[0]=strstr(c+1,"://"); 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[2] && idtest[2]<c) idtest[2]=strstr(c,"www.");
if (idtest[3] && idtest[3]<c) idtest[3]=strstr(c,"ftp."); 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&gt;"); if (idtest[5] && idtest[5]<=c) idtest[5]=strstr(c+1,".h&gt;");
for (i=0; i<numtests; i++) nr += (idtest[i]!=NULL); 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" }; char* font[2] = { "B", "R" };
c+=j; c+=j;
if (*c=='\n') c++; if (*c=='\n') c++;
char *eol=(char*)strchr(c,'\n'); char *eol=strchr(c,'\n');
char *semicolon=(char*)strchr(c,';'); char *semicolon=strchr(c,';');
if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; if ((semicolon!=0) && (semicolon<eol)) *semicolon=' ';
sl=fill_words(c, wordlist, &words, true, &c); 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" case REQ_Bl: // mdoc(7) "Begin List"
{ {
char list_options[NULL_TERMINATED(MED_STR_MAX)]; char list_options[NULL_TERMINATED(MED_STR_MAX)];
char *nl = (char*)strchr(c,'\n'); char *nl = strchr(c,'\n');
c=c+j; c=c+j;
if (dl_set[itemdepth]) if (dl_set[itemdepth])
/* These things can nest. */ /* These things can nest. */
@ -4521,7 +4521,7 @@ static char *scan_request(char *c)
case REQ_Bd: /* mdoc(7) */ case REQ_Bd: /* mdoc(7) */
{ /* Seems like a kind of example/literal mode */ { /* Seems like a kind of example/literal mode */
char bd_options[NULL_TERMINATED(MED_STR_MAX)]; char bd_options[NULL_TERMINATED(MED_STR_MAX)];
char *nl = (char*)strchr(c,'\n'); char *nl = strchr(c,'\n');
c=c+j; c=c+j;
if (nl) if (nl)
strlimitcpy(bd_options, c, nl - c, MED_STR_MAX); strlimitcpy(bd_options, c, nl - c, MED_STR_MAX);
@ -4879,8 +4879,8 @@ static char *scan_request(char *c)
} }
else if (!mandoc_name_count) else if (!mandoc_name_count)
{ {
char *nextbreak = (char*)strchr(c, '\n'); char *nextbreak = strchr(c, '\n');
char *nextspace = (char*)strchr(c, ' '); char *nextspace = strchr(c, ' ');
if (nextspace < nextbreak) if (nextspace < nextbreak)
nextbreak = nextspace; nextbreak = nextspace;

@ -89,7 +89,7 @@ int x_getdomainname(char *name, size_t len)
{ {
if ((hent = gethostbyname(uts.nodename)) != 0L) if ((hent = gethostbyname(uts.nodename)) != 0L)
{ {
char *p = (char*)strchr(hent->h_name, '.'); char *p = strchr(hent->h_name, '.');
if (p != 0L) if (p != 0L)
{ {
++p; ++p;

@ -143,7 +143,7 @@ bool KeyTrans::findEntry(int key, int bits, int* cmd, const char** txt, int* len
char *c; char *c;
char mask = '1' + BITS(0, bits&(1<<BITS_Shift)) + BITS(1, bits&(1<<BITS_Alt)) + BITS(2, bits&(1<<BITS_Control)); 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()); strcpy(buf, it.current()->txt.ascii());
c = (char*)strchr(buf, '*'); c = strchr(buf, '*');
if (c) *c = mask; if (c) *c = mask;
*txt = buf; *txt = buf;
} }

@ -111,7 +111,7 @@ const char *konsole_shell(TQStrList &args)
if (shell == NULL || *shell == '\0') shell = "/bin/sh"; if (shell == NULL || *shell == '\0') shell = "/bin/sh";
if (login_shell) if (login_shell)
{ {
char* t = (char*)strrchr(shell,'/'); char* t = const_cast<char*>(strrchr(shell,'/'));
if (t) // see sh(1) if (t) // see sh(1)
{ {
t = strdup(t); t = strdup(t);
@ -451,7 +451,7 @@ extern "C" int KDE_EXPORT kdemain(int argc, char* argv[])
int c = 0, l = 0; int c = 0, l = 0;
if ( !sz.isEmpty() ) if ( !sz.isEmpty() )
{ {
char *ls = (char*)strchr( sz.data(), 'x' ); char *ls = strchr( sz.data(), 'x' );
if ( ls != NULL ) if ( ls != NULL )
{ {
*ls='\0'; *ls='\0';

@ -356,7 +356,7 @@ TQString KSMServer::windowWmClientMachine(WId w)
hostnamebuf[sizeof(hostnamebuf)-1] = 0; hostnamebuf[sizeof(hostnamebuf)-1] = 0;
if (result == hostnamebuf) if (result == hostnamebuf)
result = "localhost"; result = "localhost";
if(char *dot = (char*)strchr(hostnamebuf, '.')) { if(char *dot = strchr(hostnamebuf, '.')) {
*dot = '\0'; *dot = '\0';
if(result == hostnamebuf) if(result == hostnamebuf)
result = "localhost"; result = "localhost";

@ -366,12 +366,12 @@ Status SetAuthentication_local (int count, IceListenObj *listenObjs)
for (i = 0; i < count; i ++) { for (i = 0; i < count; i ++) {
char *prot = IceGetListenConnectionString(listenObjs[i]); char *prot = IceGetListenConnectionString(listenObjs[i]);
if (!prot) continue; if (!prot) continue;
char *host = (char*)strchr(prot, '/'); char *host = strchr(prot, '/');
char *sock = 0; char *sock = 0;
if (host) { if (host) {
*host=0; *host=0;
host++; host++;
sock = (char*)strchr(host, ':'); sock = strchr(host, ':');
if (sock) { if (sock) {
*sock = 0; *sock = 0;
sock++; sock++;

@ -292,7 +292,7 @@ static int updateProcess( int pid )
strncmp( ps->cmdline, "kdeinit: ", KDEINITLEN ) == 0 && strncmp( ps->cmdline, "kdeinit: ", KDEINITLEN ) == 0 &&
strcmp( ps->cmdline + KDEINITLEN, "Running..." ) != 0 ) { strcmp( ps->cmdline + KDEINITLEN, "Running..." ) != 0 ) {
size_t len; size_t len;
char* end = (char*)strchr( ps->cmdline + KDEINITLEN, ' ' ); char* end = strchr( ps->cmdline + KDEINITLEN, ' ' );
if ( end ) if ( end )
len = ( end - ps->cmdline ) - KDEINITLEN; len = ( end - ps->cmdline ) - KDEINITLEN;
else else

@ -130,7 +130,7 @@ int updateAcpiBattery( void )
p = AcpiBatInfoBuf; p = AcpiBatInfoBuf;
while ( ( p!= NULL ) && ( sscanf( p, "last full capacity: %d ", while ( ( p!= NULL ) && ( sscanf( p, "last full capacity: %d ",
&AcpiBatCapacity ) != 1 ) ) { &AcpiBatCapacity ) != 1 ) ) {
p = (char*)strchr( p, '\n' ); p = strchr( p, '\n' );
if ( p ) if ( p )
p++; p++;
} }
@ -152,7 +152,7 @@ int updateAcpiBattery( void )
p = AcpiBatStateBuf; p = AcpiBatStateBuf;
while ( ( p!= NULL ) && ( sscanf( p, "remaining capacity: %d ", while ( ( p!= NULL ) && ( sscanf( p, "remaining capacity: %d ",
&AcpiBatRemainingCapacity ) != 1 ) ) { &AcpiBatRemainingCapacity ) != 1 ) ) {
p = (char*)strchr( p, '\n' ); p = strchr( p, '\n' );
if ( p ) if ( p )
p++; p++;
} }
@ -161,7 +161,7 @@ int updateAcpiBattery( void )
p = AcpiBatStateBuf; p = AcpiBatStateBuf;
while ( ( p!= NULL ) && ( sscanf( p, "present rate: %d ", while ( ( p!= NULL ) && ( sscanf( p, "present rate: %d ",
&AcpiBatteryUsage[i] ) != 1 ) ) { &AcpiBatteryUsage[i] ) != 1 ) ) {
p = (char*)strchr( p, '\n' ); p = strchr( p, '\n' );
if ( p ) if ( p )
p++; p++;
} }
@ -229,12 +229,12 @@ void printAcpiBatUsageInfo( const char* cmd)
static int extract_zone_name(char **startidx, const char *cmd) static int extract_zone_name(char **startidx, const char *cmd)
{ {
char *idx = NULL; char *idx = NULL;
idx = (char*)strchr(cmd, '/'); idx = strchr(cmd, '/');
if (idx == NULL) return 0; if (idx == NULL) return 0;
idx = (char*)strchr(idx+1, '/'); idx = strchr(idx+1, '/');
if (idx == NULL) return 0; if (idx == NULL) return 0;
*startidx = idx+1; *startidx = idx+1;
idx = (char*)strchr(*startidx, '/'); idx = strchr(*startidx, '/');
if (idx == NULL) return 0; if (idx == NULL) return 0;
return idx - *startidx; return idx - *startidx;
} }

@ -83,7 +83,7 @@ static void processCpuInfo( void )
sscanf( value, "%f", &Clocks[ cpuId ] ); sscanf( value, "%f", &Clocks[ cpuId ] );
/* Move cibp to begining of next line, if there is one. */ /* Move cibp to begining of next line, if there is one. */
cibp = (char*)strchr( cibp, '\n' ); cibp = strchr( cibp, '\n' );
if ( cibp ) if ( cibp )
cibp++; cibp++;
else else

@ -165,7 +165,7 @@ static int processNetDev_( void )
netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */ netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */
if ( sscanf( buf, devFormat, tag ) ) { if ( sscanf( buf, devFormat, tag ) ) {
char* pos = (char*)strchr( tag, ':' ); char* pos = strchr( tag, ':' );
if ( pos ) { if ( pos ) {
FORALL( DEFVARS ); FORALL( DEFVARS );
*pos = '\0'; *pos = '\0';
@ -289,7 +289,7 @@ void initNetDev( struct SensorModul* sm )
netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */ netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */
if ( sscanf( buf, devFormat, tag ) ) { if ( sscanf( buf, devFormat, tag ) ) {
char* pos = (char*)strchr( tag, ':' ); char* pos = strchr( tag, ':' );
if ( pos ) { if ( pos ) {
char mon[ MON_SIZE ]; char mon[ MON_SIZE ];
*pos = '\0'; *pos = '\0';
@ -450,9 +450,9 @@ void printNetDev##a( const char* cmd ) \
char* end; \ char* end; \
char dev[ 64 ]; \ char dev[ 64 ]; \
\ \
beg = (char*)strchr( cmd, '/' ); \ beg = strchr( cmd, '/' ); \
beg = (char*)strchr( beg + 1, '/' ); \ beg = strchr( beg + 1, '/' ); \
end = (char*)strchr( beg + 1, '/' ); \ end = strchr( beg + 1, '/' ); \
strncpy( dev, beg + 1, end - beg - 1 ); \ strncpy( dev, beg + 1, end - beg - 1 ); \
dev[ end - beg - 1 ] = '\0'; \ dev[ end - beg - 1 ] = '\0'; \
\ \

@ -267,10 +267,10 @@ static int processDiskIO( const char* buf )
} }
/* Move p after the sencond ')'. We can safely assume that /* Move p after the sencond ')'. We can safely assume that
* those two ')' exist. */ * those two ')' exist. */
p = (char*)strchr( p, ')' ) + 1; p = strchr( p, ')' ) + 1;
p = (char*)strchr( p, ')' ) + 1; p = strchr( p, ')' ) + 1;
if ( p && *p ) if ( p && *p )
p = (char*)strchr( p, '(' ); p = strchr( p, '(' );
} }
return 0; return 0;

@ -436,9 +436,9 @@ void printIPackets( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -464,9 +464,9 @@ void printOPackets( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -492,9 +492,9 @@ void printIErrors( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -520,9 +520,9 @@ void printOErrors( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -548,9 +548,9 @@ void printCollisions( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -576,9 +576,9 @@ void printMultiXmits( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -604,9 +604,9 @@ void printMultiRecvs( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -632,9 +632,9 @@ void printBcastXmits( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -660,9 +660,9 @@ void printBcastRecvs( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {

@ -435,9 +435,9 @@ void printIPackets( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -463,9 +463,9 @@ void printOPackets( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -491,9 +491,9 @@ void printIErrors( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -519,9 +519,9 @@ void printOErrors( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -547,9 +547,9 @@ void printCollisions( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -575,9 +575,9 @@ void printMultiXmits( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -603,9 +603,9 @@ void printMultiRecvs( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -631,9 +631,9 @@ void printBcastXmits( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {
@ -659,9 +659,9 @@ void printBcastRecvs( const char *cmd ) {
char *name, *ptr; char *name, *ptr;
int i; int i;
ptr = (char*)strchr( cmdcopy, (int) '/' ); ptr = strchr( cmdcopy, (int) '/' );
name = ++ptr; name = ++ptr;
ptr = (char*)strchr( name, (int) '/' ); ptr = strchr( name, (int) '/' );
*ptr = '\0'; *ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) { for( i = 0; i < NetDevCount; i++ ) {

@ -93,9 +93,9 @@ void parseConfigFile( const char *filename )
if ( line[ strlen( line ) - 1 ] == '\n' ) if ( line[ strlen( line ) - 1 ] == '\n' )
line[ strlen( line ) - 1 ] = '\0'; 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++; begin++;
for ( token = strtok( begin, "," ); token; token = strtok( NULL, "," ) ) { for ( token = strtok( begin, "," ); token; token = strtok( NULL, "," ) ) {
@ -104,7 +104,7 @@ void parseConfigFile( const char *filename )
continue; continue;
} }
confLog->name = strdup( token ); confLog->name = strdup( token );
tmp = (char*)strchr( confLog->name, ':' ); tmp = strchr( confLog->name, ':' );
*tmp = '\0'; *tmp = '\0';
confLog->path = tmp; confLog->path = tmp;
confLog->path++; 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++; begin++;
for ( token = strtok( begin, ","); token; token = strtok( NULL, "," ) ) for ( token = strtok( begin, ","); token; token = strtok( NULL, "," ) )

@ -317,7 +317,7 @@ bool isLocalMachine( const TQCString& host )
hostnamebuf[sizeof(hostnamebuf)-1] = 0; hostnamebuf[sizeof(hostnamebuf)-1] = 0;
if (host == hostnamebuf) if (host == hostnamebuf)
return true; return true;
if( char *dot = (char*)strchr(hostnamebuf, '.')) if( char *dot = strchr(hostnamebuf, '.'))
{ {
*dot = '\0'; *dot = '\0';
if( host == hostnamebuf ) if( host == hostnamebuf )

Loading…
Cancel
Save