From 62570658514561d7588a92fc81c0361d52e584df Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 7 Apr 2023 13:45:44 -0400 Subject: [PATCH] learn about metadata 32 --- citadel/utils/ctdl3264.c | 10 ++++++++-- citadel/utils/ctdl3264_prep.sh | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/citadel/utils/ctdl3264.c b/citadel/utils/ctdl3264.c index 9306a03c2..aef21eb97 100644 --- a/citadel/utils/ctdl3264.c +++ b/citadel/utils/ctdl3264.c @@ -110,9 +110,9 @@ void null_function(int which_cdb, DBT *key, DBT *data) { // convert function for a message in msgmain void convert_msgmain(int which_cdb, DBT *key, DBT *data) { - long msgnum; + int32_t msgnum; memcpy(&msgnum, key->data, sizeof(msgnum)); - printf("msgmain: len is %d , key is %ld\n", key->size, msgnum); + printf("msgmain: len is %d , key is %d\n", key->size, msgnum); if (key->size != 4) { printf("\033[31m\033[1m *** SOURCE DATABASE IS NOT 32-BIT *** ABORTING *** \033[0m\n"); @@ -120,6 +120,12 @@ void convert_msgmain(int which_cdb, DBT *key, DBT *data) { } + if (msgnum < 0) { + struct MetaData_32 meta; + printf("metadata: db says %d bytes , struct says %ld bytes\n", data->size, sizeof meta); + memset(&meta, 0, sizeof meta); + memcpy(&meta, data->data, data->size); + } // If the msgnum is positive, we are looking at a MESSAGE // If the msgnum is negative, we are looking at METADATA diff --git a/citadel/utils/ctdl3264_prep.sh b/citadel/utils/ctdl3264_prep.sh index 9a2ac2072..11750e413 100755 --- a/citadel/utils/ctdl3264_prep.sh +++ b/citadel/utils/ctdl3264_prep.sh @@ -31,5 +31,6 @@ convert_struct() { convert_struct "ctdlroom" convert_struct "floor" convert_struct "visit" + convert_struct "MetaData" ) >utils/ctdl3264_structs.h -- 2.39.2