Commit e21a97da authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed some compiler warnings on Darwin.

parent 5f5418a3
...@@ -431,27 +431,20 @@ static int CDROM_MediaChanged(int dev) ...@@ -431,27 +431,20 @@ static int CDROM_MediaChanged(int dev)
* case the cache will be cleared, causing it to be resynced. * case the cache will be cleared, causing it to be resynced.
* The cache section must be held by caller. * The cache section must be held by caller.
*/ */
static int CDROM_SyncCache(int dev, int fd) static NTSTATUS CDROM_SyncCache(int dev, int fd)
{ {
int i, io = 0, tsz;
#ifdef linux #ifdef linux
int i, tsz;
struct cdrom_tochdr hdr; struct cdrom_tochdr hdr;
struct cdrom_tocentry entry; struct cdrom_tocentry entry;
#elif defined(__FreeBSD__) || defined(__NetBSD__)
struct ioc_toc_header hdr;
struct ioc_read_toc_entry entry;
struct cd_toc_entry toc_buffer;
#endif
CDROM_TOC *toc = &cdrom_cache[dev].toc; CDROM_TOC *toc = &cdrom_cache[dev].toc;
cdrom_cache[dev].toc_good = 0; cdrom_cache[dev].toc_good = 0;
#ifdef linux if (ioctl(fd, CDROMREADTOCHDR, &hdr) == -1)
io = ioctl(fd, CDROMREADTOCHDR, &hdr);
if (io == -1)
{ {
WARN("(%d) -- Error occurred (%s)!\n", dev, strerror(errno)); WARN("(%d) -- Error occurred (%s)!\n", dev, strerror(errno));
goto end; return FILE_GetNtStatus();
} }
toc->FirstTrack = hdr.cdth_trk0; toc->FirstTrack = hdr.cdth_trk0;
...@@ -470,10 +463,10 @@ static int CDROM_SyncCache(int dev, int fd) ...@@ -470,10 +463,10 @@ static int CDROM_SyncCache(int dev, int fd)
else else
entry.cdte_track = i; entry.cdte_track = i;
entry.cdte_format = CDROM_MSF; entry.cdte_format = CDROM_MSF;
io = ioctl(fd, CDROMREADTOCENTRY, &entry); if (ioctl(fd, CDROMREADTOCENTRY, &entry) == -1)
if (io == -1) { {
WARN("error read entry (%s)\n", strerror(errno)); WARN("error read entry (%s)\n", strerror(errno));
goto end; return FILE_GetNtStatus();
} }
toc->TrackData[i - toc->FirstTrack].Control = entry.cdte_ctrl; toc->TrackData[i - toc->FirstTrack].Control = entry.cdte_ctrl;
toc->TrackData[i - toc->FirstTrack].Adr = entry.cdte_adr; toc->TrackData[i - toc->FirstTrack].Adr = entry.cdte_adr;
...@@ -483,16 +476,24 @@ static int CDROM_SyncCache(int dev, int fd) ...@@ -483,16 +476,24 @@ static int CDROM_SyncCache(int dev, int fd)
toc->TrackData[i - toc->FirstTrack].Address[1] = entry.cdte_addr.msf.minute; toc->TrackData[i - toc->FirstTrack].Address[1] = entry.cdte_addr.msf.minute;
toc->TrackData[i - toc->FirstTrack].Address[2] = entry.cdte_addr.msf.second; toc->TrackData[i - toc->FirstTrack].Address[2] = entry.cdte_addr.msf.second;
toc->TrackData[i - toc->FirstTrack].Address[3] = entry.cdte_addr.msf.frame; toc->TrackData[i - toc->FirstTrack].Address[3] = entry.cdte_addr.msf.frame;
} }
cdrom_cache[dev].toc_good = 1; cdrom_cache[dev].toc_good = 1;
io = 0; return STATUS_SUCCESS;
#elif defined(__FreeBSD__) || defined(__NetBSD__) #elif defined(__FreeBSD__) || defined(__NetBSD__)
io = ioctl(fd, CDIOREADTOCHEADER, &hdr); int i, tsz;
if (io == -1) struct ioc_toc_header hdr;
struct ioc_read_toc_entry entry;
struct cd_toc_entry toc_buffer;
CDROM_TOC *toc = &cdrom_cache[dev].toc;
cdrom_cache[dev].toc_good = 0;
if (ioctl(fd, CDIOREADTOCHEADER, &hdr) == -1)
{ {
WARN("(%d) -- Error occurred (%s)!\n", dev, strerror(errno)); WARN("(%d) -- Error occurred (%s)!\n", dev, strerror(errno));
goto end; return FILE_GetNtStatus();
} }
toc->FirstTrack = hdr.starting_track; toc->FirstTrack = hdr.starting_track;
toc->LastTrack = hdr.ending_track; toc->LastTrack = hdr.ending_track;
...@@ -516,10 +517,10 @@ static int CDROM_SyncCache(int dev, int fd) ...@@ -516,10 +517,10 @@ static int CDROM_SyncCache(int dev, int fd)
entry.address_format = CD_MSF_FORMAT; entry.address_format = CD_MSF_FORMAT;
entry.data_len = sizeof(toc_buffer); entry.data_len = sizeof(toc_buffer);
entry.data = &toc_buffer; entry.data = &toc_buffer;
io = ioctl(fd, CDIOREADTOCENTRYS, &entry); if (ioctl(fd, CDIOREADTOCENTRYS, &entry) == -1)
if (io == -1) { {
WARN("error read entry (%s)\n", strerror(errno)); WARN("error read entry (%s)\n", strerror(errno));
goto end; return FILE_GetNtStatus();
} }
toc->TrackData[i - toc->FirstTrack].Control = toc_buffer.control; toc->TrackData[i - toc->FirstTrack].Control = toc_buffer.control;
toc->TrackData[i - toc->FirstTrack].Adr = toc_buffer.addr_type; toc->TrackData[i - toc->FirstTrack].Adr = toc_buffer.addr_type;
...@@ -531,12 +532,10 @@ static int CDROM_SyncCache(int dev, int fd) ...@@ -531,12 +532,10 @@ static int CDROM_SyncCache(int dev, int fd)
toc->TrackData[i - toc->FirstTrack].Address[3] = toc_buffer.addr.msf.frame; toc->TrackData[i - toc->FirstTrack].Address[3] = toc_buffer.addr.msf.frame;
} }
cdrom_cache[dev].toc_good = 1; cdrom_cache[dev].toc_good = 1;
io = 0; return STATUS_SUCCESS;
#else #else
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
#endif #endif
end:
return CDROM_GetStatusCode(io);
} }
static void CDROM_ClearCacheEntry(int dev) static void CDROM_ClearCacheEntry(int dev)
...@@ -1914,7 +1913,6 @@ static NTSTATUS DVD_ReadKey(int fd, PDVD_COPY_PROTECT_KEY key) ...@@ -1914,7 +1913,6 @@ static NTSTATUS DVD_ReadKey(int fd, PDVD_COPY_PROTECT_KEY key)
TRACE("outside\n"); TRACE("outside\n");
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
#endif #endif
TRACE("not reached\n");
} }
/****************************************************************** /******************************************************************
......
...@@ -1574,17 +1574,17 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info ) ...@@ -1574,17 +1574,17 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info )
} }
#elif defined (__APPLE__) #elif defined (__APPLE__)
struct statfs stfs; struct statfs stfs;
kern_return_t kernResult = KERN_FAILURE;
mach_port_t masterPort;
char bsdName[6]; /* disk#\0 */
const char *name;
info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM; info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM;
if (fstatfs( fd, &stfs ) < 0) return FILE_GetNtStatus(); if (fstatfs( fd, &stfs ) < 0) return FILE_GetNtStatus();
/* stfs.f_type is reserved (always set to 0) so use IOKit */ /* stfs.f_type is reserved (always set to 0) so use IOKit */
kern_return_t kernResult = KERN_FAILURE; name = stfs.f_mntfromname + strlen(_PATH_DEV);
mach_port_t masterPort;
char bsdName[6]; /* disk#\0 */
const char *name = stfs.f_mntfromname + strlen(_PATH_DEV);
memcpy( bsdName, name, min(strlen(name)+1,sizeof(bsdName)) ); memcpy( bsdName, name, min(strlen(name)+1,sizeof(bsdName)) );
bsdName[sizeof(bsdName)-1] = 0; bsdName[sizeof(bsdName)-1] = 0;
...@@ -1596,6 +1596,7 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info ) ...@@ -1596,6 +1596,7 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info )
if (matching) if (matching)
{ {
CFStringRef type;
CFMutableDictionaryRef properties; CFMutableDictionaryRef properties;
io_service_t devService = IOServiceGetMatchingService(masterPort, matching); io_service_t devService = IOServiceGetMatchingService(masterPort, matching);
...@@ -1616,7 +1617,6 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info ) ...@@ -1616,7 +1617,6 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info )
/* /*
NB : mounted disk image (.img/.dmg) don't provide specific type NB : mounted disk image (.img/.dmg) don't provide specific type
*/ */
CFStringRef type;
if ( (type = CFDictionaryGetValue(properties, CFSTR("Type"))) ) if ( (type = CFDictionaryGetValue(properties, CFSTR("Type"))) )
{ {
if ( CFStringCompare(type, CFSTR("CD-ROM"), 0) == kCFCompareEqualTo if ( CFStringCompare(type, CFSTR("CD-ROM"), 0) == kCFCompareEqualTo
......
...@@ -110,6 +110,7 @@ extern "C" { ...@@ -110,6 +110,7 @@ extern "C" {
#define SD_BOTH 0x02 #define SD_BOTH 0x02
/* Constants for WSAIoctl() */ /* Constants for WSAIoctl() */
#undef IOC_VOID /* for Darwin */
#define IOC_UNIX 0x00000000 #define IOC_UNIX 0x00000000
#define IOC_WS2 0x08000000 #define IOC_WS2 0x08000000
#define IOC_PROTOCOL 0x10000000 #define IOC_PROTOCOL 0x10000000
......
...@@ -175,7 +175,6 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem) ...@@ -175,7 +175,6 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
/* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */ /* Add an entry to the tree. Only give hKey for root nodes (HKEY_ constants) */
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HKEY hKey, DWORD dwChildren) static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HKEY hKey, DWORD dwChildren)
{ {
TVITEM tvi;
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
if (hKey) { if (hKey) {
...@@ -184,14 +183,13 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HK ...@@ -184,14 +183,13 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HK
} }
} }
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; tvins.u.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
tvi.pszText = label; tvins.u.item.pszText = label;
tvi.cchTextMax = lstrlen(tvi.pszText); tvins.u.item.cchTextMax = lstrlen(label);
tvi.iImage = Image_Closed; tvins.u.item.iImage = Image_Closed;
tvi.iSelectedImage = Image_Open; tvins.u.item.iSelectedImage = Image_Open;
tvi.cChildren = dwChildren; tvins.u.item.cChildren = dwChildren;
tvi.lParam = (LPARAM)hKey; tvins.u.item.lParam = (LPARAM)hKey;
tvins.u.item = tvi;
tvins.hInsertAfter = (HTREEITEM)(hKey ? TVI_LAST : TVI_SORT); tvins.hInsertAfter = (HTREEITEM)(hKey ? TVI_LAST : TVI_SORT);
tvins.hParent = hParent; tvins.hParent = hParent;
return TreeView_InsertItem(hwndTV, &tvins); return TreeView_InsertItem(hwndTV, &tvins);
...@@ -504,21 +502,19 @@ HWND StartKeyRename(HWND hwndTV) ...@@ -504,21 +502,19 @@ HWND StartKeyRename(HWND hwndTV)
static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName) static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
{ {
TVITEM tvi;
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
HTREEITEM hRoot; HTREEITEM hRoot;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM; tvins.u.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
/* Set the text of the item. */ /* Set the text of the item. */
tvi.pszText = pHostName; tvins.u.item.pszText = pHostName;
tvi.cchTextMax = lstrlen(tvi.pszText); tvins.u.item.cchTextMax = lstrlen(pHostName);
/* Assume the item is not a parent item, so give it an image. */ /* Assume the item is not a parent item, so give it an image. */
tvi.iImage = Image_Root; tvins.u.item.iImage = Image_Root;
tvi.iSelectedImage = Image_Root; tvins.u.item.iSelectedImage = Image_Root;
tvi.cChildren = 5; tvins.u.item.cChildren = 5;
/* Save the heading level in the item's application-defined data area. */ /* Save the heading level in the item's application-defined data area. */
tvi.lParam = (LPARAM)NULL; tvins.u.item.lParam = (LPARAM)NULL;
tvins.u.item = tvi;
tvins.hInsertAfter = (HTREEITEM)TVI_FIRST; tvins.hInsertAfter = (HTREEITEM)TVI_FIRST;
tvins.hParent = TVI_ROOT; tvins.hParent = TVI_ROOT;
/* Add the item to the tree view control. */ /* Add the item to the tree view control. */
......
...@@ -889,7 +889,7 @@ static void set_value( struct key *key, const struct unicode_str *name, ...@@ -889,7 +889,7 @@ static void set_value( struct key *key, const struct unicode_str *name,
} }
/* get a key value */ /* get a key value */
static void get_value( struct key *key, const struct unicode_str *name, int *type, unsigned int *len ) static void get_value( struct key *key, const struct unicode_str *name, int *type, size_t *len )
{ {
struct key_value *value; struct key_value *value;
int index; int index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment