Commit 1cc85ee5 authored by Claes Sjofors's avatar Claes Sjofors

Ge dynamic Value.ZeroBlank also works for time, objid and status types (refs #197)

parent 346673f0
...@@ -4160,6 +4160,11 @@ int GeValue::scan( grow_tObject object) ...@@ -4160,6 +4160,11 @@ int GeValue::scan( grow_tObject object)
default: default:
msg_GetMsg( val, buf, sizeof(buf)); msg_GetMsg( val, buf, sizeof(buf));
} }
if ( zero_blank && val == 0) {
buf[0] = 0;
len = 0;
}
else
len = strlen(buf); len = strlen(buf);
memcpy( &old_value, &val, MIN(size, (int) sizeof(old_value))); memcpy( &old_value, &val, MIN(size, (int) sizeof(old_value)));
break; break;
...@@ -4208,6 +4213,12 @@ int GeValue::scan( grow_tObject object) ...@@ -4208,6 +4213,12 @@ int GeValue::scan( grow_tObject object)
} }
if ( EVEN(sts)) if ( EVEN(sts))
strcpy( name, ""); strcpy( name, "");
if ( zero_blank && cdh_ObjidIsNull(objid)) {
buf[0] = 0;
len = 0;
}
else
len = sprintf( buf, "%s", name); len = sprintf( buf, "%s", name);
memcpy( &old_value, &objid, MIN(size, (int) sizeof(old_value))); memcpy( &old_value, &objid, MIN(size, (int) sizeof(old_value)));
break; break;
...@@ -4343,6 +4354,11 @@ int GeValue::scan( grow_tObject object) ...@@ -4343,6 +4354,11 @@ int GeValue::scan( grow_tObject object)
} }
if ( EVEN(sts)) if ( EVEN(sts))
strcpy( timstr, "-"); strcpy( timstr, "-");
if ( zero_blank && val.tv_sec == 0 && val.tv_nsec == 0) {
buf[0] = 0;
len = 0;
}
else
len = sprintf( buf, "%s", timstr); len = sprintf( buf, "%s", timstr);
memcpy( &old_value, &val, MIN(size, (int) sizeof(old_value))); memcpy( &old_value, &val, MIN(size, (int) sizeof(old_value)));
break; break;
...@@ -4372,6 +4388,11 @@ int GeValue::scan( grow_tObject object) ...@@ -4372,6 +4388,11 @@ int GeValue::scan( grow_tObject object)
} }
if ( EVEN(sts)) if ( EVEN(sts))
strcpy( timstr, "-"); strcpy( timstr, "-");
if ( zero_blank && val.tv_sec == 0 && val.tv_nsec == 0) {
buf[0] = 0;
len = 0;
}
else
len = sprintf( buf, "%s", timstr); len = sprintf( buf, "%s", timstr);
memcpy( &old_value, &val, MIN(size, (int) sizeof(old_value))); memcpy( &old_value, &val, MIN(size, (int) sizeof(old_value)));
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment