Add externs to avoid multiple definitions, and then add missing definitions.
[rrq/maintain_lilo.git] / src / edit.c
index f2d8b93f2efef8162c419b16ca1c3a890ff78a59..ded9c38d0629f19bd8a640e0417a28a272bb53eb 100644 (file)
@@ -1,12 +1,12 @@
-/* edit.c -- bitmap file manipulation and editing */
-/*
-Copyright 2002-2004 John Coffman.
-All rights reserved.
-
-Licensed under the terms contained in the file 'COPYING' in the 
-source directory.
-
-*/
+/* edit.c  -  Bitmap file manipulation and editing
+ * 
+ * Copyright 2002-2004 John Coffman
+ * Copyright 2009-2015 Joachim Wiedorn
+ * All rights reserved.
+ * 
+ * Licensed under the terms contained in the file 'COPYING'
+ * in the source directory.
+ */
 
 #define _GNU_SOURCE
 #include <unistd.h>
@@ -97,7 +97,7 @@ int get_std_headers(int fd,
     if (fh->magic != 0x4D42 /* "BM" */)  return 1;
     if (read(fd, &size, sizeof(size)) != sizeof(size))   return -1;
     if (size==sizeof(BITMAPHEADER2)) { /* an OS/2 bitmap */
-       if (read(fd, (void*)&bmh2+sizeof(size), sizeof(BITMAPHEADER2)-sizeof(size))
+       if (read(fd, (char*)&bmh2+sizeof(size), sizeof(BITMAPHEADER2)-sizeof(size))
                != sizeof(BITMAPHEADER2)-sizeof(size) )   return -1;
        memset(bmh, 0, sizeof(BITMAPHEADER));
        bmh->width = bmh2.width;
@@ -110,7 +110,7 @@ int get_std_headers(int fd,
        n = sizeof(RGB2);
     }
     else if (size==sizeof(BITMAPHEADER)) {
-       if (read(fd, (void*)bmh+sizeof(size), sizeof(BITMAPHEADER)-sizeof(size))
+       if (read(fd, (char*)bmh+sizeof(size), sizeof(BITMAPHEADER)-sizeof(size))
                != sizeof(BITMAPHEADER)-sizeof(size) )   return -1;
        bmh->size = size;
        n = sizeof(RGB);
@@ -131,7 +131,7 @@ int get_std_headers(int fd,
       /* get probable BITMAPLILOHEADER */
        if (read(fd, &size, sizeof(size)) != sizeof(size))  return -1;
        if (size != sizeof(BITMAPLILOHEADER))   return 4;
-       if (read(fd, (void*)lh+sizeof(size), sizeof(*lh)-sizeof(size)) !=
+       if (read(fd, (char*)lh+sizeof(size), sizeof(*lh)-sizeof(size)) !=
                sizeof(*lh)-sizeof(size))  return -1;
        *(int*)(lh->size) = size;
        if (strncmp(lh->magic, "LILO", 4) != 0)   return 5;
@@ -192,8 +192,8 @@ static      union {
           BITMAPLILOHEADER bmlh;
        } tm;
 static MENUTABLE *menu = &tm.mt;
-static BITMAPLILOHEADER *lh = (void*)tm.buffer + 
-                       ((long)&tm.mt.row - (long)&tm.bmlh.row);
+static BITMAPLILOHEADER *lh = (void*)(tm.buffer +
+                       ((intptr_t)&tm.mt.row - (intptr_t)&tm.bmlh.row));
 
 /* a convenience definition */
 #define mn tm.mt