[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6839 - in GNUnet/src: applications/chat applications/datas
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6839 - in GNUnet/src: applications/chat applications/datastore applications/fs/ecrs applications/fs/fsui applications/fs/gap applications/fs/namespace applications/fs/tools applications/sqstore_mysql applications/sqstore_sqlite include server util/disk util/os |
Date: |
Sun, 18 May 2008 16:59:51 -0600 (MDT) |
Author: grothoff
Date: 2008-05-18 16:59:50 -0600 (Sun, 18 May 2008)
New Revision: 6839
Modified:
GNUnet/src/applications/chat/chattest.c
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/fs/ecrs/downloadtest.c
GNUnet/src/applications/fs/ecrs/ecrstest.c
GNUnet/src/applications/fs/ecrs/meta.c
GNUnet/src/applications/fs/ecrs/updowntest.c
GNUnet/src/applications/fs/ecrs/uri.c
GNUnet/src/applications/fs/fsui/recursive_download_test.c
GNUnet/src/applications/fs/fsui/unindex.c
GNUnet/src/applications/fs/gap/fs.c
GNUnet/src/applications/fs/gap/test_linear_topology.c
GNUnet/src/applications/fs/gap/test_loopback.c
GNUnet/src/applications/fs/gap/test_multi_results.c
GNUnet/src/applications/fs/gap/test_star_topology.c
GNUnet/src/applications/fs/namespace/common.c
GNUnet/src/applications/fs/namespace/common.h
GNUnet/src/applications/fs/namespace/names.c
GNUnet/src/applications/fs/namespace/namespace_info.c
GNUnet/src/applications/fs/namespace/namespace_info.h
GNUnet/src/applications/fs/namespace/namespace_infotest.c
GNUnet/src/applications/fs/namespace/namespace_notification.c
GNUnet/src/applications/fs/namespace/namespace_notification.h
GNUnet/src/applications/fs/namespace/root_info.c
GNUnet/src/applications/fs/namespace/update_info.c
GNUnet/src/applications/fs/namespace/uri.c
GNUnet/src/applications/fs/tools/gnunet-insert.c
GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
GNUnet/src/applications/sqstore_mysql/mysqltest.c
GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
GNUnet/src/include/gnunet_ecrs_lib.h
GNUnet/src/include/gnunet_namespace_lib.h
GNUnet/src/server/tcpserver.c
GNUnet/src/util/disk/storagetest.c
GNUnet/src/util/os/semaphoretest.c
Log:
indent
Modified: GNUnet/src/applications/chat/chattest.c
===================================================================
--- GNUnet/src/applications/chat/chattest.c 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/applications/chat/chattest.c 2008-05-18 22:59:50 UTC (rev
6839)
@@ -110,7 +110,7 @@
GNUNET_GC_free (cfg);
return -1;
}
- GNUNET_disable_entropy_gathering();
+ GNUNET_disable_entropy_gathering ();
key = GNUNET_RSA_create_key ();
GNUNET_RSA_get_public_key (key, &me);
#if START_PEERS
@@ -150,7 +150,7 @@
GNUNET_CHAT_send_message (r2, "test message 2", NULL, NULL,
GNUNET_CHAT_MSG_OPTION_NONE, NULL);
- CLEANUP:
+CLEANUP:
if (r1 != NULL)
GNUNET_CHAT_leave_room (r1);
if (r2 != NULL)
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/datastore/datastore.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -277,14 +277,14 @@
ntohl (value->priority) + comp_prio);
#endif
/* check if we have enough space / priority */
- if ( (available < ntohl (value->size)) ||
- (minPriority >= ntohl (value->priority) + comp_prio) )
+ if ((available < ntohl (value->size)) ||
+ (minPriority >= ntohl (value->priority) + comp_prio))
{
/* new content either does not fit (for sure)
- or has such a low priority that we should
- not even bother! */
+ or has such a low priority that we should
+ not even bother! */
GNUNET_mutex_unlock (lock);
- return GNUNET_NO;
+ return GNUNET_NO;
}
if (ntohl (value->priority) + comp_prio < minPriority)
minPriority = ntohl (value->priority) + comp_prio;
Modified: GNUnet/src/applications/fs/ecrs/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/downloadtest.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/ecrs/downloadtest.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -88,7 +88,7 @@
GNUNET_disk_file_open (NULL, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return NULL;
}
buf = GNUNET_malloc (size);
Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-05-18 22:59:50 UTC (rev
6839)
@@ -81,7 +81,7 @@
GNUNET_disk_file_open (NULL, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (size);
@@ -196,10 +196,10 @@
{
fd = GNUNET_disk_file_open (NULL, tmpName, O_RDONLY);
if (fd == -1)
- {
- GNUNET_free(tmpName);
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_free (tmpName);
+ return GNUNET_SYSERR;
+ }
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/applications/fs/ecrs/meta.c 2008-05-18 22:59:50 UTC (rev
6839)
@@ -84,7 +84,7 @@
{
int idx;
char *p;
-
+
GNUNET_GE_ASSERT (NULL, data != NULL);
for (idx = 0; idx < md->itemCount; idx++)
{
@@ -96,13 +96,14 @@
GNUNET_array_grow (md->items, md->itemCount, md->itemCount + 1);
md->items[idx].type = type;
md->items[idx].data = p = GNUNET_strdup (data);
-
+
/* remove hints to OS */
- if (type == EXTRACTOR_FILENAME) {
- while ((p = strchr(p, '\\')))
- *p = '/';
- }
-
+ if (type == EXTRACTOR_FILENAME)
+ {
+ while ((p = strchr (p, '\\')))
+ *p = '/';
+ }
+
return GNUNET_OK;
}
Modified: GNUnet/src/applications/fs/ecrs/updowntest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/updowntest.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/ecrs/updowntest.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -70,7 +70,7 @@
GNUNET_disk_file_open (NULL, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (size);
@@ -119,10 +119,10 @@
{
fd = GNUNET_disk_file_open (NULL, tmpName, O_RDONLY);
if (fd == -1)
- {
- GNUNET_free(tmpName);
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_free (tmpName);
+ return GNUNET_SYSERR;
+ }
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/applications/fs/ecrs/uri.c 2008-05-18 22:59:50 UTC (rev
6839)
@@ -279,7 +279,8 @@
* (i.e. the search query that was used in the first place)
*/
char *
-GNUNET_ECRS_ksk_uri_to_human_readable_string (const struct GNUNET_ECRS_URI
*uri)
+GNUNET_ECRS_ksk_uri_to_human_readable_string (const struct GNUNET_ECRS_URI
+ *uri)
{
size_t n;
char *ret;
@@ -288,8 +289,7 @@
char **keywords;
unsigned int keywordCount;
- if ( (uri == NULL) ||
- (uri->type != ksk) )
+ if ((uri == NULL) || (uri->type != ksk))
{
GNUNET_GE_BREAK (NULL, 0);
return NULL;
@@ -300,23 +300,23 @@
for (i = 0; i < keywordCount; i++)
{
keyword = keywords[i];
- n += strlen(keyword);
- if (NULL != strstr(keyword, " "))
- n += 2;
+ n += strlen (keyword);
+ if (NULL != strstr (keyword, " "))
+ n += 2;
}
ret = GNUNET_malloc (n);
strcpy (ret, "");
for (i = 0; i < keywordCount; i++)
{
keyword = keywords[i];
- if (NULL != strstr(keyword, " "))
- {
- strcat(ret, "\"");
- strcat(ret, keyword);
- strcat(ret, "\"");
- }
+ if (NULL != strstr (keyword, " "))
+ {
+ strcat (ret, "\"");
+ strcat (ret, keyword);
+ strcat (ret, "\"");
+ }
else
- strcat(ret, keyword);
+ strcat (ret, keyword);
}
return ret;
}
Modified: GNUnet/src/applications/fs/fsui/recursive_download_test.c
===================================================================
--- GNUnet/src/applications/fs/fsui/recursive_download_test.c 2008-05-18
22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/fsui/recursive_download_test.c 2008-05-18
22:59:50 UTC (rev 6839)
@@ -321,9 +321,9 @@
}
GNUNET_FSUI_upload_stop (upload);
upload = NULL;
- CHECK(upURI != NULL);
-
- waitForEvent = GNUNET_FSUI_download_completed;
+ CHECK (upURI != NULL);
+
+ waitForEvent = GNUNET_FSUI_download_completed;
fn43 = makeName (43);
download = GNUNET_FSUI_download_start (ctx,
0,
Modified: GNUnet/src/applications/fs/fsui/unindex.c
===================================================================
--- GNUnet/src/applications/fs/fsui/unindex.c 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/applications/fs/fsui/unindex.c 2008-05-18 22:59:50 UTC (rev
6839)
@@ -252,7 +252,7 @@
GNUNET_FSUI_Event event;
if (dl == NULL)
- return GNUNET_SYSERR;
+ return GNUNET_SYSERR;
ctx = dl->ctx;
ectx = ctx->ectx;
#if 0
Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-05-18 22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-05-18 22:59:50 UTC (rev 6839)
@@ -153,8 +153,8 @@
{
cectx = coreAPI->cs_log_context_create (sock);
GNUNET_GE_LOG (cectx,
- GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
- _("Datastore full.\n"));
+ GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
+ _("Datastore full.\n"));
GNUNET_GE_free_context (cectx);
}
GNUNET_free (datum);
Modified: GNUnet/src/applications/fs/gap/test_linear_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-05-18
22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-05-18
22:59:50 UTC (rev 6839)
@@ -95,7 +95,7 @@
GNUNET_disk_file_open (ectx, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (size);
@@ -209,10 +209,10 @@
fd = GNUNET_disk_file_open (ectx, tmpName, O_RDONLY);
if (fd == -1)
- {
- GNUNET_free(tmpName);
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_free (tmpName);
+ return GNUNET_SYSERR;
+ }
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size / 253, sizeof (GNUNET_HashCode));
Modified: GNUnet/src/applications/fs/gap/test_loopback.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_loopback.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/gap/test_loopback.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -90,7 +90,7 @@
GNUNET_disk_file_open (ectx, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc (size);
@@ -204,10 +204,10 @@
fd = GNUNET_disk_file_open (ectx, tmpName, O_RDONLY);
if (fd == -1)
- {
- GNUNET_free(tmpName);
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_free (tmpName);
+ return GNUNET_SYSERR;
+ }
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
Modified: GNUnet/src/applications/fs/gap/test_multi_results.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_multi_results.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/gap/test_multi_results.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -85,7 +85,7 @@
GNUNET_disk_file_open (ectx, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return NULL;
}
buf = GNUNET_malloc (size);
Modified: GNUnet/src/applications/fs/gap/test_star_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_star_topology.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/gap/test_star_topology.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -95,7 +95,7 @@
GNUNET_disk_file_open (ectx, name, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR);
if (fd == -1)
{
- GNUNET_free(name);
+ GNUNET_free (name);
return GNUNET_SYSERR;
}
buf = GNUNET_malloc_large (size);
@@ -147,10 +147,10 @@
fd = GNUNET_disk_file_open (ectx, tmpName, O_RDONLY);
if (fd == -1)
- {
- GNUNET_free (tmpName);
- return GNUNET_SYSERR;
- }
+ {
+ GNUNET_free (tmpName);
+ return GNUNET_SYSERR;
+ }
buf = GNUNET_malloc (size);
in = GNUNET_malloc (size);
memset (buf, size + size / 253, size);
Modified: GNUnet/src/applications/fs/namespace/common.c
===================================================================
--- GNUnet/src/applications/fs/namespace/common.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/namespace/common.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -40,10 +40,10 @@
*/
char *
GNUNET_NS_internal_get_data_filename_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char * prefix,
- const GNUNET_HashCode *nsid,
- const GNUNET_HashCode * lastId)
+ struct GNUNET_GC_Configuration *cfg,
+ const char *prefix,
+ const GNUNET_HashCode * nsid,
+ const GNUNET_HashCode * lastId)
{
char *tmp;
char *ret;
@@ -57,17 +57,17 @@
&tmp);
ret =
GNUNET_malloc (strlen (tmp) + strlen (prefix) +
- sizeof (GNUNET_EncName)*2 + 20);
+ sizeof (GNUNET_EncName) * 2 + 20);
strcpy (ret, tmp);
GNUNET_free (tmp);
- if (ret[strlen(ret)-1] != DIR_SEPARATOR)
+ if (ret[strlen (ret) - 1] != DIR_SEPARATOR)
strcat (ret, DIR_SEPARATOR_STR);
strcat (ret, prefix);
GNUNET_disk_directory_create (ectx, ret);
if (nsid != NULL)
{
- GNUNET_hash_to_enc(nsid, &enc);
- strcat (ret, (const char*)&enc);
+ GNUNET_hash_to_enc (nsid, &enc);
+ strcat (ret, (const char *) &enc);
}
if (lastId != NULL)
{
Modified: GNUnet/src/applications/fs/namespace/common.h
===================================================================
--- GNUnet/src/applications/fs/namespace/common.h 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/namespace/common.h 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -44,11 +44,10 @@
* @param nsid maybe NULL
* @param lastId maybe NULL
*/
-char *
-GNUNET_NS_internal_get_data_filename_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char * prefix,
- const GNUNET_HashCode *nsid,
- const GNUNET_HashCode * lastId);
+char *GNUNET_NS_internal_get_data_filename_ (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration
+ *cfg, const char *prefix,
+ const GNUNET_HashCode * nsid,
+ const GNUNET_HashCode * lastId);
#endif
Modified: GNUnet/src/applications/fs/namespace/names.c
===================================================================
--- GNUnet/src/applications/fs/namespace/names.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/namespace/names.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -38,49 +38,43 @@
*
* @return NULL on failure (should never happen)
*/
-char *
-GNUNET_NS_nsid_to_name(struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid)
+char *
+GNUNET_NS_nsid_to_name (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid)
{
- struct GNUNET_ECRS_MetaData * meta;
- char * name;
+ struct GNUNET_ECRS_MetaData *meta;
+ char *name;
GNUNET_HashCode nh;
- char * fn;
+ char *fn;
unsigned long long len;
int fd;
unsigned int i;
unsigned int idx;
- char * ret;
+ char *ret;
meta = NULL;
name = NULL;
- GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, nsid, &meta, NULL,
&name);
- if ( (meta != NULL) &&
- (name == NULL) )
- name = GNUNET_ECRS_meta_data_get_first_by_types(meta,
- EXTRACTOR_TITLE,
- EXTRACTOR_FILENAME,
- EXTRACTOR_DESCRIPTION,
- EXTRACTOR_SUBJECT,
- EXTRACTOR_PUBLISHER,
- EXTRACTOR_AUTHOR,
- EXTRACTOR_COMMENT,
- EXTRACTOR_SUMMARY,
- EXTRACTOR_OWNER,
- -1);
+ GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, nsid, &meta, NULL,
+ &name);
+ if ((meta != NULL) && (name == NULL))
+ name = GNUNET_ECRS_meta_data_get_first_by_types (meta,
+ EXTRACTOR_TITLE,
+ EXTRACTOR_FILENAME,
+ EXTRACTOR_DESCRIPTION,
+ EXTRACTOR_SUBJECT,
+ EXTRACTOR_PUBLISHER,
+ EXTRACTOR_AUTHOR,
+ EXTRACTOR_COMMENT,
+ EXTRACTOR_SUMMARY,
+ EXTRACTOR_OWNER, -1);
if (meta != NULL)
- GNUNET_ECRS_meta_data_destroy(meta);
+ GNUNET_ECRS_meta_data_destroy (meta);
if (name == NULL)
- name = GNUNET_strdup(_("no-name"));
- GNUNET_hash(name,
- strlen(name),
- &nh);
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_NAMES_DIR,
- &nh,
- NULL);
+ name = GNUNET_strdup (_("no-name"));
+ GNUNET_hash (name, strlen (name), &nh);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg, NS_NAMES_DIR, &nh, NULL);
if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
fn) ||
(GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))))
@@ -88,39 +82,30 @@
GNUNET_free (fn);
return NULL;
}
- fd = GNUNET_disk_file_open(ectx,
- fn,
- O_CREAT | O_RDWR,
- S_IRUSR | S_IWUSR);
+ fd = GNUNET_disk_file_open (ectx, fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
i = 0;
idx = -1;
- while ( (len >= sizeof(GNUNET_HashCode)) &&
- (sizeof(GNUNET_HashCode)
- == READ(fd, &nh, sizeof(GNUNET_HashCode))))
+ while ((len >= sizeof (GNUNET_HashCode)) &&
+ (sizeof (GNUNET_HashCode)
+ == READ (fd, &nh, sizeof (GNUNET_HashCode))))
{
- if (0 == memcmp(&nh,
- nsid,
- sizeof(GNUNET_HashCode)))
- {
- idx = i;
- break;
- }
+ if (0 == memcmp (&nh, nsid, sizeof (GNUNET_HashCode)))
+ {
+ idx = i;
+ break;
+ }
i++;
- len -= sizeof(GNUNET_HashCode);
+ len -= sizeof (GNUNET_HashCode);
}
if (idx == -1)
{
idx = i;
- WRITE(fd, nsid, sizeof(GNUNET_HashCode));
+ WRITE (fd, nsid, sizeof (GNUNET_HashCode));
}
- CLOSE(fd);
- ret = GNUNET_malloc(strlen(name) + 32);
- GNUNET_snprintf(ret,
- strlen(name) + 32,
- "%s-%u",
- name,
- idx);
- GNUNET_free(name);
+ CLOSE (fd);
+ ret = GNUNET_malloc (strlen (name) + 32);
+ GNUNET_snprintf (ret, strlen (name) + 32, "%s-%u", name, idx);
+ GNUNET_free (name);
GNUNET_free (fn);
return ret;
}
@@ -130,60 +115,48 @@
*
* @return GNUNET_OK on success
*/
-int GNUNET_NS_name_to_nsid(struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char * ns_uname,
- GNUNET_HashCode * nsid)
+int
+GNUNET_NS_name_to_nsid (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *ns_uname, GNUNET_HashCode * nsid)
{
size_t slen;
unsigned long long len;
unsigned int idx;
- char * name;
+ char *name;
GNUNET_HashCode nh;
- char * fn;
+ char *fn;
int fd;
idx = -1;
- slen = strlen(ns_uname);
- while ( (slen > 0) &&
- (1 != sscanf(&ns_uname[slen-1],
- "-%u",
- &idx)) )
+ slen = strlen (ns_uname);
+ while ((slen > 0) && (1 != sscanf (&ns_uname[slen - 1], "-%u", &idx)))
slen--;
if (slen == 0)
return GNUNET_SYSERR;
- name = GNUNET_strdup(ns_uname);
+ name = GNUNET_strdup (ns_uname);
name[slen] = '\0';
- GNUNET_hash(name,
- strlen(name),
- &nh);
- GNUNET_free(name);
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_NAMES_DIR,
- &nh,
- NULL);
- if ( (GNUNET_OK != GNUNET_disk_file_test (ectx,
- fn) ||
- (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))) ||
- ( (idx+1) * sizeof(GNUNET_HashCode) > len) )
+ GNUNET_hash (name, strlen (name), &nh);
+ GNUNET_free (name);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg, NS_NAMES_DIR, &nh, NULL);
+ if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
+ fn) ||
+ (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))) ||
+ ((idx + 1) * sizeof (GNUNET_HashCode) > len))
{
GNUNET_free (fn);
return GNUNET_SYSERR;
}
- fd = GNUNET_disk_file_open(ectx,
- fn,
- O_CREAT | O_RDWR,
- S_IRUSR | S_IWUSR);
+ fd = GNUNET_disk_file_open (ectx, fn, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
GNUNET_free (fn);
- LSEEK(fd, idx * sizeof(GNUNET_HashCode), SEEK_SET);
- if (sizeof(GNUNET_HashCode) !=
- READ(fd, nsid, sizeof(GNUNET_HashCode)))
+ LSEEK (fd, idx * sizeof (GNUNET_HashCode), SEEK_SET);
+ if (sizeof (GNUNET_HashCode) != READ (fd, nsid, sizeof (GNUNET_HashCode)))
{
- CLOSE(fd);
+ CLOSE (fd);
return GNUNET_SYSERR;
}
- CLOSE(fd);
+ CLOSE (fd);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/fs/namespace/namespace_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_info.c 2008-05-18
22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/namespace/namespace_info.c 2008-05-18
22:59:50 UTC (rev 6839)
@@ -35,11 +35,10 @@
static void
write_namespace_info (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- const struct GNUNET_ECRS_MetaData *meta,
- int ranking,
- const char * ns_name)
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ const struct GNUNET_ECRS_MetaData *meta,
+ int ranking, const char *ns_name)
{
unsigned int size;
unsigned int tag;
@@ -47,11 +46,9 @@
char *buf;
char *fn;
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_METADATA_DIR,
- nsid,
- NULL);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg,
+ NS_METADATA_DIR, nsid, NULL);
size =
GNUNET_ECRS_meta_data_get_serialized_size (meta,
GNUNET_ECRS_SERIALIZE_FULL);
@@ -59,60 +56,54 @@
off = 0;
if (ns_name != NULL)
{
- off = strlen(ns_name);
+ off = strlen (ns_name);
tag += off;
}
buf = GNUNET_malloc (tag);
((int *) buf)[0] = htonl (ranking); /* ranking */
if (ns_name != NULL)
{
- memcpy(&buf[sizeof(int)],
- ns_name,
- off + 1);
+ memcpy (&buf[sizeof (int)], ns_name, off + 1);
}
else
{
- buf[sizeof(int)] = '\0';
+ buf[sizeof (int)] = '\0';
}
GNUNET_GE_ASSERT (ectx,
size == GNUNET_ECRS_meta_data_serialize (ectx,
meta,
&buf[sizeof
- (int) + off
+ 1],
+ (int) +
+ off + 1],
size,
GNUNET_ECRS_SERIALIZE_FULL));
GNUNET_disk_file_write (ectx, fn, buf, tag, "660");
GNUNET_free (fn);
GNUNET_free (buf);
/* create entry for namespace name in names */
- GNUNET_free_non_null (GNUNET_NS_nsid_to_name(ectx,
- cfg,
- nsid));
+ GNUNET_free_non_null (GNUNET_NS_nsid_to_name (ectx, cfg, nsid));
}
int
GNUNET_NS_internal_read_namespace_info_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- struct GNUNET_ECRS_MetaData **meta,
- int *ranking,
- char ** ns_name)
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ struct GNUNET_ECRS_MetaData **meta,
+ int *ranking, char **ns_name)
{
unsigned long long len;
unsigned int size;
unsigned int zend;
char *buf;
char *fn;
-
+
if (meta != NULL)
*meta = NULL;
if (ns_name != NULL)
*ns_name = NULL;
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_METADATA_DIR,
- nsid,
- NULL);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg,
+ NS_METADATA_DIR, nsid, NULL);
if ((GNUNET_OK != GNUNET_disk_file_test (ectx,
fn) ||
(GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &len, GNUNET_YES))))
@@ -142,9 +133,8 @@
}
if (ranking != NULL)
*ranking = ntohl (((int *) buf)[0]);
- zend = sizeof(int);
- while ( (zend < len) &&
- (buf[zend] != '\0') )
+ zend = sizeof (int);
+ while ((zend < len) && (buf[zend] != '\0'))
zend++;
if (zend == len)
{
@@ -152,12 +142,12 @@
GNUNET_free (fn);
return GNUNET_SYSERR;
}
- if (ns_name != NULL)
+ if (ns_name != NULL)
{
- if (zend != sizeof(int))
- *ns_name = GNUNET_strdup(&buf[sizeof(int)]);
+ if (zend != sizeof (int))
+ *ns_name = GNUNET_strdup (&buf[sizeof (int)]);
else
- *ns_name = NULL;
+ *ns_name = NULL;
}
zend++;
size = len - zend;
@@ -165,14 +155,14 @@
{
*meta = GNUNET_ECRS_meta_data_deserialize (ectx, &buf[zend], size);
if ((*meta) == NULL)
- {
- /* invalid data! remove! */
- GNUNET_GE_BREAK (ectx, 0);
- UNLINK (fn);
- GNUNET_free (buf);
- GNUNET_free (fn);
- return GNUNET_SYSERR;
- }
+ {
+ /* invalid data! remove! */
+ GNUNET_GE_BREAK (ectx, 0);
+ UNLINK (fn);
+ GNUNET_free (buf);
+ GNUNET_free (fn);
+ return GNUNET_SYSERR;
+ }
}
GNUNET_free (fn);
GNUNET_free (buf);
@@ -193,19 +183,21 @@
struct ListNamespaceClosure *c = cls;
int ret;
GNUNET_HashCode id;
- char * name;
+ char *name;
int rating;
struct GNUNET_ECRS_MetaData *meta;
ret = GNUNET_OK;
if (GNUNET_OK != GNUNET_enc_to_hash (fn, &id))
return GNUNET_OK; /* invalid name */
- if (GNUNET_OK != GNUNET_NS_internal_read_namespace_info_ (c->ectx, c->cfg,
&id, &meta, &rating, NULL))
+ if (GNUNET_OK !=
+ GNUNET_NS_internal_read_namespace_info_ (c->ectx, c->cfg, &id, &meta,
+ &rating, NULL))
return GNUNET_OK; /* ignore entry */
- name = GNUNET_NS_nsid_to_name(c->ectx, c->cfg, &id);
- if (c->iterator != NULL)
+ name = GNUNET_NS_nsid_to_name (c->ectx, c->cfg, &id);
+ if (c->iterator != NULL)
ret = c->iterator (c->closure, name, &id, meta, rating);
- GNUNET_free_non_null(name);
+ GNUNET_free_non_null (name);
GNUNET_ECRS_meta_data_destroy (meta);
return ret;
}
@@ -227,7 +219,9 @@
cls.closure = closure;
cls.ectx = ectx;
cls.cfg = cfg;
- fn = GNUNET_NS_internal_get_data_filename_(ectx, cfg, NS_METADATA_DIR, NULL,
NULL);
+ fn =
+ GNUNET_NS_internal_get_data_filename_ (ectx, cfg, NS_METADATA_DIR, NULL,
+ NULL);
GNUNET_disk_directory_create (ectx, fn);
ret = GNUNET_disk_directory_scan (ectx, fn, &list_namespace_helper, &cls);
GNUNET_free (fn);
@@ -288,22 +282,18 @@
char *ns_name;
char *fn;
- if (GNUNET_OK != GNUNET_NS_internal_read_namespace_info_(ectx,
- cfg,
- nsid,
- NULL,
- NULL,
- &ns_name))
+ if (GNUNET_OK != GNUNET_NS_internal_read_namespace_info_ (ectx,
+ cfg,
+ nsid,
+ NULL,
+ NULL, &ns_name))
return GNUNET_SYSERR;
if (ns_name == NULL)
return GNUNET_SYSERR;
ret = GNUNET_ECRS_namespace_delete (ectx, cfg, ns_name);
- GNUNET_free(ns_name);
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_UPDATE_DIR,
- nsid,
- NULL);
+ GNUNET_free (ns_name);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg, NS_UPDATE_DIR, nsid, NULL);
GNUNET_disk_directory_remove (ectx, fn);
GNUNET_free (fn);
return ret;
@@ -319,16 +309,17 @@
*/
int
GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode *nsid,
- int delta)
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid, int delta)
{
struct GNUNET_ECRS_MetaData *meta;
int ret;
int ranking;
- char * name;
+ char *name;
- ret = GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, nsid, &meta,
&ranking, &name);
+ ret =
+ GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, nsid, &meta, &ranking,
+ &name);
if (ret == GNUNET_SYSERR)
{
ranking = 0;
@@ -337,7 +328,7 @@
ranking += delta;
write_namespace_info (ectx, cfg, nsid, meta, ranking, name);
GNUNET_ECRS_meta_data_destroy (meta);
- GNUNET_free(name);
+ GNUNET_free (name);
return ranking;
}
@@ -377,7 +368,9 @@
}
GNUNET_ECRS_uri_get_namespace_from_sks (uri, &id);
ranking = 0;
- if (GNUNET_OK == GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, &id,
&old, &ranking, &name))
+ if (GNUNET_OK ==
+ GNUNET_NS_internal_read_namespace_info_ (ectx, cfg, &id, &old, &ranking,
+ &name))
{
GNUNET_ECRS_meta_data_get_contents (meta, &merge_meta_helper, old);
write_namespace_info (ectx, cfg, &id, old, ranking, name);
Modified: GNUnet/src/applications/fs/namespace/namespace_info.h
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_info.h 2008-05-18
22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/namespace/namespace_info.h 2008-05-18
22:59:50 UTC (rev 6839)
@@ -32,10 +32,9 @@
int
GNUNET_NS_internal_read_namespace_info_ (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- struct GNUNET_ECRS_MetaData **meta,
- int *ranking,
- char ** ns_name);
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ struct GNUNET_ECRS_MetaData **meta,
+ int *ranking, char **ns_name);
#endif
Modified: GNUnet/src/applications/fs/namespace/namespace_infotest.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_infotest.c 2008-05-18
22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/namespace/namespace_infotest.c 2008-05-18
22:59:50 UTC (rev 6839)
@@ -77,7 +77,7 @@
10 * GNUNET_CRON_MINUTES, "test", meta,
NULL, &root);
CHECK (uri != NULL);
- GNUNET_ECRS_uri_get_namespace_from_sks(uri, &nsid);
+ GNUNET_ECRS_uri_get_namespace_from_sks (uri, &nsid);
newVal = GNUNET_NS_namespace_list_all (ectx, cfg, NULL, NULL);
CHECK (old < newVal);
old = GNUNET_NS_namespace_list_contents (ectx, cfg, &nsid, NULL, NULL);
Modified: GNUnet/src/applications/fs/namespace/namespace_notification.c
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_notification.c
2008-05-18 22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/namespace/namespace_notification.c
2008-05-18 22:59:50 UTC (rev 6839)
@@ -46,8 +46,8 @@
*/
void
GNUNET_NS_internal_notify_ (const char *name,
- const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md, int rating)
+ const GNUNET_HashCode * id,
+ const struct GNUNET_ECRS_MetaData *md, int rating)
{
struct DiscoveryCallback *pos;
Modified: GNUnet/src/applications/fs/namespace/namespace_notification.h
===================================================================
--- GNUnet/src/applications/fs/namespace/namespace_notification.h
2008-05-18 22:59:35 UTC (rev 6838)
+++ GNUnet/src/applications/fs/namespace/namespace_notification.h
2008-05-18 22:59:50 UTC (rev 6839)
@@ -35,7 +35,8 @@
*/
void
GNUNET_NS_internal_notify_ (const char *name,
- const GNUNET_HashCode * id,
- const struct GNUNET_ECRS_MetaData *md, int rating);
+ const GNUNET_HashCode * id,
+ const struct GNUNET_ECRS_MetaData *md,
+ int rating);
#endif
Modified: GNUnet/src/applications/fs/namespace/root_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/root_info.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/namespace/root_info.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -38,16 +38,13 @@
GNUNET_NS_namespace_get_root (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
const GNUNET_HashCode * ns_id,
- GNUNET_HashCode * root)
+ GNUNET_HashCode * root)
{
char *fn;
int ret;
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_ROOTS_DIR,
- ns_id,
- NULL);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg, NS_ROOTS_DIR, ns_id, NULL);
if (sizeof (GNUNET_HashCode)
== GNUNET_disk_file_read (ectx, fn, sizeof (GNUNET_HashCode), root))
ret = GNUNET_OK;
@@ -71,13 +68,10 @@
GNUNET_GE_BREAK (ectx, 0);
return;
}
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_ROOTS_DIR,
- &ns,
- NULL);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg, NS_ROOTS_DIR, &ns, NULL);
if (GNUNET_OK == GNUNET_ECRS_uri_get_content_hash_from_sks (uri, &rt))
- GNUNET_disk_file_write (ectx, fn, &rt, sizeof (GNUNET_HashCode), "644");
+ GNUNET_disk_file_write (ectx, fn, &rt, sizeof (GNUNET_HashCode), "644");
GNUNET_free (fn);
}
Modified: GNUnet/src/applications/fs/namespace/update_info.c
===================================================================
--- GNUnet/src/applications/fs/namespace/update_info.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/namespace/update_info.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -50,13 +50,13 @@
*/
static int
read_update_data (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- const GNUNET_HashCode * lastId,
- GNUNET_HashCode * nextId,
- GNUNET_ECRS_FileInfo * fi,
- GNUNET_Int32Time * updateInterval,
- GNUNET_Int32Time * lastPubTime)
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ const GNUNET_HashCode * lastId,
+ GNUNET_HashCode * nextId,
+ GNUNET_ECRS_FileInfo * fi,
+ GNUNET_Int32Time * updateInterval,
+ GNUNET_Int32Time * lastPubTime)
{
char *fn;
struct UpdateData *buf;
@@ -64,11 +64,9 @@
unsigned long long size;
size_t pos;
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_UPDATE_DIR,
- nsid,
- lastId);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg,
+ NS_UPDATE_DIR, nsid, lastId);
if (GNUNET_OK != GNUNET_disk_file_size (ectx, fn, &size, GNUNET_YES))
{
GNUNET_free (fn);
@@ -140,13 +138,13 @@
*/
static int
write_update_data (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- const GNUNET_HashCode * thisId,
- const GNUNET_HashCode * nextId,
- const GNUNET_ECRS_FileInfo * fi,
- const GNUNET_Int32Time updateInterval,
- const GNUNET_Int32Time lastPubTime)
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid,
+ const GNUNET_HashCode * thisId,
+ const GNUNET_HashCode * nextId,
+ const GNUNET_ECRS_FileInfo * fi,
+ const GNUNET_Int32Time updateInterval,
+ const GNUNET_Int32Time lastPubTime)
{
char *fn;
char *uri;
@@ -174,11 +172,9 @@
1], metaSize,
GNUNET_ECRS_SERIALIZE_FULL));
GNUNET_free (uri);
- fn = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_UPDATE_DIR,
- nsid,
- thisId);
+ fn = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg,
+ NS_UPDATE_DIR, nsid, thisId);
GNUNET_disk_file_write (ectx, fn, buf, size, "400"); /* no editing, just
deletion */
GNUNET_free (fn);
GNUNET_free (buf);
@@ -212,8 +208,8 @@
return GNUNET_SYSERR;
if (GNUNET_OK != read_update_data (ectx,
- cfg, nsid, lastId, NULL, NULL, &ui,
- &lastTime))
+ cfg, nsid, lastId, NULL, NULL, &ui,
+ &lastTime))
return GNUNET_SYSERR;
GNUNET_hash_difference (lastId, thisId, &delta);
now = GNUNET_get_time ();
@@ -266,26 +262,23 @@
GNUNET_ECRS_FileInfo fi;
char *old;
struct GNUNET_ECRS_URI *uri;
- char * name;
+ char *name;
GNUNET_EncName enc;
- if ( (GNUNET_OK !=
- GNUNET_NS_internal_read_namespace_info_(ectx,
- cfg,
- nsid,
- NULL,
- NULL,
- &name)) ||
- (name == NULL) )
+ if ((GNUNET_OK !=
+ GNUNET_NS_internal_read_namespace_info_ (ectx,
+ cfg,
+ nsid,
+ NULL,
+ NULL,
+ &name)) || (name == NULL))
{
- GNUNET_hash_to_enc(nsid, &enc);
+ GNUNET_hash_to_enc (nsid, &enc);
GNUNET_GE_LOG (ectx,
- GNUNET_GE_WARNING | GNUNET_GE_BULK |
- GNUNET_GE_USER,
- _
- ("Could not determine namespace name for `%s'."),
- &enc);
- return NULL;
+ GNUNET_GE_WARNING | GNUNET_GE_BULK |
+ GNUNET_GE_USER,
+ _("Could not determine namespace name for `%s'."), &enc);
+ return NULL;
}
/* computation of IDs of update(s). Not as terrible as
@@ -296,11 +289,11 @@
{
if ((lastId != NULL) &&
(GNUNET_OK == read_update_data (ectx,
- cfg,
- nsid,
- lastId,
- &tid, NULL, &lastInterval,
- &lastTime)))
+ cfg,
+ nsid,
+ lastId,
+ &tid, NULL, &lastInterval,
+ &lastTime)))
{
if (lastInterval != updateInterval)
{
@@ -400,19 +393,17 @@
md);
if ((uri != NULL) && (dst != NULL))
{
- fi.uri = (struct GNUNET_ECRS_URI*) dst;
+ fi.uri = (struct GNUNET_ECRS_URI *) dst;
fi.meta = (struct GNUNET_ECRS_MetaData *) md;
write_update_data (ectx,
- cfg,
- nsid, &tid, &nid, &fi, updateInterval,
- creationTime);
+ cfg,
+ nsid, &tid, &nid, &fi, updateInterval, creationTime);
if (lastId != NULL)
{
- old = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_UPDATE_DIR,
- nsid,
- lastId);
+ old = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg,
+ NS_UPDATE_DIR,
+ nsid, lastId);
UNLINK (old);
GNUNET_free (old);
}
@@ -450,11 +441,10 @@
fi.uri = NULL;
fi.meta = NULL;
if (GNUNET_OK != read_update_data (cls->ectx,
- cls->cfg,
- &cls->nsid,
- &lastId,
- &nextId, &fi, &pubFreq,
- &lastTime))
+ cls->cfg,
+ &cls->nsid,
+ &lastId,
+ &nextId, &fi, &pubFreq, &lastTime))
{
GNUNET_GE_BREAK (cls->ectx, 0);
return GNUNET_OK;
@@ -492,7 +482,7 @@
int
GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode *nsid,
+ const GNUNET_HashCode * nsid,
GNUNET_NS_UpdateIterator iterator,
void *closure)
{
@@ -505,14 +495,13 @@
cls.cnt = 0;
cls.ectx = ectx;
cls.cfg = cfg;
- dirName = GNUNET_NS_internal_get_data_filename_(ectx,
- cfg,
- NS_UPDATE_DIR,
- nsid,
- NULL);
+ dirName = GNUNET_NS_internal_get_data_filename_ (ectx,
+ cfg,
+ NS_UPDATE_DIR, nsid, NULL);
GNUNET_disk_directory_create (ectx, dirName);
if (GNUNET_SYSERR ==
- GNUNET_disk_directory_scan (ectx, dirName,
&list_namespace_contents_helper, &cls))
+ GNUNET_disk_directory_scan (ectx, dirName,
+ &list_namespace_contents_helper, &cls))
{
GNUNET_free (dirName);
return GNUNET_SYSERR;
Modified: GNUnet/src/applications/fs/namespace/uri.c
===================================================================
--- GNUnet/src/applications/fs/namespace/uri.c 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/applications/fs/namespace/uri.c 2008-05-18 22:59:50 UTC (rev
6839)
@@ -38,28 +38,30 @@
* Convert namespace URI to a human readable format
* (using the namespace description, if available).
*/
-char * GNUNET_NS_sks_uri_to_human_readable_string (struct GNUNET_GE_Context
*ectx,
- struct
GNUNET_GC_Configuration *cfg,
- const struct GNUNET_ECRS_URI
*uri)
+char *
+GNUNET_NS_sks_uri_to_human_readable_string (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration
+ *cfg,
+ const struct GNUNET_ECRS_URI *uri)
{
GNUNET_EncName enc;
- char * ret;
+ char *ret;
char *name;
GNUNET_HashCode nsid;
GNUNET_HashCode chk;
- if (! GNUNET_ECRS_uri_test_sks(uri))
+ if (!GNUNET_ECRS_uri_test_sks (uri))
return NULL;
GNUNET_ECRS_uri_get_namespace_from_sks (uri, &nsid);
- name = GNUNET_NS_nsid_to_name(ectx, cfg, &nsid);
+ name = GNUNET_NS_nsid_to_name (ectx, cfg, &nsid);
if (name == NULL)
- return GNUNET_ECRS_uri_to_string(uri);
- GNUNET_ECRS_uri_get_content_hash_from_sks(uri, &chk);
- GNUNET_hash_to_enc(&chk, &enc);
- ret = GNUNET_malloc(strlen(name) + 4 + sizeof(GNUNET_EncName));
- strcpy(ret, name);
- strcat(ret, ": ");
- strcat(ret, (const char*)&enc);
+ return GNUNET_ECRS_uri_to_string (uri);
+ GNUNET_ECRS_uri_get_content_hash_from_sks (uri, &chk);
+ GNUNET_hash_to_enc (&chk, &enc);
+ ret = GNUNET_malloc (strlen (name) + 4 + sizeof (GNUNET_EncName));
+ strcpy (ret, name);
+ strcat (ret, ": ");
+ strcat (ret, (const char *) &enc);
return ret;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -119,12 +119,11 @@
convertId (next_id, &nextId);
convertId (this_id, &thisId);
convertId (prev_id, &prevId);
- if (GNUNET_OK !=
- GNUNET_NS_name_to_nsid(ectx, cfg, pseudonym, &nsid))
+ if (GNUNET_OK != GNUNET_NS_name_to_nsid (ectx, cfg, pseudonym, &nsid))
{
printf (_("\tUnknown namespace `%s'\n"), pseudonym);
return;
- }
+ }
nsuri = GNUNET_NS_add_to_namespace (ectx,
cfg,
anonymity,
Modified: GNUnet/src/applications/fs/tools/gnunet-pseudonym.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/fs/tools/gnunet-pseudonym.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -167,16 +167,16 @@
if (delta != 0)
{
- if (GNUNET_OK ==
- GNUNET_NS_name_to_nsid(ectx, cfg, namespaceName, &nsid))
- {
- rating = GNUNET_NS_namespace_rank (ectx, cfg, &nsid, delta);
- printf (_("\tRating (after update): %d\n"), rating);
- }
- else
- {
- printf (_("\tUnknown namespace `%s'\n"), namespaceName);
- }
+ if (GNUNET_OK ==
+ GNUNET_NS_name_to_nsid (ectx, cfg, namespaceName, &nsid))
+ {
+ rating = GNUNET_NS_namespace_rank (ectx, cfg, &nsid, delta);
+ printf (_("\tRating (after update): %d\n"), rating);
+ }
+ else
+ {
+ printf (_("\tUnknown namespace `%s'\n"), namespaceName);
+ }
}
}
printf ("\n");
@@ -218,24 +218,23 @@
/* delete pseudonyms */
if (delete_name != NULL)
{
- if (GNUNET_OK ==
- GNUNET_NS_name_to_nsid(ectx, cfg, delete_name, &nsid))
- {
- if (GNUNET_OK == GNUNET_NS_namespace_delete (ectx, cfg, &nsid))
- {
- printf (_("Pseudonym `%s' deleted.\n"), delete_name);
- }
- else
- {
- success += 2;
- printf (_("Error deleting pseudonym `%s' (does not exist?).\n"),
- delete_name);
- }
- }
+ if (GNUNET_OK == GNUNET_NS_name_to_nsid (ectx, cfg, delete_name, &nsid))
+ {
+ if (GNUNET_OK == GNUNET_NS_namespace_delete (ectx, cfg, &nsid))
+ {
+ printf (_("Pseudonym `%s' deleted.\n"), delete_name);
+ }
+ else
+ {
+ success += 2;
+ printf (_("Error deleting pseudonym `%s' (does not exist?).\n"),
+ delete_name);
+ }
+ }
else
- {
- printf (_("\tUnknown namespace `%s'\n"), delete_name);
- }
+ {
+ printf (_("\tUnknown namespace `%s'\n"), delete_name);
+ }
GNUNET_free (delete_name);
}
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -184,10 +184,10 @@
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
value = initValue (i);
if (1 != api->get (&key, NULL, 0, &iterateDelete, NULL))
- {
- GNUNET_free (value);
- ASSERT(0);
- }
+ {
+ GNUNET_free (value);
+ ASSERT (0);
+ }
GNUNET_free (value);
}
ASSERT (oldSize > api->getSize ());
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2008-05-18 22:59:35 UTC
(rev 6838)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2008-05-18 22:59:50 UTC
(rev 6839)
@@ -191,10 +191,10 @@
memset (&key, 256 - i, sizeof (GNUNET_HashCode));
value = initValue (i);
if (1 != api->get (&key, NULL, 0, &iterateDelete, NULL))
- {
- GNUNET_free (value);
- ASSERT(0);
- }
+ {
+ GNUNET_free (value);
+ ASSERT (0);
+ }
GNUNET_free (value);
}
ASSERT (oldSize > api->getSize ());
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2008-05-18 22:59:50 UTC (rev
6839)
@@ -281,7 +281,8 @@
* Convert keyword URI to a human readable format
* (i.e. the search query that was used in the first place)
*/
-char *GNUNET_ECRS_ksk_uri_to_human_readable_string (const struct
GNUNET_ECRS_URI *uri);
+char *GNUNET_ECRS_ksk_uri_to_human_readable_string (const struct
+ GNUNET_ECRS_URI *uri);
/**
* Convert a UTF-8 String to a URI.
Modified: GNUnet/src/include/gnunet_namespace_lib.h
===================================================================
--- GNUnet/src/include/gnunet_namespace_lib.h 2008-05-18 22:59:35 UTC (rev
6838)
+++ GNUnet/src/include/gnunet_namespace_lib.h 2008-05-18 22:59:50 UTC (rev
6839)
@@ -45,7 +45,8 @@
*/
typedef int (*GNUNET_NS_NamespaceIterator) (void *cls,
const char *namespaceName,
- const GNUNET_HashCode *
namespaceId,
+ const GNUNET_HashCode *
+ namespaceId,
const struct GNUNET_ECRS_MetaData
* md, int rating);
@@ -77,16 +78,7 @@
* @param meta meta-data about the namespace (maybe NULL)
* @return URI on success, NULL on error (namespace already exists)
*/
-struct GNUNET_ECRS_URI *
-GNUNET_NS_namespace_create (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- unsigned int anonymityLevel,
- unsigned int insertPriority,
- GNUNET_CronTime insertExpiration,
- const char *namespaceName,
- const struct GNUNET_ECRS_MetaData *meta,
- const struct GNUNET_ECRS_URI *advertisementURI,
- const GNUNET_HashCode * rootEntry); /*
namespace_info.c */
+struct GNUNET_ECRS_URI *GNUNET_NS_namespace_create (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel,
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const char
*namespaceName, const struct GNUNET_ECRS_MetaData *meta, const struct
GNUNET_ECRS_URI *advertisementURI, const GNUNET_HashCode * rootEntry); /*
namespace_info.c */
/**
* Delete a local namespace. Only prevents future insertions into the
@@ -94,9 +86,7 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode *nsid); /*
namespace.c */
+int GNUNET_NS_namespace_delete (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid); /* namespace.c
*/
/**
* Change the ranking of a (non-local) namespace.
@@ -106,9 +96,7 @@
* changed?
* @return new rating of the namespace
*/
-int GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid, int delta); /*
namespace_info.c */
+int GNUNET_NS_namespace_rank (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid, int delta); /*
namespace_info.c */
/**
* Add a namespace to the set of known namespaces. For all namespace
@@ -130,8 +118,8 @@
*/
int GNUNET_NS_namespace_get_root (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode *nsid,
- GNUNET_HashCode * root);
+ const GNUNET_HashCode * nsid,
+ GNUNET_HashCode * root);
void GNUNET_NS_namespace_set_root (struct GNUNET_GE_Context *ectx,
struct GNUNET_GC_Configuration *cfg,
@@ -140,10 +128,7 @@
/**
* List all available (local or non-local) namespaces.
*/
-int GNUNET_NS_namespace_list_all (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- GNUNET_NS_NamespaceIterator iterator,
- void *closure); /* namespace_info.c */
+int GNUNET_NS_namespace_list_all (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, GNUNET_NS_NamespaceIterator iterator, void
*closure); /* namespace_info.c */
/**
* Register callback to be invoked whenever we discover
@@ -202,19 +187,7 @@
* entry?
* @return the resulting URI, NULL on error
*/
-struct GNUNET_ECRS_URI *
-GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- unsigned int anonymityLevel,
- unsigned int insertPriority,
- GNUNET_CronTime insertExpiration,
- const GNUNET_HashCode *nsid,
- GNUNET_Int32Time updateInterval,
- const GNUNET_HashCode * lastId,
- const GNUNET_HashCode * thisId,
- const GNUNET_HashCode * nextId,
- const struct GNUNET_ECRS_URI *dst,
- const struct GNUNET_ECRS_MetaData *md); /*
update_info.c */
+struct GNUNET_ECRS_URI *GNUNET_NS_add_to_namespace (struct GNUNET_GE_Context
*ectx, struct GNUNET_GC_Configuration *cfg, unsigned int anonymityLevel,
unsigned int insertPriority, GNUNET_CronTime insertExpiration, const
GNUNET_HashCode * nsid, GNUNET_Int32Time updateInterval, const GNUNET_HashCode
* lastId, const GNUNET_HashCode * thisId, const GNUNET_HashCode * nextId, const
struct GNUNET_ECRS_URI *dst, const struct GNUNET_ECRS_MetaData *md); /*
update_info.c */
/**
* Compute the next ID for peridodically updated content.
@@ -233,11 +206,7 @@
/**
* List all updateable content in a given namespace.
*/
-int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid,
- GNUNET_NS_UpdateIterator iterator,
- void *closure); /*
namespace_info.c */
+int GNUNET_NS_namespace_list_contents (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg, const GNUNET_HashCode * nsid,
GNUNET_NS_UpdateIterator iterator, void *closure); /* namespace_info.c */
/**
@@ -245,27 +214,30 @@
*
* @return NULL on failure (should never happen)
*/
-char * GNUNET_NS_nsid_to_name(struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const GNUNET_HashCode * nsid);
+char *GNUNET_NS_nsid_to_name (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const GNUNET_HashCode * nsid);
/**
* Get the namespace ID belonging to the given namespace name.
*
* @return GNUNET_OK on success
*/
-int GNUNET_NS_name_to_nsid(struct GNUNET_GE_Context *ectx,
- struct GNUNET_GC_Configuration *cfg,
- const char * ns_uname,
- GNUNET_HashCode * nsid);
+int GNUNET_NS_name_to_nsid (struct GNUNET_GE_Context *ectx,
+ struct GNUNET_GC_Configuration *cfg,
+ const char *ns_uname, GNUNET_HashCode * nsid);
/**
* Convert namespace URI to a human readable format
* (using the namespace description, if available).
*/
-char * GNUNET_NS_sks_uri_to_human_readable_string (struct GNUNET_GE_Context
*ectx,
- struct
GNUNET_GC_Configuration *cfg,
- const struct GNUNET_ECRS_URI
*uri);
+char *GNUNET_NS_sks_uri_to_human_readable_string (struct GNUNET_GE_Context
+ *ectx,
+ struct
+ GNUNET_GC_Configuration
+ *cfg,
+ const struct GNUNET_ECRS_URI
+ *uri);
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2008-05-18 22:59:35 UTC (rev 6838)
+++ GNUnet/src/server/tcpserver.c 2008-05-18 22:59:50 UTC (rev 6839)
@@ -655,7 +655,8 @@
msgLen = 60000;
rv = GNUNET_malloc (sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
memset (rv, 0, sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
- rv->header.size = htons (sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
+ rv->header.size =
+ htons (sizeof (GNUNET_MessageReturnErrorMessage) + msgLen);
rv->header.type = htons (GNUNET_CS_PROTO_RETURN_ERROR);
rv->kind = htonl (kind);
memcpy (&rv[1], message, strlen (message));
Modified: GNUnet/src/util/disk/storagetest.c
===================================================================
--- GNUnet/src/util/disk/storagetest.c 2008-05-18 22:59:35 UTC (rev 6838)
+++ GNUnet/src/util/disk/storagetest.c 2008-05-18 22:59:50 UTC (rev 6839)
@@ -32,17 +32,16 @@
static int
testReadWrite ()
{
- char tmp[100+1];
+ char tmp[100 + 1];
int ret;
GNUNET_disk_file_write (NULL, ".testfile", TESTSTRING, strlen (TESTSTRING),
"644");
ret = GNUNET_disk_file_read (NULL, ".testfile", 100, tmp);
if (ret < 0)
- {
+ {
fprintf (stderr,
- "Error reading file `%s' in testReadWrite\n",
- ".testfile");
+ "Error reading file `%s' in testReadWrite\n", ".testfile");
return 1;
}
tmp[ret] = '\0';
Modified: GNUnet/src/util/os/semaphoretest.c
===================================================================
--- GNUnet/src/util/os/semaphoretest.c 2008-05-18 22:59:35 UTC (rev 6838)
+++ GNUnet/src/util/os/semaphoretest.c 2008-05-18 22:59:50 UTC (rev 6839)
@@ -108,8 +108,8 @@
printf ("Could not write to testfile: %s\n",
STRERROR (errno));
ret = 1;
- fclose (fd);
- goto END;
+ fclose (fd);
+ goto END;
}
fclose (fd);
GNUNET_IPC_semaphore_up (ipc);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6839 - in GNUnet/src: applications/chat applications/datastore applications/fs/ecrs applications/fs/fsui applications/fs/gap applications/fs/namespace applications/fs/tools applications/sqstore_mysql applications/sqstore_sqlite include server util/disk util/os,
gnunet <=