[WIN32K]: Avoid (LPWSTR) casts on strings that are LPCWSTR, by just using the corresp...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 1 Jun 2016 13:20:18 +0000 (13:20 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 1 Jun 2016 13:20:18 +0000 (13:20 +0000)
svn path=/trunk/; revision=71484

reactos/win32ss/gdi/ntgdi/font.c
reactos/win32ss/gdi/ntgdi/freetype.c
reactos/win32ss/gdi/ntgdi/text.c
reactos/win32ss/gdi/ntgdi/text.h
reactos/win32ss/user/rtl/text.c

index 7c1113e..6a4f683 100644 (file)
@@ -117,7 +117,7 @@ DWORD
 FASTCALL
 GreGetCharacterPlacementW(
     HDC hdc,
-    LPWSTR pwsz,
+    LPCWSTR pwsz,
     INT nCount,
     INT nMaxExtent,
     LPGCP_RESULTSW pgcpw,
index 4f1b300..210cd17 100644 (file)
@@ -3316,7 +3316,7 @@ GreExtTextOutW(
     IN INT YStart,
     IN UINT fuOptions,
     IN OPTIONAL PRECTL lprc,
-    IN LPWSTR String,
+    IN LPCWSTR String,
     IN INT Count,
     IN OPTIONAL LPINT Dx,
     IN DWORD dwCodePage)
@@ -3885,7 +3885,7 @@ NtGdiExtTextOutW(
     RECTL SafeRect;
     BYTE LocalBuffer[STACK_TEXT_BUFFER_SIZE];
     PVOID Buffer = LocalBuffer;
-    LPWSTR SafeString = NULL;
+    LPCWSTR SafeString = NULL;
     LPINT SafeDx = NULL;
     ULONG BufSize, StringSize, DxSize = 0;
 
@@ -3922,7 +3922,7 @@ NtGdiExtTextOutW(
         _SEH2_TRY
         {
             /* Put the Dx before the String to assure alignment of 4 */
-            SafeString = (LPWSTR)(((ULONG_PTR)Buffer) + DxSize);
+            SafeString = (LPCWSTR)(((ULONG_PTR)Buffer) + DxSize);
 
             /* Probe and copy the string */
             ProbeForRead(UnsafeString, StringSize, 1);
index d80a41c..b4130b6 100644 (file)
@@ -23,7 +23,7 @@ GreTextOutW(
     LPCWSTR  lpString,
     int  cchString)
 {
-    return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, (LPWSTR)lpString, cchString, NULL, 0);
+    return GreExtTextOutW(hdc, nXStart, nYStart, 0, NULL, lpString, cchString, NULL, 0);
 }
 
 /*
@@ -35,7 +35,7 @@ BOOL
 FASTCALL
 GreGetTextExtentW(
     HDC hDC,
-    LPWSTR lpwsz,
+    LPCWSTR lpwsz,
     INT cwc,
     LPSIZE psize,
     UINT flOpts)
@@ -92,7 +92,7 @@ BOOL
 FASTCALL
 GreGetTextExtentExW(
     HDC hDC,
-    LPWSTR String,
+    LPCWSTR String,
     ULONG Count,
     ULONG MaxExtent,
     PULONG Fit,
index bc995a9..4a11027 100644 (file)
@@ -126,10 +126,10 @@ BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING,PVOID,DWORD*,DWORD);
 BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI,PREALIZATION_INFO);
 DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI,DWORD,LPKERNINGPAIR);
 BOOL NTAPI GreExtTextOutW(IN HDC,IN INT,IN INT,IN UINT,IN OPTIONAL RECTL*,
-    IN LPWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
+    IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
 DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD);
-BOOL FASTCALL GreGetTextExtentW(HDC,LPWSTR,INT,LPSIZE,UINT);
-BOOL FASTCALL GreGetTextExtentExW(HDC,LPWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG);
+BOOL FASTCALL GreGetTextExtentW(HDC,LPCWSTR,INT,LPSIZE,UINT);
+BOOL FASTCALL GreGetTextExtentExW(HDC,LPCWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG);
 BOOL FASTCALL GreTextOutW(HDC,int,int,LPCWSTR,int);
 HFONT FASTCALL GreCreateFontIndirectW( LOGFONTW * );
 BOOL WINAPI GreGetTextMetricsW( _In_  HDC hdc, _Out_ LPTEXTMETRICW lptm);
index b8cdfc7..9c47a3e 100644 (file)
@@ -120,7 +120,7 @@ LONG TEXT_TabbedTextOut( HDC hdc,
             if (lpstr[j] == '\t') break;
         /* get the extent of the normal character part */
 #ifdef _WIN32K_
-        GreGetTextExtentW( hdc, (LPWSTR)lpstr + i, j - i , &extent, 0 );
+        GreGetTextExtentW( hdc, lpstr + i, j - i , &extent, 0 );
 #else
         GetTextExtentPointW( hdc, lpstr + i, j - i , &extent );
 #endif
@@ -169,7 +169,7 @@ LONG TEXT_TabbedTextOut( HDC hdc,
             r.bottom = y + extent.cy;
 #ifdef _WIN32K_
             GreExtTextOutW( hdc, x0, y, GreGetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
-                         &r, (LPWSTR)lpstr + i, j - i, NULL, 0 );
+                         &r, lpstr + i, j - i, NULL, 0 );
 #else
             ExtTextOutW( hdc, x0, y, GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
                          &r, lpstr + i, j - i, NULL );
@@ -1029,13 +1029,13 @@ static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int of
     HPEN hpen;
     HPEN oldPen;
 #ifdef _WIN32K_
-    GreGetTextExtentW (hdc, (LPWSTR)str, offset, &size, 0);
+    GreGetTextExtentW (hdc, str, offset, &size, 0);
 #else
     GetTextExtentPointW (hdc, str, offset, &size);
 #endif
     prefix_x = x + size.cx;
 #ifdef _WIN32K_
-    GreGetTextExtentW (hdc, (LPWSTR)str, offset+1, &size, 0);
+    GreGetTextExtentW (hdc, str, offset+1, &size, 0);
 #else
     GetTextExtentPointW (hdc, str, offset+1, &size);
 #endif
@@ -1276,7 +1276,7 @@ INT WINAPI DrawTextExWorker( HDC hdc,
                     len_seg = p - str;
                     if (len_seg != len &&
 #ifdef _WIN32K_
-                        !GreGetTextExtentW(hdc, (LPWSTR)str, len_seg, &size, 0))
+                        !GreGetTextExtentW(hdc, str, len_seg, &size, 0))
 #else
                         !GetTextExtentPointW(hdc, str, len_seg, &size))
 #endif
@@ -1295,7 +1295,7 @@ INT WINAPI DrawTextExWorker( HDC hdc,
                 if (!GreExtTextOutW( hdc, xseg, y,
                                     ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
                                     ((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
-                                    rect, (LPWSTR)str, len_seg, NULL, 0 ))
+                                    rect, str, len_seg, NULL, 0 ))
 #else
                 if (!ExtTextOutW( hdc, xseg, y,
                                  ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |