Author: grothoff Date: 2008-03-02 01:21:56 -0700 (Sun, 02 Mar 2008) New Revision: 6510
Modified: GNUnet/src/applications/chat/chat.c GNUnet/src/applications/chat/chat.h GNUnet/src/applications/chat/chat_p2p.c GNUnet/src/applications/chat/chat_p2p.h GNUnet/src/applications/chat/clientapi.c GNUnet/src/applications/chat/gnunet-chat.c GNUnet/src/applications/dstore_mysql/dstore_mysql.c GNUnet/src/applications/dstore_mysql/dstore_quota_test.c GNUnet/src/applications/dstore_sqlite/dstore.c GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c GNUnet/src/applications/fs/gap/fs.c GNUnet/src/applications/fs/gap/gap.c GNUnet/src/applications/fs/gap/gap.h GNUnet/src/applications/fs/gap/plan.c GNUnet/src/include/gnunet_util_network.h GNUnet/src/server/connection.c GNUnet/src/transports/common.c GNUnet/src/transports/http.c GNUnet/src/transports/tcp.c GNUnet/src/transports/udp.c GNUnet/src/util/network/dns.c GNUnet/src/util/network/ip.c Log: format Modified: GNUnet/src/applications/chat/chat.c =================================================================== --- GNUnet/src/applications/chat/chat.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/chat/chat.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -171,10 +171,16 @@ header_size = ntohs (cmsg->header.size); nick_len = ntohs (cmsg->nick_len); pubkey_len = ntohs (cmsg->pubkey_len); - room_name_len = header_size - sizeof (CS_chat_JOIN_MESSAGE) - nick_len - pubkey_len; - - fprintf(stderr,"JOIN_MESSAGE size : %d\nheader_size : %d\nnick_len : %d\npubkey_len : %d\nroom_name_len : %d\n",sizeof (CS_chat_JOIN_MESSAGE),header_size,nick_len,pubkey_len,room_name_len); - fprintf(stderr,"According to my addition, header_size should be %d\n",nick_len+pubkey_len+room_name_len+sizeof (CS_chat_JOIN_MESSAGE)); + room_name_len = + header_size - sizeof (CS_chat_JOIN_MESSAGE) - nick_len - pubkey_len; + + fprintf (stderr, + "JOIN_MESSAGE size : %d\nheader_size : %d\nnick_len : %d\npubkey_len : %d\nroom_name_len : %d\n", + sizeof (CS_chat_JOIN_MESSAGE), header_size, nick_len, pubkey_len, + room_name_len); + fprintf (stderr, "According to my addition, header_size should be %d\n", + nick_len + pubkey_len + room_name_len + + sizeof (CS_chat_JOIN_MESSAGE)); if (header_size < (nick_len + pubkey_len + room_name_len)) { GNUNET_GE_BREAK (NULL, 0); Modified: GNUnet/src/applications/chat/chat.h =================================================================== --- GNUnet/src/applications/chat/chat.h 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/chat/chat.h 2008-03-02 08:21:56 UTC (rev 6510) @@ -34,7 +34,7 @@ GNUNET_MessageHeader header; int nick_len; int msg_len; - /*int room_name_len;*/ + /*int room_name_len; */ char nick[1]; } CS_chat_MESSAGE; @@ -44,7 +44,7 @@ GNUNET_MessageHeader header; int nick_len; int pubkey_len; - /*int room_name_len;*/ + /*int room_name_len; */ char nick[1]; } CS_chat_JOIN_MESSAGE; Modified: GNUnet/src/applications/chat/chat_p2p.c =================================================================== --- GNUnet/src/applications/chat/chat_p2p.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/chat/chat_p2p.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -26,32 +26,32 @@ int p2pHandleChatJoinRequest (struct GNUNET_ClientHandle *client, - const GNUNET_MessageHeader * message) + const GNUNET_MessageHeader * message) { - return GNUNET_SYSERR; + return GNUNET_SYSERR; } int p2pHandleChatMSG (struct GNUNET_ClientHandle *client, - const GNUNET_MessageHeader * message) + const GNUNET_MessageHeader * message) { - return GNUNET_SYSERR; + return GNUNET_SYSERR; } int -p2pSendChatMSG (const GNUNET_MessageHeader *message) +p2pSendChatMSG (const GNUNET_MessageHeader * message) { - return GNUNET_SYSERR; + return GNUNET_SYSERR; } int -p2pGetRoomList() -{ - return GNUNET_SYSERR; +p2pGetRoomList () +{ + return GNUNET_SYSERR; } int -p2pSendRoomList() +p2pSendRoomList () { - return GNUNET_SYSERR; + return GNUNET_SYSERR; } Modified: GNUnet/src/applications/chat/chat_p2p.h =================================================================== --- GNUnet/src/applications/chat/chat_p2p.h 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/chat/chat_p2p.h 2008-03-02 08:21:56 UTC (rev 6510) @@ -41,20 +41,17 @@ int p2pHandleChatJoinRequest (struct GNUNET_ClientHandle *client, - const GNUNET_MessageHeader * message); + const GNUNET_MessageHeader * message); int p2pHandleChatMSG (struct GNUNET_ClientHandle *client, - const GNUNET_MessageHeader * message); + const GNUNET_MessageHeader * message); -int -p2pSendChatMSG (const GNUNET_MessageHeader *message); +int p2pSendChatMSG (const GNUNET_MessageHeader * message); -int -p2pGetRoomList(void); +int p2pGetRoomList (void); -int -p2pSendRoomList(void); +int p2pSendRoomList (void); #endif Modified: GNUnet/src/applications/chat/clientapi.c =================================================================== --- GNUnet/src/applications/chat/clientapi.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/chat/clientapi.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -98,12 +98,12 @@ nick_len = ntohs (received_msg->nick_len); msg_len = ntohs (received_msg->msg_len); /* NO NEED TO SEND ROOM! */ - room_name_len = size - nick_len - msg_len - sizeof(CS_chat_MESSAGE); + room_name_len = size - nick_len - msg_len - sizeof (CS_chat_MESSAGE); if (size < (nick_len + msg_len + room_name_len)) { GNUNET_GE_BREAK (NULL, 0); - return NULL; /* invalid message */ + return NULL; /* invalid message */ } nick = GNUNET_malloc (nick_len + 1); Modified: GNUnet/src/applications/chat/gnunet-chat.c =================================================================== --- GNUnet/src/applications/chat/gnunet-chat.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/chat/gnunet-chat.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -130,7 +130,7 @@ struct GNUNET_CHAT_Room *room; struct GNUNET_RSA_PrivateKey *my_priv; GNUNET_RSA_PublicKey my_pub; - char message[MAX_MESSAGE_LENGTH+1]; + char message[MAX_MESSAGE_LENGTH + 1]; /* GNUNET_disable_entropy_gathering (); */ @@ -143,7 +143,7 @@ if (nickname == NULL) { fprintf (stderr, _("You must specify a nickname\n")); - GNUNET_fini(ectx, cfg); + GNUNET_fini (ectx, cfg); return -1; } @@ -152,43 +152,43 @@ my_priv = GNUNET_RSA_create_key (); GNUNET_RSA_get_public_key (my_priv, &my_pub); room = GNUNET_CHAT_join_room (ectx, - cfg, - nickname, room_name, - &my_pub, my_priv, "", &receive_callback, - NULL); + cfg, + nickname, room_name, + &my_pub, my_priv, "", &receive_callback, + NULL); if (room == NULL) { fprintf (stderr, _("Failed to join room `%s'\n"), room_name); - GNUNET_RSA_free_key(my_priv); - GNUNET_fini(ectx, cfg); + GNUNET_RSA_free_key (my_priv); + GNUNET_fini (ectx, cfg); return -1; } fprintf (stdout, - _("Joined room `%s'.\nType message and hit return to send.\nType `%s' when ready to quit.\n"), - room_name, - QUIT_COMMAND); + _ + ("Joined room `%s'.\nType message and hit return to send.\nType `%s' when ready to quit.\n"), + room_name, QUIT_COMMAND); /* read messages from command line and send */ - while ( (0 != strcmp (message, QUIT_COMMAND)) && - (GNUNET_shutdown_test() == GNUNET_NO) ) - { + while ((0 != strcmp (message, QUIT_COMMAND)) && + (GNUNET_shutdown_test () == GNUNET_NO)) + { memset (message, 0, MAX_MESSAGE_LENGTH + 1); if (NULL == fgets (message, MAX_MESSAGE_LENGTH, stdin)) break; if (0 == strcmp (message, QUIT_COMMAND)) break; if (message[strlen (message) - 1] == '\n') - message[strlen (message) - 1] = '\0'; + message[strlen (message) - 1] = '\0'; if (GNUNET_OK != GNUNET_CHAT_send_message (room, message, &confirmation_callback, NULL, GNUNET_CHAT_MSG_OPTION_NONE, - NULL)) - fprintf (stderr, _("Failed to send message.\n")); + NULL)) + fprintf (stderr, _("Failed to send message.\n")); } - GNUNET_CHAT_leave_room (room); - GNUNET_RSA_free_key(my_priv); + GNUNET_CHAT_leave_room (room); + GNUNET_RSA_free_key (my_priv); GNUNET_fini (ectx, cfg); return 0; } Modified: GNUnet/src/applications/dstore_mysql/dstore_mysql.c =================================================================== --- GNUnet/src/applications/dstore_mysql/dstore_mysql.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/dstore_mysql/dstore_mysql.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -344,7 +344,7 @@ GNUNET_mutex_unlock (lock); return GNUNET_SYSERR; } - GNUNET_GE_BREAK(NULL, h_length == sizeof (GNUNET_HashCode)); + GNUNET_GE_BREAK (NULL, h_length == sizeof (GNUNET_HashCode)); if (mysql_stmt_execute (delete_value)) { @@ -390,7 +390,7 @@ if (size > MAX_CONTENT_SIZE) return GNUNET_SYSERR; - GNUNET_hash(data, size, &vhash); + GNUNET_hash (data, size, &vhash); GNUNET_mutex_lock (lock); mysql_thread_init (); iopen (); @@ -471,7 +471,7 @@ rbind[6].buffer_type = MYSQL_TYPE_BLOB; rbind[6].buffer_length = size; rbind[6].length = &v_length; - rbind[6].buffer = (void*) data; + rbind[6].buffer = (void *) data; if (mysql_stmt_bind_param (insert_value, rbind)) { @@ -593,8 +593,8 @@ mysql_thread_end (); return GNUNET_SYSERR; } - + if (mysql_stmt_bind_result (count_value, rbind)) { GNUNET_GE_LOG (coreAPI->ectx, @@ -650,29 +650,29 @@ { off = (off + 1) % total; if (mysql_stmt_bind_param (select_value, qbind)) - { - GNUNET_GE_LOG (coreAPI->ectx, - GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("`%s' failed at %s:%d with error: %s\n"), - "mysql_stmt_bind_param", - __FILE__, __LINE__, mysql_stmt_error (select_value)); - iclose (); - mysql_thread_end (); - GNUNET_mutex_unlock (lock); - return GNUNET_SYSERR; - } + { + GNUNET_GE_LOG (coreAPI->ectx, + GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, + _("`%s' failed at %s:%d with error: %s\n"), + "mysql_stmt_bind_param", + __FILE__, __LINE__, mysql_stmt_error (select_value)); + iclose (); + mysql_thread_end (); + GNUNET_mutex_unlock (lock); + return GNUNET_SYSERR; + } if (mysql_stmt_execute (select_value)) - { - GNUNET_GE_LOG (coreAPI->ectx, - GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("`%s' failed at %s:%d with error: %s\n"), - "mysql_stmt_execute", - __FILE__, __LINE__, mysql_stmt_error (select_value)); - iclose (); - GNUNET_mutex_unlock (lock); - mysql_thread_end (); - return GNUNET_SYSERR; - } + { + GNUNET_GE_LOG (coreAPI->ectx, + GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, + _("`%s' failed at %s:%d with error: %s\n"), + "mysql_stmt_execute", + __FILE__, __LINE__, mysql_stmt_error (select_value)); + iclose (); + GNUNET_mutex_unlock (lock); + mysql_thread_end (); + return GNUNET_SYSERR; + } memset (rbind, 0, sizeof (rbind)); rbind[0].buffer_type = MYSQL_TYPE_LONG; rbind[0].is_unsigned = 1; @@ -682,23 +682,23 @@ rbind[1].length = &v_length; rbind[1].buffer = GNUNET_malloc (GNUNET_MAX_BUFFER_SIZE); if (mysql_stmt_bind_result (select_value, rbind)) - { - GNUNET_GE_LOG (coreAPI->ectx, - GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("`%s' failed at %s:%d with error: %s\n"), - "mysql_stmt_bind_result", - __FILE__, __LINE__, mysql_stmt_error (select_value)); - iclose (); - mysql_thread_end (); - GNUNET_mutex_unlock (lock); - GNUNET_free (rbind[1].buffer); - return GNUNET_SYSERR; - } + { + GNUNET_GE_LOG (coreAPI->ectx, + GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, + _("`%s' failed at %s:%d with error: %s\n"), + "mysql_stmt_bind_result", + __FILE__, __LINE__, mysql_stmt_error (select_value)); + iclose (); + mysql_thread_end (); + GNUNET_mutex_unlock (lock); + GNUNET_free (rbind[1].buffer); + return GNUNET_SYSERR; + } if (0 != mysql_stmt_fetch (select_value)) - { - GNUNET_GE_BREAK(NULL, 0); - break; - } + { + GNUNET_GE_BREAK (NULL, 0); + break; + } if (v_length != v_size) { GNUNET_GE_BREAK (NULL, 0); @@ -710,7 +710,7 @@ } cnt++; if (GNUNET_OK != handler (key, type, v_size, rbind[1].buffer, closure)) - break; + break; } mysql_stmt_reset (select_value); mysql_thread_end (); @@ -797,9 +797,9 @@ if (stats != NULL) { stat_dstore_size = stats->create (gettext_noop ("# bytes in dstore")); - stat_dstore_quota = stats->create (gettext_noop ("# max bytes allowed in dstore")); - stats->set(stat_dstore_quota, - quota); + stat_dstore_quota = + stats->create (gettext_noop ("# max bytes allowed in dstore")); + stats->set (stat_dstore_quota, quota); } return &api; } Modified: GNUnet/src/applications/dstore_mysql/dstore_quota_test.c =================================================================== --- GNUnet/src/applications/dstore_mysql/dstore_quota_test.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/dstore_mysql/dstore_quota_test.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -46,37 +46,36 @@ unsigned int j; char buf[3200]; - memset(buf, 1, sizeof(buf)); + memset (buf, 1, sizeof (buf)); memset (&k, 0, sizeof (GNUNET_HashCode)); for (i = 0; i < 10; i++) { - fprintf(stderr, "."); + fprintf (stderr, "."); GNUNET_hash (&k, sizeof (GNUNET_HashCode), &n); - for (j=i;j<sizeof(buf);j+=10) - { - buf[j] = i; - ASSERT (GNUNET_OK == api->put (&k, - i, - GNUNET_get_time() + 30 * GNUNET_CRON_MINUTES, - j, - buf)); - ASSERT (0 != api->get (&k, i, NULL, NULL)); - } + for (j = i; j < sizeof (buf); j += 10) + { + buf[j] = i; + ASSERT (GNUNET_OK == api->put (&k, + i, + GNUNET_get_time () + + 30 * GNUNET_CRON_MINUTES, j, buf)); + ASSERT (0 != api->get (&k, i, NULL, NULL)); + } k = n; } - fprintf(stderr, "\n"); + fprintf (stderr, "\n"); memset (&k, 0, sizeof (GNUNET_HashCode)); for (i = 0; i < 10; i++) { - fprintf(stderr, "."); + fprintf (stderr, "."); GNUNET_hash (&k, sizeof (GNUNET_HashCode), &n); if (i < 5) - ASSERT (0 == api->get (&k, i, NULL, NULL)); + ASSERT (0 == api->get (&k, i, NULL, NULL)); if (i == 9) - ASSERT (0 != api->get (&k, i, NULL, NULL)); + ASSERT (0 != api->get (&k, i, NULL, NULL)); k = n; } - fprintf(stderr, "\n"); + fprintf (stderr, "\n"); return GNUNET_OK; FAILURE: return GNUNET_SYSERR; Modified: GNUnet/src/applications/dstore_sqlite/dstore.c =================================================================== --- GNUnet/src/applications/dstore_sqlite/dstore.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/dstore_sqlite/dstore.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -118,7 +118,8 @@ " vhash BLOB NOT NULL DEFAULT ''," " value BLOB NOT NULL DEFAULT '')"); SQLITE3_EXEC (dbh, "CREATE INDEX idx_hashidx ON ds080 (key,type,expire)"); - SQLITE3_EXEC (dbh, "CREATE INDEX idx_allidx ON ds080 (key,vhash,type,size)"); + SQLITE3_EXEC (dbh, + "CREATE INDEX idx_allidx ON ds080 (key,vhash,type,size)"); SQLITE3_EXEC (dbh, "CREATE INDEX idx_puttime ON ds080 (puttime)"); } @@ -216,7 +217,8 @@ sqlite3_column_bytes (stmt, 3) == sizeof (GNUNET_HashCode)); memcpy (&dkey, sqlite3_column_blob (stmt, 2), sizeof (GNUNET_HashCode)); - memcpy (&vhash, sqlite3_column_blob (stmt, 3), sizeof (GNUNET_HashCode)); + memcpy (&vhash, sqlite3_column_blob (stmt, 3), + sizeof (GNUNET_HashCode)); sqlite3_reset (stmt); sqlite3_bind_blob (dstmt, 1, &dkey, sizeof (GNUNET_HashCode), @@ -237,12 +239,12 @@ GNUNET_GE_BREAK (NULL, 0); /* should delete but cannot!? */ break; } - if (sqlite3_total_changes(dbh) > 0) - { - if (bloom != NULL) - GNUNET_bloomfilter_remove (bloom, &dkey); - payload -= (dsize + OVERHEAD); - } + if (sqlite3_total_changes (dbh) > 0) + { + if (bloom != NULL) + GNUNET_bloomfilter_remove (bloom, &dkey); + payload -= (dsize + OVERHEAD); + } #if DEBUG_DSTORE GNUNET_GE_LOG (coreAPI->ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | @@ -291,7 +293,7 @@ if (size > MAX_CONTENT_SIZE) return GNUNET_SYSERR; - GNUNET_hash(data, size, &vhash); + GNUNET_hash (data, size, &vhash); GNUNET_mutex_lock (lock); if ((fn == NULL) || (SQLITE_OK != sqlite3_open (fn, &dbh))) { @@ -391,17 +393,17 @@ sqlite3_bind_blob (stmt, 7, data, size, SQLITE_TRANSIENT))) { if (SQLITE_DONE != sqlite3_step (stmt)) - { - LOG_SQLITE (dbh, - GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN | - GNUNET_GE_BULK, "sqlite3_step"); - } + { + LOG_SQLITE (dbh, + GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN + | GNUNET_GE_BULK, "sqlite3_step"); + } else - { - payload += size + OVERHEAD; - if (bloom != NULL) - GNUNET_bloomfilter_add (bloom, key); - } + { + payload += size + OVERHEAD; + if (bloom != NULL) + GNUNET_bloomfilter_add (bloom, key); + } if (SQLITE_OK != sqlite3_finalize (stmt)) LOG_SQLITE (dbh, GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN | @@ -486,7 +488,7 @@ SQLITE_TRANSIENT); sqlite3_bind_int (stmt, 2, type); sqlite3_bind_int (stmt, 3, now); - if (SQLITE_ROW != sqlite3_step(stmt)) + if (SQLITE_ROW != sqlite3_step (stmt)) { LOG_SQLITE (dbh, GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER | @@ -500,8 +502,7 @@ total = sqlite3_column_int (stmt, 0); sqlite3_reset (stmt); sqlite3_finalize (stmt); - if ( (total == 0) || - (handler == NULL) ) + if ((total == 0) || (handler == NULL)) { sqlite3_close (dbh); GNUNET_mutex_unlock (lock); @@ -510,46 +511,46 @@ cnt = 0; off = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, total); - while (cnt < total) { - off = (off + 1) % total; - GNUNET_snprintf(scratch, 256, - "SELECT size, value FROM ds080 WHERE key=? AND type=? AND expire >= ? LIMIT 1 OFFSET %u", - off); - if (sq_prepare (dbh, - scratch, - &stmt) != SQLITE_OK) - { - GNUNET_GE_LOG (coreAPI->ectx, - GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK, - _("`%s' failed at %s:%d with error: %s\n"), - "sq_prepare", __FILE__, __LINE__, sqlite3_errmsg (dbh)); - sqlite3_close (dbh); - GNUNET_mutex_unlock (lock); - return GNUNET_SYSERR; - } - sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), - SQLITE_TRANSIENT); - sqlite3_bind_int (stmt, 2, type); - sqlite3_bind_int (stmt, 3, now); - if (sqlite3_step (stmt) != SQLITE_ROW) - break; - size = sqlite3_column_int (stmt, 0); - if (size != sqlite3_column_bytes (stmt, 1)) - { - GNUNET_GE_BREAK (NULL, 0); - sqlite3_finalize (stmt); - continue; - } - dat = sqlite3_column_blob (stmt, 1); - cnt++; - if ( (handler != NULL) && - (GNUNET_OK != handler (key, type, size, dat, closure)) ) - { - sqlite3_finalize (stmt); - break; - } - sqlite3_finalize (stmt); - } + while (cnt < total) + { + off = (off + 1) % total; + GNUNET_snprintf (scratch, 256, + "SELECT size, value FROM ds080 WHERE key=? AND type=? AND expire >= ? LIMIT 1 OFFSET %u", + off); + if (sq_prepare (dbh, scratch, &stmt) != SQLITE_OK) + { + GNUNET_GE_LOG (coreAPI->ectx, + GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK, + _("`%s' failed at %s:%d with error: %s\n"), + "sq_prepare", __FILE__, __LINE__, + sqlite3_errmsg (dbh)); + sqlite3_close (dbh); + GNUNET_mutex_unlock (lock); + return GNUNET_SYSERR; + } + sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), + SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 2, type); + sqlite3_bind_int (stmt, 3, now); + if (sqlite3_step (stmt) != SQLITE_ROW) + break; + size = sqlite3_column_int (stmt, 0); + if (size != sqlite3_column_bytes (stmt, 1)) + { + GNUNET_GE_BREAK (NULL, 0); + sqlite3_finalize (stmt); + continue; + } + dat = sqlite3_column_blob (stmt, 1); + cnt++; + if ((handler != NULL) && + (GNUNET_OK != handler (key, type, size, dat, closure))) + { + sqlite3_finalize (stmt); + break; + } + sqlite3_finalize (stmt); + } sqlite3_close (dbh); GNUNET_mutex_unlock (lock); return cnt; @@ -596,10 +597,10 @@ if (stats != NULL) { stat_dstore_size = stats->create (gettext_noop ("# bytes in dstore")); - stat_dstore_quota = stats->create (gettext_noop ("# max bytes allowed in dstore")); - stats->set(stat_dstore_quota, - quota); - } + stat_dstore_quota = + stats->create (gettext_noop ("# max bytes allowed in dstore")); + stats->set (stat_dstore_quota, quota); + } return &api; } Modified: GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c =================================================================== --- GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -46,37 +46,36 @@ unsigned int j; char buf[3200]; - memset(buf, 1, sizeof(buf)); + memset (buf, 1, sizeof (buf)); memset (&k, 0, sizeof (GNUNET_HashCode)); for (i = 0; i < 10; i++) { - fprintf(stderr, "."); + fprintf (stderr, "."); GNUNET_hash (&k, sizeof (GNUNET_HashCode), &n); - for (j=i;j<sizeof(buf);j+=10) - { - buf[j] = i; - ASSERT (GNUNET_OK == api->put (&k, - i, - GNUNET_get_time() + 30 * GNUNET_CRON_MINUTES, - j, - buf)); - ASSERT (0 != api->get (&k, i, NULL, NULL)); - } + for (j = i; j < sizeof (buf); j += 10) + { + buf[j] = i; + ASSERT (GNUNET_OK == api->put (&k, + i, + GNUNET_get_time () + + 30 * GNUNET_CRON_MINUTES, j, buf)); + ASSERT (0 != api->get (&k, i, NULL, NULL)); + } k = n; } - fprintf(stderr, "\n"); + fprintf (stderr, "\n"); memset (&k, 0, sizeof (GNUNET_HashCode)); for (i = 0; i < 10; i++) { - fprintf(stderr, "."); + fprintf (stderr, "."); GNUNET_hash (&k, sizeof (GNUNET_HashCode), &n); if (i < 2) - ASSERT (0 == api->get (&k, i, NULL, NULL)); + ASSERT (0 == api->get (&k, i, NULL, NULL)); if (i == 9) - ASSERT (0 != api->get (&k, i, NULL, NULL)); + ASSERT (0 != api->get (&k, i, NULL, NULL)); k = n; } - fprintf(stderr, "\n"); + fprintf (stderr, "\n"); return GNUNET_OK; FAILURE: return GNUNET_SYSERR; Modified: GNUnet/src/applications/fs/gap/fs.c =================================================================== --- GNUnet/src/applications/fs/gap/fs.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/fs/gap/fs.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -662,7 +662,7 @@ coreAPI->preferTrafficFrom (sender, preference); GNUNET_FS_GAP_execute_query (sender, prio, - ntohl (req->priority), + ntohl (req->priority), policy, ttl, type, Modified: GNUnet/src/applications/fs/gap/gap.c =================================================================== --- GNUnet/src/applications/fs/gap/gap.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/fs/gap/gap.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -202,8 +202,7 @@ } if (stats != NULL) { - stats->change(stat_trust_earned, - req->value_offered); + stats->change (stat_trust_earned, req->value_offered); req->value_offered = 0; } req->remaining_value = 0; @@ -237,7 +236,7 @@ void GNUNET_FS_GAP_execute_query (const GNUNET_PeerIdentity * respond_to, unsigned int priority, - unsigned int original_priority, + unsigned int original_priority, enum GNUNET_FS_RoutingPolicy policy, int ttl, unsigned int type, @@ -479,12 +478,11 @@ BASE_REPLY_PRIORITY * (1 + rl->value), MAX_GAP_DELAY); GNUNET_free (msg); - if (stats != NULL) - { - stats->change(stat_trust_earned, - rl->value_offered); - rl->value_offered = 0; - } + if (stats != NULL) + { + stats->change (stat_trust_earned, rl->value_offered); + rl->value_offered = 0; + } if (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA) GNUNET_FS_SHARED_mark_response_seen (rl, &hc); GNUNET_FS_PLAN_success (rid, NULL, rl->response_target, rl); @@ -675,9 +673,7 @@ stat_gap_query_refreshed = stats-> create (gettext_noop ("# gap queries refreshed existing record")); - stat_trust_earned = - stats-> - create (gettext_noop ("# trust earned")); + stat_trust_earned = stats->create (gettext_noop ("# trust earned")); } cron = GNUNET_cron_create (coreAPI->ectx); GNUNET_cron_start (cron); Modified: GNUnet/src/applications/fs/gap/gap.h =================================================================== --- GNUnet/src/applications/fs/gap/gap.h 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/fs/gap/gap.h 2008-03-02 08:21:56 UTC (rev 6510) @@ -59,7 +59,7 @@ void GNUNET_FS_GAP_execute_query (const GNUNET_PeerIdentity * respond_to, unsigned int priority, - unsigned int original_priority, + unsigned int original_priority, enum GNUNET_FS_RoutingPolicy policy, int ttl, unsigned int type, Modified: GNUnet/src/applications/fs/gap/plan.c =================================================================== --- GNUnet/src/applications/fs/gap/plan.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/applications/fs/gap/plan.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -970,8 +970,7 @@ stats->create (gettext_noop ("# gap content total planned")); stat_gap_query_success = stats->create (gettext_noop ("# gap routes succeeded")); - stat_trust_spent = - stats->create (gettext_noop ("# trust spent")); + stat_trust_spent = stats->create (gettext_noop ("# trust spent")); } return 0; } Modified: GNUnet/src/include/gnunet_util_network.h =================================================================== --- GNUnet/src/include/gnunet_util_network.h 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/include/gnunet_util_network.h 2008-03-02 08:21:56 UTC (rev 6510) @@ -269,7 +269,7 @@ /** * Actual definitions will be in system header files. - */ + */ struct sockaddr; struct in_addr; struct in6_addr; @@ -518,7 +518,7 @@ GNUNET_get_ip_from_hostname (struct GNUNET_GE_Context *ectx, const char *hostname, int domain, - struct sockaddr **sa, unsigned int * socklen); + struct sockaddr **sa, unsigned int *socklen); /** * Get an IP address as a string (works for both IPv4 and IPv6). Note Modified: GNUnet/src/server/connection.c =================================================================== --- GNUnet/src/server/connection.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/server/connection.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -164,7 +164,7 @@ * (note that the violation counter also ages and that * advertised bandwidth limits are adjusted to a * fraction according to the current violation counter). - */ + */ #define MAX_VIOLATIONS 10 /** @@ -1800,7 +1800,9 @@ p2pHdr = (GNUNET_TransportPacket_HEADER *) plaintextMsg; p2pHdr->timeStamp = htonl (GNUNET_get_time_int32 (NULL)); p2pHdr->sequenceNumber = htonl (be->lastSequenceNumberSend); - p2pHdr->bandwidth = htonl (be->idealized_limit * (MAX_VIOLATIONS - be->violations) / MAX_VIOLATIONS); + p2pHdr->bandwidth = + htonl (be->idealized_limit * (MAX_VIOLATIONS - be->violations) / + MAX_VIOLATIONS); p = sizeof (GNUNET_TransportPacket_HEADER); for (i = 0; i < stotal; i++) { Modified: GNUnet/src/transports/common.c =================================================================== --- GNUnet/src/transports/common.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/transports/common.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -209,28 +209,28 @@ (ntohs (hello->header.size) != GNUNET_sizeof_hello (hello)) || (0 == (ntohs (haddr->availability) & - (VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4))) ) + (VERSION_AVAILABLE_IPV6 | VERSION_AVAILABLE_IPV4)))) { GNUNET_GE_BREAK_OP (NULL, 0); return GNUNET_SYSERR; /* invalid (external error) */ } - if ( (ntohs (hello->protocol) != myAPI.protocolNumber) || - (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO) ) + if ((ntohs (hello->protocol) != myAPI.protocolNumber) || + (ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO)) { GNUNET_GE_BREAK (NULL, 0); return GNUNET_SYSERR; /* invalid (internal error) */ } - if ( ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV4)) - && - ((GNUNET_YES == - is_blacklisted_ipv4 (&haddr->ipv4)) - || (GNUNET_YES != - is_whitelisted_ipv4 (&haddr->ipv4)))) - || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV6)) - && - ((GNUNET_YES == - is_blacklisted_ipv6 (&haddr->ipv6)) - || (GNUNET_YES != is_whitelisted_ipv6 (&haddr->ipv6))))) + if (((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV4)) + && + ((GNUNET_YES == + is_blacklisted_ipv4 (&haddr->ipv4)) + || (GNUNET_YES != + is_whitelisted_ipv4 (&haddr->ipv4)))) + || ((0 != (ntohs (haddr->availability) & VERSION_AVAILABLE_IPV6)) + && + ((GNUNET_YES == + is_blacklisted_ipv6 (&haddr->ipv6)) + || (GNUNET_YES != is_whitelisted_ipv6 (&haddr->ipv6))))) { return GNUNET_SYSERR; /* invalid, incompatible with us */ } Modified: GNUnet/src/transports/http.c =================================================================== --- GNUnet/src/transports/http.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/transports/http.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -1148,12 +1148,12 @@ GNUNET_hash_to_enc (&coreAPI->myIdentity->hashPubKey, &enc); available = ntohs (haddr->availability) & available_protocols; if (available == (VERSION_AVAILABLE_IPV4 | VERSION_AVAILABLE_IPV6)) - { - if (GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, 2) == 0) - available = VERSION_AVAILABLE_IPV4; - else - available = VERSION_AVAILABLE_IPV6; - } + { + if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 2) == 0) + available = VERSION_AVAILABLE_IPV4; + else + available = VERSION_AVAILABLE_IPV6; + } if ((available & VERSION_AVAILABLE_IPV4) > 0) { if (NULL == inet_ntop (AF_INET, &haddr->ipv4, buf, IP_BUF_LEN)) Modified: GNUnet/src/transports/tcp.c =================================================================== --- GNUnet/src/transports/tcp.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/transports/tcp.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -575,10 +575,10 @@ available = ntohs (haddr->availability) & available_protocols; if (available == (VERSION_AVAILABLE_IPV4 | VERSION_AVAILABLE_IPV6)) { - if (GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, 2) == 0) - available = VERSION_AVAILABLE_IPV4; + if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 2) == 0) + available = VERSION_AVAILABLE_IPV4; else - available = VERSION_AVAILABLE_IPV6; + available = VERSION_AVAILABLE_IPV6; } if ((available & VERSION_AVAILABLE_IPV4) > 0) sock = SOCKET (PF_INET, SOCK_STREAM, 0); Modified: GNUnet/src/transports/udp.c =================================================================== --- GNUnet/src/transports/udp.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/transports/udp.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -347,10 +347,10 @@ return GNUNET_SYSERR; if (available == (VERSION_AVAILABLE_IPV4 | VERSION_AVAILABLE_IPV6)) { - if (GNUNET_random_u32(GNUNET_RANDOM_QUALITY_WEAK, 2) == 0) - available = VERSION_AVAILABLE_IPV4; + if (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 2) == 0) + available = VERSION_AVAILABLE_IPV4; else - available = VERSION_AVAILABLE_IPV6; + available = VERSION_AVAILABLE_IPV6; } ssize = size + sizeof (UDPMessage); mp = GNUNET_malloc (ssize); Modified: GNUnet/src/util/network/dns.c =================================================================== --- GNUnet/src/util/network/dns.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/util/network/dns.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -486,8 +486,7 @@ GNUNET_get_ip_from_hostname (struct GNUNET_GE_Context *ectx, const char *hostname, int domain, - struct sockaddr **sa, - unsigned int * socklen) + struct sockaddr **sa, unsigned int *socklen) { int ret; Modified: GNUnet/src/util/network/ip.c =================================================================== --- GNUnet/src/util/network/ip.c 2008-03-02 08:00:19 UTC (rev 6509) +++ GNUnet/src/util/network/ip.c 2008-03-02 08:21:56 UTC (rev 6510) @@ -361,8 +361,7 @@ GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER, _("GNUnet now uses the IP address %s.\n"), - inet_ntop (AF_INET, identity, ntop_buf, - INET_ADDRSTRLEN)); + inet_ntop (AF_INET, identity, ntop_buf, INET_ADDRSTRLEN)); return GNUNET_OK; #endif } _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn