fix checksum so it does not use illegal lvalue cast (from mycroft)
[unix-history] / usr / src / sys / ufs / lfs / lfs_cksum.c
index f35fab9..0da8ba8 100644 (file)
@@ -1,17 +1,13 @@
 /*-
 /*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_cksum.c 7.4 (Berkeley) %G%
+ *     @(#)lfs_cksum.c 8.2 (Berkeley) %G%
  */
 
  */
 
-#include <sys/param.h>
-#include <sys/vnode.h>
-
-#include <ufs/lfs/lfs.h>
-#include <ufs/lfs/lfs_extern.h>
+#include <sys/types.h>
 
 /*
  * Simple, general purpose, fast checksum.  Data must be short-aligned.
 
 /*
  * Simple, general purpose, fast checksum.  Data must be short-aligned.
@@ -30,7 +26,7 @@ cksum(str, len)
        len &= ~(sizeof(u_short) - 1);
        for (sum = 0; len; len -= sizeof(u_short)) {
                sum ^= *(u_short *)str;
        len &= ~(sizeof(u_short) - 1);
        for (sum = 0; len; len -= sizeof(u_short)) {
                sum ^= *(u_short *)str;
-               ++(u_short *)str;
+               str = (void *)((u_short *)str + 1);
        }
        return (sum);
 }
        }
        return (sum);
 }