[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r856 - GNUnet/src/applications/fs/ecrs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r856 - GNUnet/src/applications/fs/ecrs |
Date: |
Fri, 3 Jun 2005 13:09:58 -0700 (PDT) |
Author: grothoff
Date: 2005-06-03 13:09:56 -0700 (Fri, 03 Jun 2005)
New Revision: 856
Modified:
GNUnet/src/applications/fs/ecrs/meta.c
Log:
fix
Modified: GNUnet/src/applications/fs/ecrs/meta.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/meta.c 2005-06-03 19:36:08 UTC (rev
855)
+++ GNUnet/src/applications/fs/ecrs/meta.c 2005-06-03 20:09:56 UTC (rev
856)
@@ -324,13 +324,14 @@
tmp = MALLOC(oldSize);
dlen = oldSize;
if (Z_OK == compress(tmp, &dlen, data, oldSize)) {
- memcpy(data, tmp, dlen);
- FREE(tmp);
- return dlen;
- } else {
- FREE(tmp);
- return oldSize;
+ if (dlen < oldSize) {
+ memcpy(data, tmp, dlen);
+ FREE(tmp);
+ return dlen;
+ }
}
+ FREE(tmp);
+ return oldSize;
}
/**
@@ -444,6 +445,7 @@
len);
pos += len;
}
+
hdr->size = htonl(size);
pos = tryCompression((char*)&hdr[1],
size - sizeof(MetaDataHeader));
@@ -459,10 +461,9 @@
if (! part) {
return SYSERR; /* does not fit! */
}
-
/* partial serialization ok, try again with less meta-data */
if (size > 2 * max)
- ic = ic * 2 / 3; /* stil far too big, make big reductions */
+ ic = ic * 2 / 3; /* still far too big, make big reductions */
else
ic--; /* small steps, we're close */
}
@@ -473,12 +474,12 @@
/* extra check: deserialize! */
#if EXTRA_CHECKS
{
- MetaData * md;
- md = NULL;
- GNUNET_ASSERT(OK == ECRS_deserializeMetaData(&md,
+ MetaData * mdx;
+ mdx = NULL;
+ GNUNET_ASSERT(OK == ECRS_deserializeMetaData(&mdx,
target,
size));
- ECRS_freeMetaData(md);
+ ECRS_freeMetaData(mdx);
}
#endif
return size;
@@ -526,6 +527,7 @@
size = pos + sizeof(MetaDataHeader);
FREE(hdr);
+
return size;
}
@@ -582,7 +584,8 @@
BREAK();
goto FAILURE;
}
- if (data[dataSize-1] != '\0') {
+ if ( (ic > 0)
+ && (data[dataSize-1] != '\0') ) {
BREAK();
goto FAILURE;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r856 - GNUnet/src/applications/fs/ecrs,
grothoff <=