Hi Ralph,
Any comments or objections? I haven't tried this myself yet. We do need to
confirm that any change doesn't modify the original behavior on both kinds of
architectures where char is signed or unsigned; I suspect Eric has only tried
one type of CPU (x86).
- Andrew
--
It is difficult to get a man to understand something, when his salary
depends upon his not understanding it. -- Upton Sinclair
--- Begin Message ---
Seems to to what it should. I think that this maintains backward compatibility.
diff -b -U7 tool_lib.c.orig tool_lib.c
--- tool_lib.c.orig 2013-05-08 11:15:28.000000000 -0700
+++ tool_lib.c 2013-05-08 11:51:47.000000000 -0700
@@ -102,15 +102,14 @@
*
**************************************************************************-*/
char *val2str (const void *v, unsigned type, int index)
{
#define STR 500
static char str[STR];
- char ch;
void *val_ptr;
unsigned base_type;
dbr_long_t val_long;
if (!dbr_type_is_valid(type)) {
strcpy (str, "*** invalid type");
return str;
@@ -146,16 +145,21 @@
val_long = ((dbr_double_t*) val_ptr)[index] + 0.5;
else
val_long = ((dbr_double_t*) val_ptr)[index] - 0.5;
sprint_long(str, val_long, outTypeF);
}
break;
case DBR_CHAR:
- ch = ((dbr_char_t*) val_ptr)[index];
- sprintf(str, "%d", ch);
+ if (outTypeI == dec) {
+ char ch = ((dbr_char_t*) val_ptr)[index];
+ sprint_long(str, ch, outTypeI);
+ }
+ else {
+ sprint_long(str, ((dbr_char_t*) val_ptr)[index], outTypeI);
+ }
break;
case DBR_INT:
sprint_long(str, ((dbr_int_t*) val_ptr)[index], outTypeI);
break;
case DBR_LONG:
sprint_long(str, ((dbr_long_t*) val_ptr)[index], outTypeI);
break;
--
Eric Norum
[email protected]
--- End Message ---
- Replies:
- Re: tool_lib.c -- next attempt Eric Norum
- Navigate by Date:
- Prev:
EPICS V4 - SvrBrowse and PvBrowse Carsten Winkler
- Next:
Re: tool_lib.c -- next attempt Eric Norum
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
EPICS V4 - SvrBrowse and PvBrowse Carsten Winkler
- Next:
Re: tool_lib.c -- next attempt Eric Norum
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|