ntdll: Constify some variables (1 of 2) (Resend)

Andrew Talbot Andrew.Talbot at talbotville.com
Fri Jun 22 13:49:30 CDT 2007


I pulled this one, before, because I needed to think twice about the "dump"
functions, but I reckon they are OK. But please let me know if anything is wrong
with it. Variadic functions with read-only intent are a bit of a grey area for me:
should I trust them? Is it reasonable to trust library functions, such as printf,
but better not to trust home-grown ones? Feedback appreciated.

Thanks,

-- Andy.
---
Changelog:
    ntdll: Constify some variables.

diff -urN a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c
--- a/dlls/ntdll/cdrom.c	2007-06-15 17:55:25.000000000 +0100
+++ b/dlls/ntdll/cdrom.c	2007-06-20 20:39:06.000000000 +0100
@@ -1738,7 +1738,7 @@
  *
  *
  */
-static NTSTATUS DVD_StartSession(int fd, PDVD_SESSION_ID sid_in, PDVD_SESSION_ID sid_out)
+static NTSTATUS DVD_StartSession(int fd, const DVD_SESSION_ID *sid_in, PDVD_SESSION_ID sid_out)
 {
 #if defined(linux)
     NTSTATUS ret = STATUS_NOT_SUPPORTED;
@@ -1746,7 +1746,7 @@
 
     memset( &auth_info, 0, sizeof( auth_info ) );
     auth_info.type = DVD_LU_SEND_AGID;
-    if (sid_in) auth_info.lsa.agid = *(int*)sid_in; /* ?*/
+    if (sid_in) auth_info.lsa.agid = *(const int*)sid_in; /* ?*/
 
     TRACE("fd 0x%08x\n",fd);
     ret =CDROM_GetStatusCode(ioctl(fd, DVD_AUTH, &auth_info));
@@ -1764,14 +1764,14 @@
  *
  *
  */
-static NTSTATUS DVD_EndSession(int fd, PDVD_SESSION_ID sid)
+static NTSTATUS DVD_EndSession(int fd, const DVD_SESSION_ID *sid)
 {
 #if defined(linux)
     dvd_authinfo auth_info;
 
     memset( &auth_info, 0, sizeof( auth_info ) );
     auth_info.type = DVD_INVALIDATE_AGID;
-    auth_info.lsa.agid = *(int*)sid;
+    auth_info.lsa.agid = *(const int*)sid;
 
     TRACE("\n");
     return CDROM_GetStatusCode(ioctl(fd, DVD_AUTH, &auth_info));
@@ -1787,7 +1787,7 @@
  *
  *
  */
-static NTSTATUS DVD_SendKey(int fd, PDVD_COPY_PROTECT_KEY key)
+static NTSTATUS DVD_SendKey(int fd, const DVD_COPY_PROTECT_KEY *key)
 {
 #if defined(linux)
     NTSTATUS ret = STATUS_NOT_SUPPORTED;
@@ -1931,7 +1931,7 @@
  *
  *
  */
-static NTSTATUS DVD_ReadStructure(int dev, PDVD_READ_STRUCTURE structure, PDVD_LAYER_DESCRIPTOR layer)
+static NTSTATUS DVD_ReadStructure(int dev, const DVD_READ_STRUCTURE *structure, PDVD_LAYER_DESCRIPTOR layer)
 {
 #ifdef DVD_READ_STRUCT
     dvd_struct s;
diff -urN a/dlls/ntdll/debugbuffer.c b/dlls/ntdll/debugbuffer.c
--- a/dlls/ntdll/debugbuffer.c	2006-10-18 13:40:05.000000000 +0100
+++ b/dlls/ntdll/debugbuffer.c	2007-06-20 20:39:15.000000000 +0100
@@ -35,7 +35,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(debug_buffer);
 
-static void dump_DEBUG_MODULE_INFORMATION(PDEBUG_MODULE_INFORMATION iBuf)
+static void dump_DEBUG_MODULE_INFORMATION(const DEBUG_MODULE_INFORMATION *iBuf)
 {
   TRACE( "MODULE_INFORMATION:%p\n", iBuf );
   if (NULL == iBuf) return ;
@@ -44,7 +44,7 @@
   TRACE( "Flags:%d\n", iBuf->Flags );
 }
 
-static void dump_DEBUG_HEAP_INFORMATION(PDEBUG_HEAP_INFORMATION iBuf)
+static void dump_DEBUG_HEAP_INFORMATION(const DEBUG_HEAP_INFORMATION *iBuf)
 {
   TRACE( "HEAP_INFORMATION:%p\n", iBuf );
   if (NULL == iBuf) return ;
@@ -52,7 +52,7 @@
   TRACE( "Flags:%d\n", iBuf->Flags );
 }
 
-static void dump_DEBUG_LOCK_INFORMATION(PDEBUG_LOCK_INFORMATION iBuf)
+static void dump_DEBUG_LOCK_INFORMATION(const DEBUG_LOCK_INFORMATION *iBuf)
 {
   TRACE( "LOCK_INFORMATION:%p\n", iBuf );
 
@@ -70,7 +70,7 @@
   TRACE( "NumberOfExclusiveWaiters:%d\n", iBuf->NumberOfExclusiveWaiters );
 }
 
-static void dump_DEBUG_BUFFER(PDEBUG_BUFFER iBuf)
+static void dump_DEBUG_BUFFER(const DEBUG_BUFFER *iBuf)
 {
   if (NULL == iBuf) return ;
   TRACE( "SectionHandle:%p\n", iBuf->SectionHandle);
diff -urN a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
--- a/dlls/ntdll/directory.c	2007-06-05 17:25:36.000000000 +0100
+++ b/dlls/ntdll/directory.c	2007-06-20 20:39:24.000000000 +0100
@@ -161,7 +161,7 @@
 }
 
 /* check if the device can be a mounted volume */
-static inline int is_valid_mounted_device( struct stat *st )
+static inline int is_valid_mounted_device( const struct stat *st )
 {
 #if defined(linux) || defined(__sun__)
     return S_ISBLK( st->st_mode );



More information about the wine-patches mailing list