bb download
list Malcolm Hunter
Hi, I'm trying to get the download option working (get_binary in the code). This seems to work successfully for the first time you download. However, any subsequent downloads only create a zero-sized file. Is this a known bug? The similar function (get_config) works flawlessly but obviously doesn't work with binary files. Kind regards, Malcolm -- Technical copy-editor & proofreader KDE Proofreading Team KDE British English Translation Team http://l10n.kde.org/team-infos.php?teamcode=en_GB Facebook: http://www.facebook.com/FriendlyAtheist Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
list Alexander Bech
▸
Malcolm Hunter schrieb:
Hi, I'm trying to get the download option working (get_binary in the code). This seems to work successfully for the first time you download. However, any subsequent downloads only create a zero-sized file. Is this a known bug? The similar function (get_config) works flawlessly but obviously doesn't work with binary files. Kind regards, Malcolm
Hi, I have solved this problem with commenting out the line 1975 in hobbitd.c: /* add_filecache(fullfn, result, st.st_size); */ and recompiling it. Regards, Alex
list Malcolm Hunter
It seems it is a bug in the code. When msg is assigned the values, it's given the wrong length. Here's a patch that fixes the problem:
--- hobbitd.c 2009-12-08 16:20:54.000000000 +0000
+++ hobbitd.c.fixed 2009-12-08 16:19:04.000000000 +0000
@@ -1858,5 +1858,5 @@
-unsigned char *get_filecache(char *fn)
+unsigned char *get_filecache(char *fn, long *flen)
{
RbtIterator handle;
@@ -1872,4 +1872,5 @@
result = (unsigned char *)malloc(item->len);
memcpy(result, item->fdata, item->len);
+ flen = item->len;
return result;
@@ -1948,9 +1949,10 @@
struct stat st;
unsigned char *result;
+ long flen;
dbgprintf("-> get_binary %s\n", fn);
sprintf(fullfn, "%s/download/%s", xgetenv("BBHOME"), fn);
- result = get_filecache(fullfn);
+ result = get_filecache(fullfn, &flen);
if (!result) {
fd = open(fullfn, O_RDONLY);
@@ -1974,7 +1976,8 @@
add_filecache(fullfn, result, st.st_size);
+ flen = st.st_size;
}
- msg->buflen = st.st_size;
+ msg->buflen = flen;
msg->buf = result;
msg->bufp = msg->buf + msg->buflen;
▸
-- Technical copy-editor & proofreader KDE Proofreading Team KDE British English Translation Team http://l10n.kde.org/team-infos.php?teamcode=en_GB Facebook: http://www.facebook.com/FriendlyAtheist Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
list Malcolm Hunter
▸
It seems it is a bug in the code. When msg is assigned the values, it's
given the wrong length. Here's a patch that fixes the problem:
--- hobbitd.c 2009-12-08 16:20:54.000000000 +0000
+++ hobbitd.c.fixed 2009-12-08 16:19:04.000000000 +0000
@@ -1858,5 +1858,5 @@
-unsigned char *get_filecache(char *fn)
+unsigned char *get_filecache(char *fn, long *flen)
{
RbtIterator handle;
@@ -1872,4 +1872,5 @@
result = (unsigned char *)malloc(item->len);
memcpy(result, item->fdata, item->len);
+ flen = item->len;Oops! This line should read: *flen = item->len;
▸
Malcolm -- Technical copy-editor & proofreader KDE Proofreading Team KDE British English Translation Team http://l10n.kde.org/team-infos.php?teamcode=en_GB Facebook: http://www.facebook.com/FriendlyAtheist
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01