Updated WIN32 code specific sections. Changed header.
[idzebra-moved-to-github.git] / isam / physical.c
index ce4526f..3664ecf 100644 (file)
@@ -1,10 +1,22 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
+ * Copyright (C) 1994-1999, Index Data
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: physical.c,v $
- * Revision 1.11  1996-03-20 13:29:17  quinn
+ * Revision 1.15  1999-02-02 14:51:22  adam
+ * Updated WIN32 code specific sections. Changed header.
+ *
+ * Revision 1.14  1997/09/09 13:38:12  adam
+ * Partial port to WIN95/NT.
+ *
+ * Revision 1.13  1996/10/29 13:56:57  adam
+ * Include of zebrautl.h instead of alexutil.h.
+ *
+ * Revision 1.12  1996/03/20 16:17:11  quinn
+ * Bug hunting
+ *
+ * Revision 1.11  1996/03/20  13:29:17  quinn
  * Bug-fix
  *
  * Revision 1.10  1996/03/19  19:22:44  quinn
@@ -46,7 +58,9 @@
 
 #include <assert.h>
 #include <stdio.h>
+#include <string.h>
 
+#include <log.h>
 #include <isam.h>
 
 static int is_freestore_alloc(ISAM is, int type)
@@ -109,6 +123,7 @@ int is_p_read_partial(is_mtable *tab, is_mblock *block)
     /* extract header info */
     buf->offset = 0;
     memcpy(&block->num_records, buf->data, sizeof(block->num_records));
+    assert(block->num_records > 0);
     buf->offset += sizeof(block->num_records);
     memcpy(&block->nextpos, buf->data + buf->offset,
        sizeof(block->nextpos));
@@ -215,6 +230,7 @@ void is_p_sync(is_mtable *tab)
        }
        logf (LOG_DEBUG, "W: Block #%d contains %d records.", p->diskpos,
            p->num_records);
+       assert(p->num_records > 0);
        for (b = p->data; b; b = b->next)
        {
             logf(LOG_DEBUG, "   buf: offset %d, keys %d, type %d, ref %d",