mirror of
https://github.com/fumiama/simple-kanban.git
synced 2026-06-12 12:50:25 +08:00
适配新的spb
This commit is contained in:
12
cfgwriter.c
12
cfgwriter.c
@@ -10,22 +10,12 @@ typedef struct CONFIG CONFIG;
|
|||||||
|
|
||||||
CONFIG cfg;
|
CONFIG cfg;
|
||||||
|
|
||||||
uint64_t items_len[2] = {sizeof(cfg.pwd), sizeof(cfg.sps)};
|
|
||||||
uint8_t types_len[2];
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Enter a password: ");
|
printf("Enter a password: ");
|
||||||
scanf("%s", cfg.pwd);
|
scanf("%s", cfg.pwd);
|
||||||
printf("Enter a set password: ");
|
printf("Enter a set password: ");
|
||||||
scanf("%s", cfg.sps);
|
scanf("%s", cfg.sps);
|
||||||
for(int i = 0; i < 2; i++) {
|
uint64_t* types_len = align_struct(sizeof(CONFIG), 2, &cfg.pwd, &cfg.sps);
|
||||||
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]);
|
|
||||||
}*/
|
|
||||||
FILE* fp = fopen("cfg.sp", "wb");
|
FILE* fp = fopen("cfg.sp", "wb");
|
||||||
if(fp) {
|
if(fp) {
|
||||||
set_pb(fp, types_len, sizeof(CONFIG), &cfg);
|
set_pb(fp, types_len, sizeof(CONFIG), &cfg);
|
||||||
|
|||||||
Submodule simple-protobuf updated: 234e414be2...05fa5921e6
Reference in New Issue
Block a user