]> git.gag.com Git - fw/openocd/blobdiff - src/helper/command.c
- Replace 'if(' with 'if ('.
[fw/openocd] / src / helper / command.c
index 10ff523f1401ec1dabf077514525473d826d520f..ec1d637f15abebca01d195eaf5869eacf32fecb0 100644 (file)
@@ -348,7 +348,7 @@ int unregister_command(command_context_t *context, char *name)
 
 void command_output_text(command_context_t *context, const char *data)
 {
-       if( context && context->output_handler && data  ){
+       if ( context && context->output_handler && data  ){
                context->output_handler( context, data );
        }
 }
@@ -872,9 +872,9 @@ long jim_global_long(const char *variable)
                *ul = func(str, &end, 0); \
                if (*end) \
                        return ERROR_COMMAND_ARGUMENT_INVALID; \
-               if (*ul == max) \
+               if ((max == *ul) && (ERANGE == errno)) \
                        return ERROR_COMMAND_ARGUMENT_OVERFLOW; \
-               if (min && min == *ul) \
+               if (min && (min == *ul) && (ERANGE == errno)) \
                        return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \
                return ERROR_OK; \
        }
@@ -884,7 +884,7 @@ DEFINE_PARSE_NUM_TYPE(_long, long , strtol, LONG_MIN, LONG_MAX)
 DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX)
 
 #define DEFINE_PARSE_WRAPPER(name, type, min, max, functype, funcname) \
-       int parse_##name(const char *str, type *ul) \
+       int parse##name(const char *str, type *ul) \
        { \
                functype n; \
                int retval = parse##funcname(str, &n); \
@@ -900,14 +900,14 @@ DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX)
 
 #define DEFINE_PARSE_ULONG(name, type, min, max) \
        DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long, _ulong)
-DEFINE_PARSE_ULONG(uint, unsigned, 0, UINT_MAX)
-DEFINE_PARSE_ULONG(u32, uint32_t, 0, UINT32_MAX)
-DEFINE_PARSE_ULONG(u16, uint16_t, 0, UINT16_MAX)
-DEFINE_PARSE_ULONG(u8, uint8_t, 0, UINT8_MAX)
+DEFINE_PARSE_ULONG(_uint, unsigned, 0, UINT_MAX)
+DEFINE_PARSE_ULONG(_u32, uint32_t, 0, UINT32_MAX)
+DEFINE_PARSE_ULONG(_u16, uint16_t, 0, UINT16_MAX)
+DEFINE_PARSE_ULONG(_u8, uint8_t, 0, UINT8_MAX)
 
 #define DEFINE_PARSE_LONG(name, type, min, max) \
        DEFINE_PARSE_WRAPPER(name, type, min, max, long, _long)
-DEFINE_PARSE_LONG(int, int, n < INT_MIN, INT_MAX)
-DEFINE_PARSE_LONG(s32, int32_t, n < INT32_MIN, INT32_MAX)
-DEFINE_PARSE_LONG(s16, int16_t, n < INT16_MIN, INT16_MAX)
-DEFINE_PARSE_LONG(s8, int8_t, n < INT8_MIN, INT8_MAX)
+DEFINE_PARSE_LONG(_int, int, n < INT_MIN, INT_MAX)
+DEFINE_PARSE_LONG(_s32, int32_t, n < INT32_MIN, INT32_MAX)
+DEFINE_PARSE_LONG(_s16, int16_t, n < INT16_MIN, INT16_MAX)
+DEFINE_PARSE_LONG(_s8, int8_t, n < INT8_MIN, INT8_MAX)