riched20: Constify some variables

Andrew Talbot andrew.talbot at talbotville.com
Tue Aug 14 15:30:13 CDT 2007


Changelog:
    riched20: Constify some variables.

diff -urN a/dlls/riched20/reader.c b/dlls/riched20/reader.c
--- a/dlls/riched20/reader.c	2007-06-27 15:13:23.000000000 +0100
+++ b/dlls/riched20/reader.c	2007-08-14 21:05:51.000000000 +0100
@@ -92,7 +92,7 @@
 /*
  * Saves a string on the heap and returns a pointer to it.
  */
-static inline char *RTFStrSave(char *s)
+static inline char *RTFStrSave(const char *s)
 {
 	char	*p;
 
@@ -254,7 +254,7 @@
  * to be accurate, only insofar as the calling program makes them so.
  */
 
-void RTFSetInputName(RTF_Info *info, char *name)
+void RTFSetInputName(RTF_Info *info, const char *name)
 {
 	info->inputName = RTFStrSave (name);
 	if (info->inputName == NULL)
@@ -262,13 +262,13 @@
 }
 
 
-char *RTFGetInputName(RTF_Info *info)
+char *RTFGetInputName(const RTF_Info *info)
 {
 	return (info->inputName);
 }
 
 
-void RTFSetOutputName(RTF_Info *info, char *name)
+void RTFSetOutputName(RTF_Info *info, const char *name)
 {
 	info->outputName = RTFStrSave (name);
 	if (info->outputName == NULL)
@@ -276,7 +276,7 @@
 }
 
 
-char *RTFGetOutputName(RTF_Info *info)
+char *RTFGetOutputName(const RTF_Info *info)
 {
 	return (info->outputName);
 }
@@ -301,7 +301,7 @@
 }
 
 
-RTFFuncPtr RTFGetClassCallback(RTF_Info *info, int class)
+RTFFuncPtr RTFGetClassCallback(const RTF_Info *info, int class)
 {
 	if (class >= 0 && class < rtfMaxClass)
 		return info->ccb[class];
@@ -320,7 +320,7 @@
 }
 
 
-RTFFuncPtr RTFGetDestinationCallback(RTF_Info *info, int dest)
+RTFFuncPtr RTFGetDestinationCallback(const RTF_Info *info, int dest)
 {
 	if (dest >= 0 && dest < rtfMaxDestination)
 		return info->dcb[dest];
@@ -447,7 +447,7 @@
 }
 
 
-RTFFuncPtr RTFGetReadHook(RTF_Info *info)
+RTFFuncPtr RTFGetReadHook(const RTF_Info *info)
 {
 	return (info->readHook);
 }
@@ -1258,7 +1258,7 @@
  */
 
 
-RTFStyle *RTFGetStyle(RTF_Info *info, int num)
+RTFStyle *RTFGetStyle(const RTF_Info *info, int num)
 {
 	RTFStyle	*s;
 
@@ -1273,7 +1273,7 @@
 }
 
 
-RTFFont *RTFGetFont(RTF_Info *info, int num)
+RTFFont *RTFGetFont(const RTF_Info *info, int num)
 {
 	RTFFont	*f;
 
@@ -1288,7 +1288,7 @@
 }
 
 
-RTFColor *RTFGetColor(RTF_Info *info, int num)
+RTFColor *RTFGetColor(const RTF_Info *info, int num)
 {
 	RTFColor	*c;
 
@@ -2373,19 +2373,19 @@
  * Token comparison routines
  */
 
-int RTFCheckCM(RTF_Info *info, int class, int major)
+int RTFCheckCM(const RTF_Info *info, int class, int major)
 {
 	return (info->rtfClass == class && info->rtfMajor == major);
 }
 
 
-int RTFCheckCMM(RTF_Info *info, int class, int major, int minor)
+int RTFCheckCMM(const RTF_Info *info, int class, int major, int minor)
 {
 	return (info->rtfClass == class && info->rtfMajor == major && info->rtfMinor == minor);
 }
 
 
-int RTFCheckMM(RTF_Info *info, int major, int minor)
+int RTFCheckMM(const RTF_Info *info, int major, int minor)
 {
 	return (info->rtfMajor == major && info->rtfMinor == minor);
 }
@@ -2661,7 +2661,7 @@
 }
 
 static void
-RTFPutUnicodeString(RTF_Info *info, WCHAR *string, int length)
+RTFPutUnicodeString(RTF_Info *info, const WCHAR *string, int length)
 {
         if (info->dwCPOutputCount)
                 RTFFlushCPOutputBuffer(info);
diff -urN a/dlls/riched20/rtf.h b/dlls/riched20/rtf.h
--- a/dlls/riched20/rtf.h	2006-11-02 11:51:45.000000000 +0000
+++ b/dlls/riched20/rtf.h	2007-08-14 21:26:51.000000000 +0100
@@ -1112,30 +1112,30 @@
 
 void		RTFInit (RTF_Info *);
 void	        RTFDestroy(RTF_Info *info);
-void		RTFSetInputName (RTF_Info *, char *);
-char		*RTFGetInputName (RTF_Info *);
-void		RTFSetOutputName (RTF_Info *, char *);
-char		*RTFGetOutputName (RTF_Info *);
+void		RTFSetInputName (RTF_Info *, const char *);
+char		*RTFGetInputName (const RTF_Info *);
+void		RTFSetOutputName (RTF_Info *, const char *);
+char		*RTFGetOutputName (const RTF_Info *);
 void		RTFSetClassCallback (RTF_Info *, int, RTFFuncPtr);
-RTFFuncPtr	RTFGetClassCallback (RTF_Info *, int);
+RTFFuncPtr	RTFGetClassCallback (const RTF_Info *, int);
 void		RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr);
-RTFFuncPtr	RTFGetDestinationCallback (RTF_Info *, int);
+RTFFuncPtr	RTFGetDestinationCallback (const RTF_Info *, int);
 void		RTFRead (RTF_Info *);
 int		RTFGetToken (RTF_Info *);	/* writer should rarely need this */
 void		RTFUngetToken (RTF_Info *);
 int		RTFPeekToken (RTF_Info *);
 void		RTFSetToken (RTF_Info *, int, int, int, int, const char *);
 void		RTFSetReadHook (RTF_Info *, RTFFuncPtr);
-RTFFuncPtr	RTFGetReadHook (RTF_Info *);
+RTFFuncPtr	RTFGetReadHook (const RTF_Info *);
 void		RTFRouteToken (RTF_Info *);
 void		RTFSkipGroup (RTF_Info *);
 void		RTFExpandStyle (RTF_Info *, int);
-int		RTFCheckCM (RTF_Info *, int, int);
-int		RTFCheckCMM (RTF_Info *, int, int, int);
-int		RTFCheckMM (RTF_Info *, int, int);
-RTFFont		*RTFGetFont (RTF_Info *, int);
-RTFColor	*RTFGetColor (RTF_Info *, int);
-RTFStyle	*RTFGetStyle (RTF_Info *, int);
+int		RTFCheckCM (const RTF_Info *, int, int);
+int		RTFCheckCMM (const RTF_Info *, int, int, int);
+int		RTFCheckMM (const RTF_Info *, int, int);
+RTFFont		*RTFGetFont (const RTF_Info *, int);
+RTFColor	*RTFGetColor (const RTF_Info *, int);
+RTFStyle	*RTFGetStyle (const RTF_Info *, int);
 int		RTFCharToHex ( char);
 int		RTFHexToChar ( int );
 



More information about the wine-patches mailing list