gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6023 - GNUnet/src/applications/fs/module


From: gnunet
Subject: [GNUnet-SVN] r6023 - GNUnet/src/applications/fs/module
Date: Sat, 22 Dec 2007 17:16:02 -0700 (MST)

Author: grothoff
Date: 2007-12-22 17:16:02 -0700 (Sat, 22 Dec 2007)
New Revision: 6023

Modified:
   GNUnet/src/applications/fs/module/ondemand.c
Log:
better

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2007-12-22 23:11:59 UTC 
(rev 6022)
+++ GNUnet/src/applications/fs/module/ondemand.c        2007-12-23 00:16:02 UTC 
(rev 6023)
@@ -373,30 +373,37 @@
 #if MIG72
   const OnDemandBlock72 *odb_old;
   OnDemandBlock odb_stack;
-  if (ntohl (dbv->size) != sizeof (OnDemandBlock))
+  switch (ntohl (dbv->type))
     {
+    case GNUNET_ECRS_BLOCKTYPE_ONDEMAND:
+      if (ntohl (dbv->size) != sizeof (OnDemandBlock))
+       {
+          GNUNET_GE_BREAK (ectx, 0);
+          return GNUNET_SYSERR;
+       }
+      odb = (const OnDemandBlock *) dbv;
+      break;
+    case GNUNET_ECRS_BLOCKTYPE_ONDEMAND_OLD:    
       if (ntohl (dbv->size) != sizeof (OnDemandBlock72))
         {
           GNUNET_GE_BREAK (ectx, 0);
           return GNUNET_SYSERR;
         }
-      else
-        {
-          odb_old = (OnDemandBlock72 *) dbv;
-          odb_stack.header = odb_old->header;
-          odb_stack.type = odb_old->type;
-          odb_stack.fileOffset = odb_old->fileOffset;
-          odb_stack.blockSize = odb_old->blockSize;
-          odb_stack.fileId = odb_old->fileId;
-          odb = &odb_stack;
-        }
+      odb_old = (OnDemandBlock72 *) dbv;
+      odb_stack.header = odb_old->header;
+      odb_stack.type = odb_old->type;
+      odb_stack.fileOffset = odb_old->fileOffset;
+      odb_stack.blockSize = odb_old->blockSize;
+      odb_stack.fileId = odb_old->fileId;
+      odb = &odb_stack;
+      break;
+    default:
+      GNUNET_GE_BREAK (ectx, 0);
+      return GNUNET_SYSERR;
     }
-  else
-    {
-      odb = (const OnDemandBlock *) dbv;
-    }
 #else
-  if (ntohl (dbv->size) != sizeof (OnDemandBlock))
+  if ( (ntohl (dbv->size) != sizeof (OnDemandBlock)) ||
+       (ntohl (dbv->type) != GNUNET_ECRS_BLOCKTYPE_ONDEMAND) )
     {
       GNUNET_GE_BREAK (ectx, 0);
       return GNUNET_SYSERR;





reply via email to

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