projects
/
vg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
27aeb14
)
more message changes
author
hgn
<hgodden00@gmail.com>
Sun, 11 Jun 2023 20:10:48 +0000
(21:10 +0100)
committer
hgn
<hgodden00@gmail.com>
Sun, 11 Jun 2023 20:10:48 +0000
(21:10 +0100)
vg_msg.h
patch
|
blob
|
history
diff --git
a/vg_msg.h
b/vg_msg.h
index 0aef31e0597c559de314171d12acd35791a0b429..ae7cf8a185d605287280290554ebaeba613c8130 100644
(file)
--- a/
vg_msg.h
+++ b/
vg_msg.h
@@
-282,6
+282,10
@@
static void vg_msg_wkvu32( vg_msg *msg, const char *key, u32 value ){
vg_msg_wkvnum( msg, key, k_vg_msg_unsigned|k_vg_msg_32b, 1, &value );
}
vg_msg_wkvnum( msg, key, k_vg_msg_unsigned|k_vg_msg_32b, 1, &value );
}
+static void vg_msg_wkvu64( vg_msg *msg, const char *key, u64 value ){
+ vg_msg_wkvnum( msg, key, k_vg_msg_unsigned|k_vg_msg_64b, 1, &value );
+}
+
/*
* The stream reading interface
* -----------------------------------------------------------------------------
/*
* The stream reading interface
* -----------------------------------------------------------------------------
@@
-436,24
+440,28
@@
static const char *vg_msg_seekkvstr( vg_msg *msg, const char *key,
else return NULL;
}
else return NULL;
}
-static u32 vg_msg_seekkvu32( vg_msg *msg, const char *key, enum vg_msg_dir dir )
-{
- vg_msg_cmd cmd = vg_msg_seekkv( msg, key, dir );
- u8 sized_type = cmd.code & k_vg_msg_sized_type_bits;
+static u64 vg_msg_read_as_u64( vg_msg_cmd *cmd ){
+ u8 sized_type = cmd->code & k_vg_msg_sized_type_bits;
- u
32
result = 0x00;
+ u
64
result = 0x00;
u8 *dst = (void *)(&result);
u8 *dst = (void *)(&result);
- const u8 *src = cmd
.
value;
+ const u8 *src = cmd
->
value;
if( (sized_type == k_vg_msg_unsigned) || (sized_type == k_vg_msg_signed) ){
if( (sized_type == k_vg_msg_unsigned) || (sized_type == k_vg_msg_signed) ){
- u32 bytes = vg_msg_sized_bytecount( cmd
.
code );
- if( bytes >
4 ) bytes = 4
;
+ u32 bytes = vg_msg_sized_bytecount( cmd
->
code );
+ if( bytes >
8 ) bytes = 8
;
for( u32 i=0; i<bytes; i ++ ) dst[i] = src[i];
}
return result;
}
for( u32 i=0; i<bytes; i ++ ) dst[i] = src[i];
}
return result;
}
+static u32 vg_msg_seekkvu32( vg_msg *msg, const char *key, enum vg_msg_dir dir )
+{
+ vg_msg_cmd cmd = vg_msg_seekkv( msg, key, dir );
+ return vg_msg_read_as_u64( &cmd );
+}
+
/* debug the thing */
static void vg_msg_print( vg_msg *msg ){
vg_msg b = *msg;
/* debug the thing */
static void vg_msg_print( vg_msg *msg ){
vg_msg b = *msg;