From 199ccded5dbc4dabb7e4fd5a2772eed6e571d444 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Fri, 8 May 2009 04:55:53 +0000 Subject: 2009-05-08 Chris Johns * cpukit/libblock/src/bdpart.c, libmisc/shell/main_msdosfmt.c, libmisc/shell/main_rm.c, libnetworking/libc/gethostnamadr.c, score/include/rtems/score/bitfield.h, score/inline/rtems/score/priority.inl: Remove warnings. --- cpukit/ChangeLog | 7 +++++++ cpukit/libblock/src/bdpart.c | 8 +++----- cpukit/libmisc/shell/main_msdosfmt.c | 8 ++++---- cpukit/libmisc/shell/main_rm.c | 2 ++ cpukit/libnetworking/libc/gethostnamadr.c | 26 ++++++++++++------------- cpukit/score/include/rtems/score/bitfield.h | 4 ++-- cpukit/score/inline/rtems/score/priority.inl | 29 ++++++++++++++++++++-------- 7 files changed, 52 insertions(+), 32 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index e2a106cf8c..f2c7ff4202 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2009-05-08 Chris Johns + + * cpukit/libblock/src/bdpart.c, libmisc/shell/main_msdosfmt.c, + libmisc/shell/main_rm.c, libnetworking/libc/gethostnamadr.c, + score/include/rtems/score/bitfield.h, + score/inline/rtems/score/priority.inl: Remove warnings. + 2009-05-07 Joel Sherrill * score/src/objectgetnext.c: Add checks for NULL pointers. diff --git a/cpukit/libblock/src/bdpart.c b/cpukit/libblock/src/bdpart.c index 29b770121e..b86780ccf4 100644 --- a/cpukit/libblock/src/bdpart.c +++ b/cpukit/libblock/src/bdpart.c @@ -852,7 +852,7 @@ rtems_status_code rtems_bdpart_register( logical_disk = rtems_filesystem_make_dev_t( major, minor); /* Set partition number for logical disk name */ - rv = snprintf( logical_disk_marker, RTEMS_BDPART_NUMBER_SIZE, "%u", i + 1); + rv = snprintf( logical_disk_marker, RTEMS_BDPART_NUMBER_SIZE, "%lu", i + 1); if (rv >= RTEMS_BDPART_NUMBER_SIZE) { esc = RTEMS_INVALID_NAME; goto cleanup; @@ -944,7 +944,6 @@ rtems_status_code rtems_bdpart_mount( const char *mount_base ) { - rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_status_code esc = RTEMS_SUCCESSFUL; const char *disk_file_name = strrchr( disk_name, '/'); char *logical_disk_name = NULL; @@ -989,7 +988,7 @@ rtems_status_code rtems_bdpart_mount( /* Mount supported file systems for each partition */ for (i = 0; i < count; ++i) { /* Create logical disk name */ - int rv = snprintf( logical_disk_marker, RTEMS_BDPART_NUMBER_SIZE, "%u", i + 1); + int rv = snprintf( logical_disk_marker, RTEMS_BDPART_NUMBER_SIZE, "%lu", i + 1); if (rv >= RTEMS_BDPART_NUMBER_SIZE) { esc = RTEMS_INVALID_NAME; goto cleanup; @@ -1031,7 +1030,6 @@ rtems_status_code rtems_bdpart_unmount( const char *mount_base ) { - rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_status_code esc = RTEMS_SUCCESSFUL; const char *disk_file_name = strrchr( disk_name, '/'); char *mount_point = NULL; @@ -1066,7 +1064,7 @@ rtems_status_code rtems_bdpart_unmount( /* Mount supported file systems for each partition */ for (i = 0; i < count; ++i) { /* Create mount point */ - int rv = snprintf( mount_marker, RTEMS_BDPART_NUMBER_SIZE, "%u", i + 1); + int rv = snprintf( mount_marker, RTEMS_BDPART_NUMBER_SIZE, "%lu", i + 1); if (rv >= RTEMS_BDPART_NUMBER_SIZE) { esc = RTEMS_INVALID_NAME; goto cleanup; diff --git a/cpukit/libmisc/shell/main_msdosfmt.c b/cpukit/libmisc/shell/main_msdosfmt.c index 65e6e73a75..58a116aa3c 100644 --- a/cpukit/libmisc/shell/main_msdosfmt.c +++ b/cpukit/libmisc/shell/main_msdosfmt.c @@ -130,13 +130,13 @@ int rtems_shell_main_msdos_format( { printf (" %-20s: %s\n", "OEMName", "RTEMS"); printf (" %-20s: %s\n", "VolLabel", "RTEMSDisk"); - printf (" %-20s: %i\n", "sectors per cluster", rqdata.sectors_per_cluster); - printf (" %-20s: %i\n", "fats", rqdata.fat_num); - printf (" %-20s: %i\n", "files per root dir", rqdata.files_per_root_dir); + printf (" %-20s: %lu\n", "sectors per cluster", rqdata.sectors_per_cluster); + printf (" %-20s: %lu\n", "fats", rqdata.fat_num); + printf (" %-20s: %lu\n", "files per root dir", rqdata.files_per_root_dir); printf (" %-20s: %i\n", "fat type", rqdata.fattype); printf (" %-20s: %d\n", "media", rqdata.media); printf (" %-20s: %d\n", "quick_format", rqdata.quick_format); - printf (" %-20s: %i\n", "cluster align", rqdata.cluster_align); + printf (" %-20s: %lu\n", "cluster align", rqdata.cluster_align); } if (msdos_format (driver, &rqdata) < 0) { diff --git a/cpukit/libmisc/shell/main_rm.c b/cpukit/libmisc/shell/main_rm.c index b68fc5744c..26b6b046f6 100644 --- a/cpukit/libmisc/shell/main_rm.c +++ b/cpukit/libmisc/shell/main_rm.c @@ -579,7 +579,9 @@ check_rm(rtems_shell_rm_globals* globals, char *path, char *name, struct stat *s group_from_gid(sp->st_gid, 0), *flagsp ? flagsp : "", *flagsp ? " " : "", path); +#if RTEMS_REMOVED free(flagsp); +#endif } (void)fflush(stderr); diff --git a/cpukit/libnetworking/libc/gethostnamadr.c b/cpukit/libnetworking/libc/gethostnamadr.c index d67890ada4..2513fbf2b2 100644 --- a/cpukit/libnetworking/libc/gethostnamadr.c +++ b/cpukit/libnetworking/libc/gethostnamadr.c @@ -272,8 +272,8 @@ static int __dns_gethostbyx_r( result->h_addr_list=(char**)buf; result->h_aliases[0]=0; - cur=buf+16*sizeof(char*); - max=buf+buflen; + cur=(unsigned char*)buf+16*sizeof(char*); + max=(unsigned char*)buf+buflen; names=ips=0; if ((size=res_query(name,C_IN,lookfor,inpkg,512))<0) { @@ -282,7 +282,7 @@ invalidpacket: return -1; } { - tmp=inpkg+12; + tmp=(char*)inpkg+12; { char Name[257]; unsigned short q=((unsigned short)inpkg[4]<<8)+inpkg[5]; @@ -296,17 +296,17 @@ invalidpacket: q=((unsigned short)inpkg[6]<<8)+inpkg[7]; if (q<1) goto nodata; while (q>0) { - int decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size); + int decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),(unsigned char*)Name,256,inpkg+size); if (decofs<0) break; - tmp=inpkg+decofs; + tmp=(char*)inpkg+decofs; --q; if (tmp[0]!=0 || tmp[1]!=lookfor || /* TYPE != A */ tmp[2]!=0 || tmp[3]!=1) { /* CLASS != IN */ if (tmp[1]==5) { /* CNAME */ tmp+=10; - decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size); + decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),(unsigned char*)Name,256,inpkg+size); if (decofs<0) break; - tmp=inpkg+decofs; + tmp=(char*)inpkg+decofs; } else break; continue; @@ -318,22 +318,22 @@ invalidpacket: slen=strlen(Name); if (cur+slen+8+(lookfor==28?12:0)>=max) { *h_errnop=NO_RECOVERY; return -1; } } else if (lookfor==12) /* PTR */ { - decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size); + decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),(unsigned char*)Name,256,inpkg+size); if (decofs<0) break; - tmp=inpkg+decofs; + tmp=(char*)inpkg+decofs; slen=strlen(Name); } else slen=strlen(Name); - strcpy(cur,Name); + strcpy((char*)cur,Name); if (names==0) - result->h_name=cur; + result->h_name=(char*)cur; else - result->h_aliases[names-1]=cur; + result->h_aliases[names-1]=(char*)cur; result->h_aliases[names]=0; if (names<8) ++names; /* cur+=slen+1; */ cur+=(slen|3)+1; - result->h_addr_list[ips++] = cur; + result->h_addr_list[ips++] = (char*)cur; if (lookfor==1) /* A */ { *(int*)cur=*(int*)tmp; cur+=4; diff --git a/cpukit/score/include/rtems/score/bitfield.h b/cpukit/score/include/rtems/score/bitfield.h index 04a2a96f4c..0efc574f58 100644 --- a/cpukit/score/include/rtems/score/bitfield.h +++ b/cpukit/score/include/rtems/score/bitfield.h @@ -90,9 +90,9 @@ const unsigned char __log2table[256] = { register const unsigned char *__p = __log2table; \ \ if ( __value < 0x100 ) \ - (_bit_number) = __p[ __value ] + 8; \ + (_bit_number) = (Priority_Bit_map_control)( __p[ __value ] + 8 ); \ else \ - (_bit_number) = __p[ __value >> 8 ]; \ + (_bit_number) = (Priority_Bit_map_control)( __p[ __value >> 8 ] ); \ } #endif diff --git a/cpukit/score/inline/rtems/score/priority.inl b/cpukit/score/inline/rtems/score/priority.inl index 0c94046acb..f03570e27d 100644 --- a/cpukit/score/inline/rtems/score/priority.inl +++ b/cpukit/score/inline/rtems/score/priority.inl @@ -64,22 +64,22 @@ RTEMS_INLINE_ROUTINE bool _Priority_Is_valid ( * This function returns the major portion of the_priority. */ -RTEMS_INLINE_ROUTINE uint32_t _Priority_Major ( +RTEMS_INLINE_ROUTINE Priority_Bit_map_control _Priority_Major ( Priority_Control the_priority ) { - return ( the_priority / 16 ); + return (Priority_Bit_map_control)( the_priority / 16 ); } /** * This function returns the minor portion of the_priority. */ -RTEMS_INLINE_ROUTINE uint32_t _Priority_Minor ( +RTEMS_INLINE_ROUTINE Priority_Bit_map_control _Priority_Minor ( Priority_Control the_priority ) { - return ( the_priority % 16 ); + return (Priority_Bit_map_control)( the_priority % 16 ); } #if ( CPU_USE_GENERIC_BITFIELD_CODE == TRUE ) @@ -89,13 +89,24 @@ RTEMS_INLINE_ROUTINE uint32_t _Priority_Minor ( * number passed to it. */ -RTEMS_INLINE_ROUTINE uint32_t _Priority_Mask ( +RTEMS_INLINE_ROUTINE Priority_Bit_map_control _Priority_Mask ( uint32_t bit_number ) { - return (0x8000u >> bit_number); + return (Priority_Bit_map_control)(0x8000u >> bit_number); } +/** + * This function returns the mask bit inverted. + */ + +RTEMS_INLINE_ROUTINE Priority_Bit_map_control _Priority_Mask_invert ( + uint32_t mask +) +{ + return (Priority_Bit_map_control)(~mask); +} + /** * This function translates the bit numbers returned by the bit scan @@ -180,11 +191,13 @@ RTEMS_INLINE_ROUTINE void _Priority_Initialize_information( mask = _Priority_Mask( major ); the_priority_map->ready_major = mask; - the_priority_map->block_major = ~mask; + /* Add _Priority_Mask_invert to non-generic bitfield then change this code. */ + the_priority_map->block_major = (Priority_Bit_map_control)(~((uint32_t)mask)); mask = _Priority_Mask( minor ); the_priority_map->ready_minor = mask; - the_priority_map->block_minor = ~mask; + /* Add _Priority_Mask_invert to non-generic bitfield then change this code. */ + the_priority_map->block_minor = (Priority_Bit_map_control)(~((uint32_t)mask)); } /** -- cgit v1.2.3