From d0579b172c1517f17262871027b6b57e90ffd691 Mon Sep 17 00:00:00 2001
From: snyderx <snyderx@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Tue, 19 Sep 2006 07:22:09 +0000
Subject: [PATCH] As Douglas and Sergey (thanks) pointed out and corrected, C++
 needs explicit casts on some of the function returns and data transfers.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2263 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/os_openbsd.cpp | 10 +++++-----
 sm5/os_openbsd.h   |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/sm5/os_openbsd.cpp b/sm5/os_openbsd.cpp
index a1847cb56..52bc234ed 100644
--- a/sm5/os_openbsd.cpp
+++ b/sm5/os_openbsd.cpp
@@ -25,7 +25,7 @@
 #include "utility.h"
 #include "os_openbsd.h"
 
-const char *os_XXXX_c_cvsid = "$Id: os_openbsd.cpp,v 1.11 2006/08/25 06:06:25 sxzzsf Exp $" \
+const char *os_XXXX_c_cvsid = "$Id: os_openbsd.cpp,v 1.12 2006/09/19 07:22:09 snyderx Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_OPENBSD_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 /* global variable holding byte count of allocated memory */
@@ -105,7 +105,7 @@ get_dev_names(char ***names, const char *prefix)
     pout("Failed to get value of sysctl `hw.disknames'\n");
     return -1;
   }
-  if (!(disknames = malloc(sysctl_len))) {
+  if (!(disknames = (char*)malloc(sysctl_len))) {
     pout("Out of memory constructing scan device list\n");
     return -1;
   }
@@ -121,7 +121,7 @@ get_dev_names(char ***names, const char *prefix)
     if (strncmp(p, prefix, strlen(prefix))) {
       continue;
     }
-    mp[n] = malloc(strlen(net_dev_prefix) + strlen(p) + 2);
+    mp[n] = (char*)malloc(strlen(net_dev_prefix) + strlen(p) + 2);
     if (!mp[n]) {
       pout("Out of memory constructing scan device list\n");
       return -1;
@@ -131,7 +131,7 @@ get_dev_names(char ***names, const char *prefix)
     n++;
   }
 
-  mp = realloc(mp, n * (sizeof(char *)));
+  mp = (char**)realloc(mp, n * (sizeof(char *)));
   bytes += (n) * (sizeof(char *));
   *names = mp;
   return n;
@@ -390,7 +390,7 @@ do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
   memset(&sc, 0, sizeof(sc));
   memcpy(sc.cmd, iop->cmnd, iop->cmnd_len);
   sc.cmdlen = iop->cmnd_len;
-  sc.databuf = iop->dxferp;
+  sc.databuf = (char*)iop->dxferp;
   sc.datalen = iop->dxfer_len;
   sc.senselen = iop->max_sense_len;
   sc.timeout = iop->timeout == 0 ? 60000 : iop->timeout;	/* XXX */
diff --git a/sm5/os_openbsd.h b/sm5/os_openbsd.h
index 356343a9f..eb7f63943 100644
--- a/sm5/os_openbsd.h
+++ b/sm5/os_openbsd.h
@@ -26,7 +26,7 @@
 #ifndef OS_OPENBSD_H_
 #define OS_OPENBSD_H_
 
-#define OS_OPENBSD_H_CVSID "$Id: os_openbsd.h,v 1.4 2006/04/12 14:54:28 ballen4705 Exp $\n"
+#define OS_OPENBSD_H_CVSID "$Id: os_openbsd.h,v 1.5 2006/09/19 07:22:09 snyderx Exp $\n"
 
 /* from NetBSD: atareg.h,v 1.17, by Manuel Bouyer */
 /* Actually fits _perfectly_ into OBSDs wdcreg.h, but... */
@@ -51,5 +51,6 @@
 #include <err.h>
 #include <fcntl.h>
 #include <util.h>
+#include <unistd.h>
 
 #endif /* OS_OPENBSD_H_ */
-- 
GitLab