learn about metadata 32
authorArt Cancro <ajc@citadel.org>
Fri, 7 Apr 2023 17:45:44 +0000 (13:45 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 7 Apr 2023 17:45:44 +0000 (13:45 -0400)
citadel/utils/ctdl3264.c
citadel/utils/ctdl3264_prep.sh

index 9306a03c26a1ee74e61e3059165f174019190c34..aef21eb971afa67bcb4ff4030fb28b52d44315de 100644 (file)
@@ -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
index 9a2ac207240c7fbbd31dd81ec900ab0f182c359d..11750e41390c2eeb4749c8a33d81046cef9703a0 100755 (executable)
@@ -31,5 +31,6 @@ convert_struct() {
        convert_struct "ctdlroom"
        convert_struct "floor"
        convert_struct "visit"
+       convert_struct "MetaData"
 
 ) >utils/ctdl3264_structs.h