From 42993de040a68267e9f511bf0bcf2baaf6f739cc Mon Sep 17 00:00:00 2001 From: fumiama Date: Tue, 18 May 2021 12:45:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E7=9A=84spb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cfgwriter.c | 12 +----------- simple-protobuf | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/cfgwriter.c b/cfgwriter.c index 72d10bf..43a9539 100644 --- a/cfgwriter.c +++ b/cfgwriter.c @@ -10,22 +10,12 @@ typedef struct CONFIG CONFIG; CONFIG cfg; -uint64_t items_len[2] = {sizeof(cfg.pwd), sizeof(cfg.sps)}; -uint8_t types_len[2]; - int main() { printf("Enter a password: "); scanf("%s", cfg.pwd); printf("Enter a set password: "); scanf("%s", cfg.sps); - for(int i = 0; i < 2; i++) { - types_len[i] = first_set(items_len[i]); - printf("Item %d has type %d with size %llu\n", i, types_len[i], items_len[i]); - } - /*align_struct(types_len, 2, sizeof(CONFIG)); - for(int i = 0; i < 5; i++) { - printf("Item %d's type after align: %u\n", i, types_len[i]); - }*/ + uint64_t* types_len = align_struct(sizeof(CONFIG), 2, &cfg.pwd, &cfg.sps); FILE* fp = fopen("cfg.sp", "wb"); if(fp) { set_pb(fp, types_len, sizeof(CONFIG), &cfg); diff --git a/simple-protobuf b/simple-protobuf index 234e414..05fa592 160000 --- a/simple-protobuf +++ b/simple-protobuf @@ -1 +1 @@ -Subproject commit 234e414be2add42aace07635c7712581d1a9dada +Subproject commit 05fa5921e6f104d00752e2c05ad11383cd471852