Re: [Registry] change
Brought to you by:
aviram
|
From: Jens A. <ra...@sk...> - 2004-10-18 16:31:10
|
----- Original Message ----- From: "Markus Raab" <mai...@gm...> To: <reg...@li...> Sent: Sunday, October 17, 2004 10:20 PM Subject: Re: [Registry] change > Am Sonntag, 17. Oktober 2004 15:42 schrieb Avi Alkalay: > >> One of the checks (and probably what is killing you) is the size of >> the passed buffer and the data size. If the second it bigger, 0 is >> returned and you'll get KDB_RET_TRUNC in errno. > > No, that works ok! (see example code, i use sizeof (int)) > >> See the supersimple code here: >> http://elektra.sourceforge.net/elektra-api/html/key_8c-source.html#l00953 > > I have already looked into it, the prob is, that there is no data. > > 954 if (!key || !keyIsInitialized(key)) > (gdb) > 957 if (!key->data) { > (gdb) > 958 errno=KDB_RET_NODATA; > (gdb) > 959 return 0; > > and to find this problem i would have to debug complete elektra! I assume you get this error from keyGetBinary? Running your code (with some minor modifications) gives me an error in kdbGetKey..However the error is probably deeper down! Specifically in the unencode function. It seems that the binary data gets written fine to file(data fits at least), but something goes wrong when reading in. I made some tests and when the int is set to 25 and then saved, kdb saves it as 19000 to file. (and 25 in hex is 19 so that seems fair enough..although the extra zeros seem malplaced? If I use a hex->dec converter 19000 gives me 102400). When it's read back in and unencode is called the data passed there is simply 190 (and seemingly some garbage data as well). This could possibly be the problem? Tbh, i'm not sure if you can even just convert it back and set it the way the code does? (from further investigation it seems you can't..It gives some really weird results) > Can you give me an example where getting binary Data works? binary data works fine with strings :) (i.e. saving a char * to disk as binary and reading it again). Dunno about other data types, haven't tried. Int currently doesn't work at least :) Regards, Jens Andersen |