From e385b1074b50dc3bdcd057597270a4fc287aa0fc Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Dec 2009 23:23:46 +0000 Subject: [PATCH] Clean-up from big switch to stdint/stdbool git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2362 42af7a65-404d-4744-a932-0658087f49c3 --- arch/sim/src/up_createstack.c | 2 +- arch/sim/src/up_reprioritizertr.c | 11 ++++++++--- binfmt/symtab_findbyvalue.c | 1 + binfmt/symtab_findorderedbyvalue.c | 1 + drivers/can.c | 4 ++-- drivers/mmcsd/mmcsd_sdio.c | 6 ++++-- drivers/mtd/ftl.c | 6 +++--- drivers/mtd/m25px.c | 2 +- fs/fat/fs_configfat.c | 12 ++++++------ include/errno.h | 4 +++- include/pthread.h | 2 +- include/stdint.h | 1 + include/sys/types.h | 14 ++++++++++---- sched/mq_sndinternal.c | 2 +- sched/pthread_condattrinit.c | 2 +- 15 files changed, 44 insertions(+), 26 deletions(-) diff --git a/arch/sim/src/up_createstack.c b/arch/sim/src/up_createstack.c index 76f13f1e79..03426ade2e 100644 --- a/arch/sim/src/up_createstack.c +++ b/arch/sim/src/up_createstack.c @@ -96,7 +96,7 @@ int up_create_stack(_TCB *tcb, size_t stack_size) /* Allocate the memory for the stack */ - uint32 *stack_alloc_ptr = (uint32_t*)kmalloc(adj_stack_size); + uint32_t *stack_alloc_ptr = (uint32_t*)kmalloc(adj_stack_size); if (stack_alloc_ptr) { /* This is the address of the last word in the allocation */ diff --git a/arch/sim/src/up_reprioritizertr.c b/arch/sim/src/up_reprioritizertr.c index a11bada6df..a7ffb137dc 100644 --- a/arch/sim/src/up_reprioritizertr.c +++ b/arch/sim/src/up_reprioritizertr.c @@ -90,9 +90,14 @@ void up_reprioritize_rtr(_TCB *tcb, uint8_t priority) /* Verify that the caller is sane */ if (tcb->task_state < FIRST_READY_TO_RUN_STATE || - tcb->task_state > LAST_READY_TO_RUN_STATE || - priority < SCHED_PRIORITY_MIN || - priority > SCHED_PRIORITY_MAX) + tcb->task_state > LAST_READY_TO_RUN_STATE +#if SCHED_PRIORITY_MIN > UINT8_MIN + || priority < SCHED_PRIORITY_MIN +#endif +#if SCHED_PRIORITY_MAX < UINT8_MAX + || priority > SCHED_PRIORITY_MAX +#endif + ) { PANIC(OSERR_BADREPRIORITIZESTATE); } diff --git a/binfmt/symtab_findbyvalue.c b/binfmt/symtab_findbyvalue.c index 269fd8bb29..80df746684 100644 --- a/binfmt/symtab_findbyvalue.c +++ b/binfmt/symtab_findbyvalue.c @@ -39,6 +39,7 @@ #include +#include #include #include #include diff --git a/binfmt/symtab_findorderedbyvalue.c b/binfmt/symtab_findorderedbyvalue.c index aae3f780ba..a995595da9 100644 --- a/binfmt/symtab_findorderedbyvalue.c +++ b/binfmt/symtab_findorderedbyvalue.c @@ -39,6 +39,7 @@ #include +#include #include #include #include diff --git a/drivers/can.c b/drivers/can.c index 47525257d7..3be0248dc1 100644 --- a/drivers/can.c +++ b/drivers/can.c @@ -559,13 +559,13 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg) switch (cmd) { /* CANIOCTL_RTR: Send the remote transmission request and wait for the response. - * Argument is a reference to struct canioctl_rtr_s (casting to uintptr first + * Argument is a reference to struct canioctl_rtr_s (casting to uintptr_t first * eliminates complaints on some architectures where the sizeof long is different * from the size of a pointer). */ case CANIOCTL_RTR: - ret = can_rtrread(dev, (struct canioctl_rtr_s*)((uintptr)arg)); + ret = can_rtrread(dev, (struct canioctl_rtr_s*)((uintptr_t)arg)); break; /* Not a "built-in" ioctl command.. perhaps it is unique to this device driver */ diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 7eea719831..9d04c683b3 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -218,7 +218,9 @@ static int mmcsd_ioctl(FAR struct inode *inode, int cmd, static void mmcsd_mediachange(FAR void *arg); static int mmcsd_widebus(FAR struct mmcsd_state_s *priv); +#ifdef CONFIG_MMCSD_MMCSUPPORT static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv); +#endif static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv); static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv); static int mmcsd_probe(FAR struct mmcsd_state_s *priv); @@ -2120,9 +2122,9 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv) * ****************************************************************************/ +#ifdef CONFIG_MMCSD_MMCSUPPORT static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv) { -#ifdef CONFIG_MMCSD_MMCSUPPORT uint32_t cid[4]; uint32_t csd[4]; int ret; @@ -2201,9 +2203,9 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv) SDIO_CLOCK(priv->dev, CLOCK_MMC_TRANSFER); up_udelay( MMCSD_CLK_DELAY); -#endif return OK; } +#endif /**************************************************************************** * Name: mmcsd_sdinitialize diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 1e9ab5ebd3..11ed83f632 100755 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -475,12 +475,12 @@ int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd) dev->mtd = mtd; - /* Get the device geometry. (casting to uintptr first eliminates + /* Get the device geometry. (casting to uintptr_t first eliminates * complaints on some architectures where the sizeof long is different * from the size of a pointer). */ - ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr)&dev->geo)); + ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&dev->geo)); if (ret < 0) { fdbg("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret); @@ -503,7 +503,7 @@ int ftl_initialize(int minor, uint8_t *buffer, FAR struct mtd_dev_s *mtd) /* Get the number of R/W blocks per erase block */ dev->blkper = dev->geo.erasesize / dev->geo.blocksize; - DEBUGASSERT(dev->blkper * dev->geo.blocksize = dev->geo.erasesize); + DEBUGASSERT(dev->blkper * dev->geo.blocksize == dev->geo.erasesize); /* Configure read-ahead/write buffering */ diff --git a/drivers/mtd/m25px.c b/drivers/mtd/m25px.c index 0899376d69..509b8302ad 100644 --- a/drivers/mtd/m25px.c +++ b/drivers/mtd/m25px.c @@ -579,7 +579,7 @@ static int m25p_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg) { case MTDIOC_GEOMETRY: { - FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)((uintptr)arg); + FAR struct mtd_geometry_s *geo = (FAR struct mtd_geometry_s *)((uintptr_t)arg); if (geo) { /* Populate the geometry structure with information need to know diff --git a/fs/fat/fs_configfat.c b/fs/fat/fs_configfat.c index 17a3e528d5..9ec7573a74 100644 --- a/fs/fat/fs_configfat.c +++ b/fs/fat/fs_configfat.c @@ -137,8 +137,8 @@ mkfatfs_nfatsect12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var, uint32_t navailsects) { #ifdef CONFIG_HAVE_LONG_LONG - uint64 denom; - uint64 numer; + uint64_t denom; + uint64_t numer; #else uint32_t denom; uint32_t numer; @@ -214,8 +214,8 @@ mkfatfs_nfatsect16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var, uint32_t navailsects) { #ifdef CONFIG_HAVE_LONG_LONG - uint64 denom; - uint64 numer; + uint64_t denom; + uint64_t numer; #else uint32_t denom; uint32_t numer; @@ -280,8 +280,8 @@ mkfatfs_nfatsect32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var, uint32_t navailsects) { #ifdef CONFIG_HAVE_LONG_LONG - uint64 denom; - uint64 numer; + uint64_t denom; + uint64_t numer; #else uint32_t denom; uint32_t numer; diff --git a/include/errno.h b/include/errno.h index 945f839570..8c1654b0f1 100644 --- a/include/errno.h +++ b/include/errno.h @@ -40,6 +40,8 @@ * Included Files ************************************************************************/ +#include + /************************************************************************ * Definitions ************************************************************************/ @@ -317,7 +319,7 @@ extern "C" { /* Return a pointer to the thread specifid errno */ -extern FAR int *get_errno_ptr(void); +EXTERN FAR int *get_errno_ptr(void); #undef EXTERN #if defined(__cplusplus) diff --git a/include/pthread.h b/include/pthread.h index c3342b369c..c0cf9b75e6 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -163,7 +163,7 @@ struct pthread_attr_s size_t stacksize; /* Size of the stack allocated for the pthead */ int16_t priority; /* Priority of the pthread */ uint8_t policy; /* Pthread scheduler policy */ - uint8_t nheritsched; /* Inherit parent prio/policy? */ + uint8_t inheritsched; /* Inherit parent prio/policy? */ }; typedef struct pthread_attr_s pthread_attr_t; diff --git a/include/stdint.h b/include/stdint.h index eece03496c..3bd1d9f47a 100755 --- a/include/stdint.h +++ b/include/stdint.h @@ -43,6 +43,7 @@ #include #include +#include #include /**************************************************************************** diff --git a/include/sys/types.h b/include/sys/types.h index 286cc3fe96..205beefff6 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -43,16 +43,22 @@ #include #include -#include +#ifndef __ASSEMBLY__ +# include +#endif /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Alternative alues for type bool (for historic reasons) */ +/* Alternative values for type bool (for historic reasons) */ -#define TRUE 1 -#define FALSE 0 +#ifndef TRUE +# define TRUE 1 +#endif +#ifndef FALSE +# define FALSE 0 +#endif /* NULL is usually defined in stddef.h (which includes this file) */ diff --git a/sched/mq_sndinternal.c b/sched/mq_sndinternal.c index 6184ced7dc..64eee136d0 100644 --- a/sched/mq_sndinternal.c +++ b/sched/mq_sndinternal.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include diff --git a/sched/pthread_condattrinit.c b/sched/pthread_condattrinit.c index 1e37466548..30e3f71ace 100644 --- a/sched/pthread_condattrinit.c +++ b/sched/pthread_condattrinit.c @@ -37,7 +37,7 @@ * Included Files ****************************************************************************/ -#include +#include #include #include