Fixed some compiler warnings on Darwin.
This commit is contained in:
parent
5f5418a331
commit
e21a97da85
|
@ -431,27 +431,20 @@ static int CDROM_MediaChanged(int dev)
|
|||
* case the cache will be cleared, causing it to be resynced.
|
||||
* 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
|
||||
int i, tsz;
|
||||
struct cdrom_tochdr hdr;
|
||||
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_cache[dev].toc_good = 0;
|
||||
|
||||
#ifdef linux
|
||||
|
||||
io = ioctl(fd, CDROMREADTOCHDR, &hdr);
|
||||
if (io == -1)
|
||||
if (ioctl(fd, CDROMREADTOCHDR, &hdr) == -1)
|
||||
{
|
||||
WARN("(%d) -- Error occurred (%s)!\n", dev, strerror(errno));
|
||||
goto end;
|
||||
return FILE_GetNtStatus();
|
||||
}
|
||||
|
||||
toc->FirstTrack = hdr.cdth_trk0;
|
||||
|
@ -470,10 +463,10 @@ static int CDROM_SyncCache(int dev, int fd)
|
|||
else
|
||||
entry.cdte_track = i;
|
||||
entry.cdte_format = CDROM_MSF;
|
||||
io = ioctl(fd, CDROMREADTOCENTRY, &entry);
|
||||
if (io == -1) {
|
||||
if (ioctl(fd, CDROMREADTOCENTRY, &entry) == -1)
|
||||
{
|
||||
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].Adr = entry.cdte_adr;
|
||||
|
@ -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[2] = entry.cdte_addr.msf.second;
|
||||
toc->TrackData[i - toc->FirstTrack].Address[3] = entry.cdte_addr.msf.frame;
|
||||
}
|
||||
cdrom_cache[dev].toc_good = 1;
|
||||
io = 0;
|
||||
}
|
||||
cdrom_cache[dev].toc_good = 1;
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
|
||||
io = ioctl(fd, CDIOREADTOCHEADER, &hdr);
|
||||
if (io == -1)
|
||||
int i, tsz;
|
||||
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));
|
||||
goto end;
|
||||
return FILE_GetNtStatus();
|
||||
}
|
||||
toc->FirstTrack = hdr.starting_track;
|
||||
toc->LastTrack = hdr.ending_track;
|
||||
|
@ -516,10 +517,10 @@ static int CDROM_SyncCache(int dev, int fd)
|
|||
entry.address_format = CD_MSF_FORMAT;
|
||||
entry.data_len = sizeof(toc_buffer);
|
||||
entry.data = &toc_buffer;
|
||||
io = ioctl(fd, CDIOREADTOCENTRYS, &entry);
|
||||
if (io == -1) {
|
||||
if (ioctl(fd, CDIOREADTOCENTRYS, &entry) == -1)
|
||||
{
|
||||
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].Adr = toc_buffer.addr_type;
|
||||
|
@ -531,12 +532,10 @@ static int CDROM_SyncCache(int dev, int fd)
|
|||
toc->TrackData[i - toc->FirstTrack].Address[3] = toc_buffer.addr.msf.frame;
|
||||
}
|
||||
cdrom_cache[dev].toc_good = 1;
|
||||
io = 0;
|
||||
return STATUS_SUCCESS;
|
||||
#else
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
#endif
|
||||
end:
|
||||
return CDROM_GetStatusCode(io);
|
||||
}
|
||||
|
||||
static void CDROM_ClearCacheEntry(int dev)
|
||||
|
@ -1914,7 +1913,6 @@ static NTSTATUS DVD_ReadKey(int fd, PDVD_COPY_PROTECT_KEY key)
|
|||
TRACE("outside\n");
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
#endif
|
||||
TRACE("not reached\n");
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -1574,17 +1574,17 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info )
|
|||
}
|
||||
#elif defined (__APPLE__)
|
||||
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;
|
||||
|
||||
if (fstatfs( fd, &stfs ) < 0) return FILE_GetNtStatus();
|
||||
|
||||
/* stfs.f_type is reserved (always set to 0) so use IOKit */
|
||||
kern_return_t kernResult = KERN_FAILURE;
|
||||
mach_port_t masterPort;
|
||||
|
||||
char bsdName[6]; /* disk#\0 */
|
||||
const char *name = stfs.f_mntfromname + strlen(_PATH_DEV);
|
||||
name = stfs.f_mntfromname + strlen(_PATH_DEV);
|
||||
memcpy( bsdName, name, min(strlen(name)+1,sizeof(bsdName)) );
|
||||
bsdName[sizeof(bsdName)-1] = 0;
|
||||
|
||||
|
@ -1596,6 +1596,7 @@ NTSTATUS FILE_GetDeviceInfo( int fd, FILE_FS_DEVICE_INFORMATION *info )
|
|||
|
||||
if (matching)
|
||||
{
|
||||
CFStringRef type;
|
||||
CFMutableDictionaryRef properties;
|
||||
io_service_t devService = IOServiceGetMatchingService(masterPort, matching);
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
CFStringRef type;
|
||||
if ( (type = CFDictionaryGetValue(properties, CFSTR("Type"))) )
|
||||
{
|
||||
if ( CFStringCompare(type, CFSTR("CD-ROM"), 0) == kCFCompareEqualTo
|
||||
|
|
|
@ -110,6 +110,7 @@ extern "C" {
|
|||
#define SD_BOTH 0x02
|
||||
|
||||
/* Constants for WSAIoctl() */
|
||||
#undef IOC_VOID /* for Darwin */
|
||||
#define IOC_UNIX 0x00000000
|
||||
#define IOC_WS2 0x08000000
|
||||
#define IOC_PROTOCOL 0x10000000
|
||||
|
|
|
@ -175,7 +175,6 @@ BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem)
|
|||
/* 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)
|
||||
{
|
||||
TVITEM tvi;
|
||||
TVINSERTSTRUCT tvins;
|
||||
|
||||
if (hKey) {
|
||||
|
@ -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;
|
||||
tvi.pszText = label;
|
||||
tvi.cchTextMax = lstrlen(tvi.pszText);
|
||||
tvi.iImage = Image_Closed;
|
||||
tvi.iSelectedImage = Image_Open;
|
||||
tvi.cChildren = dwChildren;
|
||||
tvi.lParam = (LPARAM)hKey;
|
||||
tvins.u.item = tvi;
|
||||
tvins.u.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
|
||||
tvins.u.item.pszText = label;
|
||||
tvins.u.item.cchTextMax = lstrlen(label);
|
||||
tvins.u.item.iImage = Image_Closed;
|
||||
tvins.u.item.iSelectedImage = Image_Open;
|
||||
tvins.u.item.cChildren = dwChildren;
|
||||
tvins.u.item.lParam = (LPARAM)hKey;
|
||||
tvins.hInsertAfter = (HTREEITEM)(hKey ? TVI_LAST : TVI_SORT);
|
||||
tvins.hParent = hParent;
|
||||
return TreeView_InsertItem(hwndTV, &tvins);
|
||||
|
@ -504,21 +502,19 @@ HWND StartKeyRename(HWND hwndTV)
|
|||
|
||||
static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
|
||||
{
|
||||
TVITEM tvi;
|
||||
TVINSERTSTRUCT tvins;
|
||||
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. */
|
||||
tvi.pszText = pHostName;
|
||||
tvi.cchTextMax = lstrlen(tvi.pszText);
|
||||
tvins.u.item.pszText = pHostName;
|
||||
tvins.u.item.cchTextMax = lstrlen(pHostName);
|
||||
/* Assume the item is not a parent item, so give it an image. */
|
||||
tvi.iImage = Image_Root;
|
||||
tvi.iSelectedImage = Image_Root;
|
||||
tvi.cChildren = 5;
|
||||
tvins.u.item.iImage = Image_Root;
|
||||
tvins.u.item.iSelectedImage = Image_Root;
|
||||
tvins.u.item.cChildren = 5;
|
||||
/* Save the heading level in the item's application-defined data area. */
|
||||
tvi.lParam = (LPARAM)NULL;
|
||||
tvins.u.item = tvi;
|
||||
tvins.u.item.lParam = (LPARAM)NULL;
|
||||
tvins.hInsertAfter = (HTREEITEM)TVI_FIRST;
|
||||
tvins.hParent = TVI_ROOT;
|
||||
/* Add the item to the tree view control. */
|
||||
|
|
|
@ -889,7 +889,7 @@ static void set_value( struct key *key, const struct unicode_str *name,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
int index;
|
||||
|
|
Loading…
Reference in New Issue