/* Machine-independent I/O routines for gcov.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Contributed by Bob Manson <manson@cygnus.com>.
This file is part of GNU CC.
#ifndef GCOV_IO_H
#define GCOV_IO_H
#include <stdio.h>
+#include <sys/types.h>
+
+static int __fetch_long PARAMS ((long *, char *, size_t)) ATTRIBUTE_UNUSED;
+static int __store_long PARAMS ((long, char *, size_t)) ATTRIBUTE_UNUSED;
+static int __read_long PARAMS ((long *, FILE *, size_t)) ATTRIBUTE_UNUSED;
+static int __write_long PARAMS ((long, FILE *, size_t)) ATTRIBUTE_UNUSED;
/* These routines only work for signed values. */
__fetch_long (dest, source, bytes)
long *dest;
char *source;
- int bytes;
+ size_t bytes;
{
long value = 0;
int i;
- for (i = bytes - 1; i > (sizeof (*dest) - 1); i--)
- if (source[i] & (i == (bytes - 1) ? 127 : 255 ))
+ for (i = bytes - 1; (size_t) i > (sizeof (*dest) - 1); i--)
+ if (source[i] & ((size_t) i == (bytes - 1) ? 127 : 255 ))
return 1;
for (; i >= 0; i--)
- value = value * 256 + (source[i] & (i == (bytes - 1) ? 127 : 255));
+ value = value * 256 + (source[i] & ((size_t)i == (bytes - 1) ? 127 : 255));
if ((source[bytes - 1] & 128) && (value > 0))
value = - value;