join works
FossilOrigin-Name: 85bcc56e6aca1fbb8c437e74bc6bdc16d378a510e8e48a7fb58b996e919e138f
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
#include "ktv.h"
|
||||
#include "dbg.h"
|
||||
#include "log.h"
|
||||
|
||||
int cw_ktv_write_struct(mavl_t ktv, const cw_KTVStruct_t * stru, const char *pkey,
|
||||
uint8_t * dst)
|
||||
{
|
||||
char key[CW_KTV_MAX_KEY_LEN];
|
||||
int pos, i;
|
||||
cw_KTV_t * result;
|
||||
|
||||
pos=0; i=0;
|
||||
for(i=0; stru[i].type != NULL;i++){
|
||||
|
||||
if (stru[i].position!=-1){
|
||||
pos=stru[i].position;
|
||||
}
|
||||
memset(dst+pos,0,stru[i].len);
|
||||
|
||||
sprintf(key,"%s/%s",pkey,stru[i].key);
|
||||
result = cw_ktv_get(ktv,key,stru[i].type);
|
||||
|
||||
if (result == NULL){
|
||||
cw_log(LOG_ERR,"Can't put %s, no value found",key);
|
||||
continue;
|
||||
}
|
||||
|
||||
result->type->put(result,dst+pos);
|
||||
|
||||
pos+=stru[i].len;
|
||||
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
Reference in New Issue
Block a user