From e310c6fb680eb33b2f1dbea5d88ca13d3536e160 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Sep 2009 12:23:57 +0000 Subject: [PATCH] fixes --- src/fs/fs_publish.c | 3 ++- src/fs/fs_tree.c | 2 +- src/fs/fs_uri.c | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 8417f6082..422984ecb 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -210,7 +210,8 @@ signal_publish_completion (struct GNUNET_FS_FileInformation *p, struct GNUNET_FS_ProgressInfo pi; pi.status = GNUNET_FS_STATUS_PUBLISH_COMPLETED; - make_publish_status (&pi, sc, p, p->chk_uri->data.chk.file_length); + make_publish_status (&pi, sc, p, + GNUNET_ntohll (p->chk_uri->data.chk.file_length)); pi.value.publish.eta = GNUNET_TIME_UNIT_ZERO; pi.value.publish.specifics.completed.chk_uri = p->chk_uri; p->client_info diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 5d6a4f1d9..f5205f082 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c @@ -347,7 +347,7 @@ void GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder * te) te->uri = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); te->uri->type = chk; te->uri->data.chk.chk = te->chk_tree[0]; - te->uri->data.chk.file_length = te->size; + te->uri->data.chk.file_length = GNUNET_htonll (te->size); GNUNET_SCHEDULER_add_continuation (te->h->sched, GNUNET_NO, te->cont, diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index 47bad3454..7959c37af 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -396,6 +396,7 @@ uri_chk_parse (const char *s, char **emsg) struct GNUNET_FS_Uri *ret; struct FileIdentifier fi; unsigned int pos; + unsigned long long flen; size_t slen; char h1[sizeof(struct GNUNET_CRYPTO_HashAsciiEncoded)]; char h2[sizeof(struct GNUNET_CRYPTO_HashAsciiEncoded)]; @@ -429,12 +430,12 @@ uri_chk_parse (const char *s, char **emsg) &fi.chk.query)) || (1 != SSCANF (&s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) * 2], "%llu", - &fi.file_length))) + &flen)) ) { *emsg = GNUNET_strdup (_("Malformed CHK URI")); return NULL; } - fi.file_length = GNUNET_htonll (fi.file_length); + fi.file_length = GNUNET_htonll (flen); ret = GNUNET_malloc (sizeof(struct GNUNET_FS_Uri)); ret->type = chk; ret->data.chk = fi; @@ -544,6 +545,7 @@ uri_loc_parse (const char *s, char **emsg) unsigned int pos; unsigned int npos; unsigned long long exptime; + unsigned long long flen; struct GNUNET_TIME_Absolute et; struct GNUNET_CRYPTO_RsaSignature sig; struct LocUriAssembly ass; @@ -578,12 +580,12 @@ uri_loc_parse (const char *s, char **emsg) &ass.fi.chk.query)) || (1 != SSCANF (&s[pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) * 2], "%llu", - &ass.fi.file_length)) ) + &flen)) ) { *emsg = GNUNET_strdup (_("SKS URI malformed")); return NULL; } - ass.fi.file_length = GNUNET_htonll (ass.fi.file_length); + ass.fi.file_length = GNUNET_htonll (flen); npos = pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) * 2; while ((s[npos] != '\0') && (s[npos] != '.')) -- 2.25.1