[ros-diffs] [cwittich] 23648: * some msvc /W4 fixes

cwittich at svn.reactos.org cwittich at svn.reactos.org
Tue Aug 22 22:06:30 CEST 2006


Author: cwittich
Date: Wed Aug 23 00:06:30 2006
New Revision: 23648

URL: http://svn.reactos.org/svn/reactos?rev=23648&view=rev
Log:
* some msvc /W4 fixes

Modified:
    trunk/reactos/base/applications/devmgr/devmgr.c
    trunk/reactos/base/applications/regedit/framewnd.c
    trunk/reactos/base/applications/regedit/hexedit.c
    trunk/reactos/base/applications/regedit/listview.c
    trunk/reactos/base/applications/regedit/regedit.c
    trunk/reactos/base/applications/regedit/regproc.c
    trunk/reactos/base/applications/regedit/treeview.c

Modified: trunk/reactos/base/applications/devmgr/devmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/devmgr/devmgr.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/devmgr/devmgr.c (original)
+++ trunk/reactos/base/applications/devmgr/devmgr.c Wed Aug 23 00:06:30 2006
@@ -362,6 +362,9 @@
 {
 MSG  msg;
 
+UNREFERENCED_PARAMETER(lpCmdLine);
+UNREFERENCED_PARAMETER(hInstance);
+
 g_hInst = hInstance;
 
 if(!hPrevInstance)
@@ -525,6 +528,8 @@
 {
 DWORD       dwStyle;
 
+UNREFERENCED_PARAMETER(hInstance);
+
 dwStyle =   WS_TABSTOP |
             WS_CHILD |
             WS_BORDER |
@@ -675,6 +680,8 @@
 
 void CreateButtons(HINSTANCE hInstance, HWND hwndParent)
 {
+
+	  UNREFERENCED_PARAMETER(hInstance);
 
 	  hwndButtonListByClass = CreateWindowEx (
 	          0,

Modified: trunk/reactos/base/applications/regedit/framewnd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/framewnd.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/framewnd.c (original)
+++ trunk/reactos/base/applications/regedit/framewnd.c Wed Aug 23 00:06:30 2006
@@ -735,7 +735,7 @@
             {
                 if (SelectionList->cItems == 1)
                 {
-                    UINT nlen = wcslen(SelectionList->aDsSelection[0].pwzName);
+                    size_t nlen = wcslen(SelectionList->aDsSelection[0].pwzName);
                     if (nlen >= uSize)
                     {
                         nlen = uSize - 1;

Modified: trunk/reactos/base/applications/regedit/hexedit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/hexedit.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/hexedit.c (original)
+++ trunk/reactos/base/applications/regedit/hexedit.c Wed Aug 23 00:06:30 2006
@@ -128,7 +128,7 @@
   GetClientRect(hed->hWndSelf, &rcClient);
   hed->style = GetWindowLong(hed->hWndSelf, GWL_STYLE);
 
-  bufsize = (hed->hBuffer ? LocalSize(hed->hBuffer) : 0);
+  bufsize = (hed->hBuffer ? (INT) LocalSize(hed->hBuffer) : 0);
   hed->nLines = max(bufsize / hed->ColumnsPerLine, 1);
   if(bufsize > hed->ColumnsPerLine && (bufsize % hed->ColumnsPerLine) > 0)
   {
@@ -340,7 +340,7 @@
     case HEHT_ADDRESS:
     case HEHT_ADDRESSSPACING:
     case HEHT_HEXDUMP:
-      pt.x -= hed->LeftMargin + ((4 + hed->AddressSpacing) * hed->CharWidth);
+      pt.x -= (SHORT) hed->LeftMargin + ((4 + hed->AddressSpacing) * hed->CharWidth);
       *EditField = TRUE;
       break;
 
@@ -356,7 +356,7 @@
     EditPos->x = min(hed->ColumnsPerLine, pt.x / BlockWidth);
   }
 
-  bufsize = (hed->hBuffer ? LocalSize(hed->hBuffer) : 0);
+  bufsize = (hed->hBuffer ? (DWORD) LocalSize(hed->hBuffer) : 0);
   Pos = (EditPos->y * hed->ColumnsPerLine) + EditPos->x;
   if(Pos > bufsize)
   {
@@ -433,7 +433,7 @@
 static LRESULT
 HEXEDIT_HEM_COPYBUFFER(PHEXEDIT_DATA hed, PVOID Buffer, DWORD Size)
 {
-  DWORD nCpy;
+  size_t nCpy;
 
   if(!hed->hBuffer)
   {
@@ -767,7 +767,7 @@
 static BOOL
 HEXEDIT_WM_KEYDOWN(PHEXEDIT_DATA hed, INT VkCode)
 {
-  DWORD bufsize;
+  size_t bufsize;
   BOOL shift, control;
 
   if(GetKeyState(VK_MENU) & 0x8000)
@@ -836,15 +836,15 @@
 	  hed->CaretLine++;
 	  if(hed->Position > (INT)bufsize)
 	  {
-	    hed->Position = bufsize;
+	    hed->Position = (INT) bufsize;
 	    hed->CaretLine = (hed->nLines > 0 ? hed->nLines - 1 : 0);
-	    hed->CaretCol = bufsize % hed->ColumnsPerLine;
+	    hed->CaretCol = (INT) bufsize % hed->ColumnsPerLine;
 	  }
 	}
 	else
 	{
-	  INT tmp = bufsize % hed->ColumnsPerLine;
-	  hed->Position = bufsize;
+	  INT tmp = (INT) bufsize % hed->ColumnsPerLine;
+	  hed->Position = (INT) bufsize;
 	  hed->CaretCol = (tmp == 0 ? hed->ColumnsPerLine : tmp);
 	}
       }

Modified: trunk/reactos/base/applications/regedit/listview.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/listview.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/listview.c (original)
+++ trunk/reactos/base/applications/regedit/listview.c Wed Aug 23 00:06:30 2006
@@ -50,7 +50,8 @@
 
 LPCTSTR GetValueName(HWND hwndLV, int iStartAt)
 {
-    int item, len, maxLen;
+    int item;
+	size_t len, maxLen;
     LPTSTR newStr;
     LVITEM LVItem;
     PLINE_INFO lineinfo;

Modified: trunk/reactos/base/applications/regedit/regedit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/regedit.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/regedit.c (original)
+++ trunk/reactos/base/applications/regedit/regedit.c Wed Aug 23 00:06:30 2006
@@ -90,7 +90,7 @@
         s++;
         ch = *s;
         ch2 = *(s+1);
-        chu = toupper(ch);
+        chu = (CHAR) toupper(ch);
         if (!ch2 || isspace(ch2)) {
             if (chu == 'S' || chu == 'V') {
                 /* ignore these switches */

Modified: trunk/reactos/base/applications/regedit/regproc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/regproc.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/regproc.c (original)
+++ trunk/reactos/base/applications/regedit/regproc.c Wed Aug 23 00:06:30 2006
@@ -315,7 +315,7 @@
 LPSTR getArg( LPSTR arg)
 {
     LPSTR tmp = NULL;
-    ULONG len;
+    size_t len;
 
     if (arg == NULL)
         return NULL;
@@ -339,9 +339,9 @@
  */
 static void REGPROC_unescape_string(LPSTR str)
 {
-    int str_idx = 0;            /* current character under analysis */
-    int val_idx = 0;            /* the last character of the unescaped string */
-    int len = strlen(str);
+    size_t str_idx = 0;            /* current character under analysis */
+    size_t val_idx = 0;            /* the last character of the unescaped string */
+    size_t len = strlen(str);
     for (str_idx = 0; str_idx < len; str_idx++, val_idx++) {
         if (str[str_idx] == '\\') {
             str_idx++;
@@ -391,7 +391,7 @@
 
     if ( dwParseType == REG_SZ)        /* no conversion for string */
     {
-        dwLen = strlen(val_data);
+        dwLen = (DWORD) strlen(val_data);
         if (dwLen>0 && val_data[dwLen-1]=='"')
         {
             dwLen--;
@@ -406,11 +406,11 @@
         lpbData = convert;
     } else                               /* Convert the hexadecimal types */
     {
-        int b_len = strlen (val_data)+2/3;
+        size_t b_len = strlen (val_data)+2/3;
         if (b_len > KEY_MAX_LEN) {
             bBigBuffer = HeapAlloc (GetProcessHeap(), 0, b_len);
             CHECK_ENOUGH_MEMORY(bBigBuffer);
-            dwLen = convertHexCSVToHex(val_data, bBigBuffer, b_len);
+            dwLen = convertHexCSVToHex(val_data, bBigBuffer, (ULONG) b_len);
             lpbData = bBigBuffer;
         } else {
             dwLen   = convertHexCSVToHex(val_data, convert, KEY_MAX_LEN);
@@ -873,7 +873,7 @@
 void processRegLines(FILE *in, CommandAPI command)
 {
     LPSTR line           = NULL;  /* line read from input stream */
-    ULONG lineSize       = REG_VAL_BUF_SIZE;
+    size_t lineSize       = REG_VAL_BUF_SIZE;
 
     line = HeapAlloc(GetProcessHeap(), 0, lineSize);
     CHECK_ENOUGH_MEMORY(line);
@@ -907,7 +907,7 @@
             /* Get as much as possible into the buffer, terminated either by
              * eof, error, eol or getting the maximum amount.  Abort on error.
              */
-            size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining);
+            size_to_get = (int) (size_remaining > INT_MAX ? INT_MAX : size_remaining);
             if (NULL == fgets (s, size_to_get, in)) {
                 if (ferror(in)) {
                     perror ("While reading input");
@@ -1146,7 +1146,7 @@
                        ) != ERROR_SUCCESS) {
         REGPROC_print_error();
     }
-    curr_len = strlen(*reg_key_name_buf);
+    curr_len = (DWORD) strlen(*reg_key_name_buf);
     REGPROC_resize_char_buffer(reg_key_name_buf, reg_key_name_len,
                                max_sub_key_len + curr_len + 1);
     REGPROC_resize_char_buffer(val_name_buf, val_name_len,
@@ -1223,8 +1223,8 @@
 
                     /* position of where the next character will be printed */
                     /* NOTE: yes, strlen("hex:") is used even for hex(x): */
-                    cur_pos = strlen("\"\"=") + strlen("hex:") +
-                              strlen(*val_name_buf);
+                    cur_pos = (int) (strlen("\"\"=") + strlen("hex:") +
+                              strlen(*val_name_buf));
 
                     fputs(hex_prefix, file);
                     for (i1 = 0; i1 < val_size1; i1++) {
@@ -1324,7 +1324,7 @@
         HKEY key;
 
         REGPROC_resize_char_buffer(&reg_key_name_buf, &reg_key_name_len,
-                                   strlen(reg_key_name));
+                                   (DWORD) strlen(reg_key_name));
         strcpy(reg_key_name_buf, reg_key_name);
 
         /* open the specified key */
@@ -1421,7 +1421,7 @@
                        ) != ERROR_SUCCESS) {
         REGPROC_print_error();
     }
-    curr_len = strlen(*reg_key_name_buf);
+    curr_len = (DWORD) strlen(*reg_key_name_buf);
     REGPROC_resize_char_buffer(reg_key_name_buf, reg_key_name_len,
                                max_sub_key_len + curr_len + 1);
 
@@ -1469,7 +1469,7 @@
     }
     branch_name = getRegKeyName(reg_key_name);
     CHECK_ENOUGH_MEMORY(branch_name);
-    branch_name_len = strlen(branch_name);
+    branch_name_len = (DWORD) strlen(branch_name);
     if (!branch_name[0]) {
         fprintf(stderr,"%s: Can't delete registry class '%s'\n",
                 getAppName(), reg_key_name);
@@ -1698,7 +1698,7 @@
     /* Try accessing a subkey */
     if (RegOpenKeyEx(hKey, lpSubKey, 0, KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS)
     {
-        cbName = iSubKeyLength - _tcslen(lpSubKey) - 1;
+        cbName = (DWORD) iSubKeyLength - _tcslen(lpSubKey) - 1;
         lResult = RegEnumKeyEx(hSubKey, 0, lpSubKey + _tcslen(lpSubKey) + 1,
             &cbName, NULL, NULL, NULL, &ft);
         RegCloseKey(hSubKey);

Modified: trunk/reactos/base/applications/regedit/treeview.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/treeview.c?rev=23648&r1=23647&r2=23648&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/treeview.c (original)
+++ trunk/reactos/base/applications/regedit/treeview.c Wed Aug 23 00:06:30 2006
@@ -37,7 +37,7 @@
 static BOOL get_item_path(HWND hwndTV, HTREEITEM hItem, HKEY* phKey, LPTSTR* pKeyPath, int* pPathLen, int* pMaxLen)
 {
     TVITEM item;
-    int maxLen, len;
+    size_t maxLen, len;
     LPTSTR newStr;
 
     item.mask = TVIF_PARAM;
@@ -60,11 +60,12 @@
         item.mask = TVIF_TEXT;
         item.hItem = hItem;
         item.pszText = *pKeyPath + *pPathLen;
-        item.cchTextMax = maxLen = *pMaxLen - *pPathLen;
+        maxLen = *pMaxLen - *pPathLen;
+        item.cchTextMax = (int) maxLen;
         if (!TreeView_GetItem(hwndTV, &item)) return FALSE;
         len = _tcslen(item.pszText);
 	if (len < maxLen - 1) {
-            *pPathLen += len;
+            *pPathLen += (int) len;
             break;
 	}
 	newStr = HeapReAlloc(GetProcessHeap(), 0, *pKeyPath, *pMaxLen * 2);
@@ -84,7 +85,7 @@
     if (!pathBuffer) pathBuffer = HeapAlloc(GetProcessHeap(), 0, 1024);
     if (!pathBuffer) return NULL;
     *pathBuffer = 0;
-    maxLen = HeapSize(GetProcessHeap(), 0, pathBuffer);
+    maxLen = (int) HeapSize(GetProcessHeap(), 0, pathBuffer);
     if (maxLen == -1) return NULL;
     if (!hItem) hItem = TreeView_GetSelection(hwndTV);
     if (!hItem) return NULL;
@@ -210,7 +211,7 @@
             if (!TreeView_GetItem(hwndTV, &tvItem))
                 goto done;
 
-            dwActualSize += _tcslen(&pszNodes[dwActualSize]) + 1;
+            dwActualSize += (DWORD) _tcslen(&pszNodes[dwActualSize]) + 1;
         }
 
         if (pszNodes)




More information about the Ros-diffs mailing list