gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r265 - in GNUnet/src: applications/fs applications/fs/ecrs


From: grothoff
Subject: [GNUnet-SVN] r265 - in GNUnet/src: applications/fs applications/fs/ecrs applications/fs/lib applications/fs/module include util
Date: Mon, 14 Feb 2005 18:45:31 -0800 (PST)

Author: grothoff
Date: 2005-02-14 18:45:30 -0800 (Mon, 14 Feb 2005)
New Revision: 265

Modified:
   GNUnet/src/applications/fs/ecrs/keyspace.c
   GNUnet/src/applications/fs/ecrs/search.c
   GNUnet/src/applications/fs/ecrs_core.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/include/ecrs_core.h
   GNUnet/src/util/hostkey_gcrypt.c
Log:
cleaning up types

Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c  2005-02-15 02:36:00 UTC (rev 
264)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c  2005-02-15 02:45:30 UTC (rev 
265)
@@ -141,7 +141,7 @@
                             &kb->signature));
     /* extra check: verify sig */
     GNUNET_ASSERT(OK == getQueryFor(size,
-                                   (char*) kb,
+                                   (DBlock*) kb,
                                    &hc));
 
     freePrivateKey(pk);

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2005-02-15 02:36:00 UTC (rev 
264)
+++ GNUnet/src/applications/fs/ecrs/search.c    2005-02-15 02:45:30 UTC (rev 
265)
@@ -317,7 +317,7 @@
           (ps->type == ANY_BLOCK) ) &&
         (YES == isDatumApplicable(type,
                                   size,
-                                  (char*) &value[1],
+                                  (const DBlock*) &value[1],
                                   ps->keyCount,
                                   ps->keys)) ) {
       switch (type) {

Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c      2005-02-15 02:36:00 UTC (rev 
264)
+++ GNUnet/src/applications/fs/ecrs_core.c      2005-02-15 02:45:30 UTC (rev 
265)
@@ -131,7 +131,7 @@
 }
 
 unsigned int getTypeOfBlock(unsigned int size,
-                           const void * data) {
+                           const DBlock * data) {
   if (size <= 4) {
     BREAK();
     return ANY_BLOCK; /* signal error */
@@ -149,7 +149,7 @@
  *   the content type is not known
  */
 int getQueryFor(unsigned int size,
-               const char * data,
+               const DBlock * data,
                HashCode160 * query) {  
   unsigned int type;
 
@@ -158,17 +158,17 @@
     return SYSERR;
   switch (type) {
   case D_BLOCK: 
-    fileBlockGetKey((const DBlock*)data,
+    fileBlockGetKey(data,
                    size, 
                    query);
     return OK;  
   case S_BLOCK: {
-    SBlock * sb;
+    const SBlock * sb;
     if (size < sizeof(SBlock)) {
       BREAK();
       return SYSERR;
     }
-    sb = (SBlock*) data;
+    sb = (const SBlock*) data;
     if (OK != verifySig(&sb->identifier,
                        size - sizeof(Signature) - sizeof(PublicKey) - 
sizeof(unsigned int),
                        &sb->signature,
@@ -180,12 +180,12 @@
     return OK;
   }
   case K_BLOCK: {
-    KBlock * kb;
+    const KBlock * kb;
     if (size < sizeof(KBlock)) {
       BREAK();
       return SYSERR;
     }
-    kb = (KBlock*) data;
+    kb = (const KBlock*) data;
     if ( (OK != verifySig(&kb[1],
                          size - sizeof(KBlock),
                          &kb->signature,
@@ -199,12 +199,12 @@
     return OK;
   }
   case N_BLOCK: {
-    NBlock * nb;
+    const NBlock * nb;
     if (size < sizeof(NBlock)) {
       BREAK();
       return SYSERR;
     }
-    nb = (NBlock*) data;
+    nb = (const NBlock*) data;
     if (OK != verifySig(&nb->identifier,
                        size - sizeof(Signature) - sizeof(PublicKey) - 
sizeof(unsigned int),
                        &nb->signature,
@@ -216,12 +216,12 @@
     return OK;
   }
   case KN_BLOCK: {
-    KNBlock * kb;
+    const KNBlock * kb;
     if (size < sizeof(KNBlock)) {
       BREAK();
       return SYSERR;
     }
-    kb = (KNBlock*) data;
+    kb = (const KNBlock*) data;
     if ( (OK != verifySig(&kb->nblock,
                          size - sizeof(Signature) - sizeof(PublicKey) - 
sizeof(unsigned int),
                          &kb->kblock.signature,
@@ -262,7 +262,7 @@
  */
 int isDatumApplicable(unsigned int type,
                      unsigned int size,
-                     const char * data,
+                     const DBlock * data,
                      unsigned int keyCount,
                      const HashCode160 * keys) {
   HashCode160 hc;

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2005-02-15 02:36:00 UTC (rev 
264)
+++ GNUnet/src/applications/fs/lib/fslib.c      2005-02-15 02:45:30 UTC (rev 
265)
@@ -75,7 +75,7 @@
       rep = (ReplyContent*) hdr;
       size = ntohs(hdr->size) - sizeof(ReplyContent);
       if (OK != getQueryFor(size,
-                           (char*)&rep[1],
+                           (DBlock*)&rep[1],
                            &query)) {
        BREAK();
        FREE(hdr);
@@ -90,7 +90,7 @@
          value = MALLOC(sizeof(Datastore_Value) + size);
          value->size = htonl(size + sizeof(Datastore_Value));
          value->type = htonl(getTypeOfBlock(size,
-                                            &rep[1]));
+                                            (DBlock*) &rep[1]));
          value->prio = htonl(0);
          value->anonymityLevel = htonl(0);
          value->expirationTime = htonll(0);

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2005-02-15 02:36:00 UTC (rev 
264)
+++ GNUnet/src/applications/fs/module/fs.c      2005-02-15 02:45:30 UTC (rev 
265)
@@ -114,7 +114,7 @@
     - sizeof(GapWrapper) 
     + sizeof(Datastore_Value);
   if ( (OK != getQueryFor(size - sizeof(Datastore_Value),
-                         (char*)&gw[1],
+                         (DBlock*)&gw[1],
                          &hc)) ||
        (! equalsHashCode160(&hc, key)) ) {
     BREAK(); /* value failed verification! */
@@ -124,7 +124,7 @@
   dv = MALLOC(size);
   dv->size = htonl(size);
   dv->type = htonl(getTypeOfBlock(size - sizeof(Datastore_Value),
-                                 &gw[1]));
+                                 (DBlock*) &gw[1]));
   dv->prio = htonl(prio);
   dv->anonymityLevel = htonl(0);
   et = ntohll(gw->timeout);
@@ -141,7 +141,7 @@
         size - sizeof(Datastore_Value));
   if (YES != isDatumApplicable(ntohl(dv->type),
                               ntohl(dv->size) - sizeof(Datastore_Value),
-                              (char*) &dv[1],
+                              (DBlock*) &dv[1],
                               0,
                               key)) {
     BREAK();
@@ -292,7 +292,7 @@
   datum->prio = ri->prio;
   datum->anonymityLevel = ri->anonymityLevel;
   if (OK != getQueryFor(ntohs(ri->header.size) - sizeof(RequestInsert),
-                       (const char*)&ri[1],
+                       (const DBlock*)&ri[1],
                        &query)) {
     BREAK();
     FREE(datum);
@@ -302,7 +302,7 @@
        hash2enc(&query,
                 &enc));
   type = getTypeOfBlock(ntohs(ri->header.size) - sizeof(RequestInsert),
-                       &ri[1]);
+                       (const DBlock*) &ri[1]);
   LOG(LOG_DEBUG,
       "FS received REQUEST INSERT (query: %s, type: %u)\n",
       &enc,
@@ -428,10 +428,10 @@
   value->size = ntohl(sizeof(Datastore_Value) +
                      ntohs(req->size) - sizeof(RequestDelete));
   type = getTypeOfBlock(ntohs(rd->header.size) - sizeof(RequestDelete),
-                       (const char*)&rd[1]);
+                       (const DBlock*)&rd[1]);
   value->type = htonl(type);
   if (OK != getQueryFor(ntohs(rd->header.size) - sizeof(RequestDelete),
-                       (const char*)&rd[1],
+                       (const DBlock*)&rd[1],
                        &query)) {
     FREE(value);
     BREAK();
@@ -556,7 +556,7 @@
                   
   ret = isDatumApplicable(ntohl(value->type),
                          ntohl(value->size) - sizeof(Datastore_Value),
-                         (const char*) &value[1],
+                         (const DBlock*) &value[1],
                          ggc->keyCount,
                          ggc->keys);
   if (ret == SYSERR) {
@@ -694,6 +694,7 @@
   myClosure.keys = keys;
   myClosure.resultCallback = resultCallback;
   myClosure.resCallbackClosure = resCallbackClosure;
+  ret = OK;
   if (type == D_BLOCK) {
     ret = datastore->get(&keys[0],
                         ONDEMAND_BLOCK,
@@ -772,7 +773,7 @@
 
   ret = isDatumApplicable(ntohl(value->type),
                          ntohl(value->size) - sizeof(Datastore_Value),
-                         (char*) &value[1],
+                         (const DBlock*) &value[1],
                          ggc->keyCount,
                          ggc->keys);
   if (ret == SYSERR) {
@@ -877,13 +878,13 @@
   }
   gw = (const GapWrapper*) content;
   if ( (OK == getQueryFor(size - sizeof(GapWrapper),
-                         (const char*) &gw[1],
+                         (const DBlock*) &gw[1],
                          &q)) &&
        (equalsHashCode160(&q,
                          primaryKey)) &&
        ( (type == ANY_BLOCK) ||
         (type == (t = getTypeOfBlock(size - sizeof(GapWrapper), 
-                                     &gw[1]) ) ) ) ) {
+                                     (const DBlock*)&gw[1]) ) ) ) ) {
     switch(type) {
     case D_BLOCK:
       return YES;

Modified: GNUnet/src/include/ecrs_core.h
===================================================================
--- GNUnet/src/include/ecrs_core.h      2005-02-15 02:36:00 UTC (rev 264)
+++ GNUnet/src/include/ecrs_core.h      2005-02-15 02:45:30 UTC (rev 265)
@@ -187,7 +187,7 @@
  * What is the type of the given block of data?
  */
 unsigned int getTypeOfBlock(unsigned int size,
-                           const void * data);
+                           const DBlock * data);
 
 /**
  * What is the main query (the one that is used in
@@ -201,7 +201,7 @@
  *   the content type is not known
  */
 int getQueryFor(unsigned int size,
-               const char * data,
+               const DBlock * data,
                HashCode160 * query);
 
 /**
@@ -219,7 +219,7 @@
  */
 int isDatumApplicable(unsigned int type,
                      unsigned int size,
-                     const char * data,
+                     const DBlock * data,
                      unsigned int keyCount,
                      const HashCode160 * keys);
 

Modified: GNUnet/src/util/hostkey_gcrypt.c
===================================================================
--- GNUnet/src/util/hostkey_gcrypt.c    2005-02-15 02:36:00 UTC (rev 264)
+++ GNUnet/src/util/hostkey_gcrypt.c    2005-02-15 02:45:30 UTC (rev 265)
@@ -705,7 +705,8 @@
 
   lockGcrypt();
 #if EXTRA_CHECKS
-  if (gcry_pk_testkey(HOSTKEY(hostkey))) {
+  rc = gcry_pk_testkey(HOSTKEY(hostkey));
+  if (rc) {
     LOG_GCRY(LOG_ERROR, "gcry_pk_testkey", rc);
     unlockGcrypt();
     return -1;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]