@@ -395,7 +395,7 @@ struct blacklistitem {
395395};
396396struct blacklist {
397397 struct blacklistitem * items ;
398- unsigned length ;
398+ size_t length ;
399399 TCHAR * data ;
400400};
401401static struct {
@@ -475,7 +475,7 @@ static pure int blacklisted_from_names(const struct blacklist *list, const TCHAR
475475 UCHAR mode = list -> items [0 ].classname
476476 || list -> items [0 ].title
477477 || list -> items [0 ].exename ;
478- unsigned i = !mode ; // Skip the first item...
478+ size_t i = !mode ; // Skip the first item...
479479
480480 for ( ; i < list -> length ; i ++ ) {
481481 if (!lstrcmp_star (classname , list -> items [i ].classname )
@@ -758,15 +758,15 @@ BOOL CALLBACK EnumWindowsProc(HWND window, LPARAM lParam)
758758 }
759759 OffsetRectMDI (& rc );
760760 // Return if this window is overlapped by another window
761- unsigned i ;
761+
762762 unsigned flags = 0 ;
763763
764764 RECT bdrcL = { rc .left , rc .top , rc .left , rc .bottom };
765765 RECT bdrcT = { rc .left , rc .top , rc .right , rc .top };
766766 RECT bdrcR = { rc .right , rc .top , rc .right , rc .bottom };
767767 RECT bdrcB = { rc .left , rc .bottom , rc .right , rc .bottom };
768768
769- for (i = 0 ; i < wnds .num ; i ++ ) {
769+ for (size_t i = 0 ; i < wnds .num ; i ++ ) {
770770 if (RectInRect (& wnds .it [i ].rc , & rc )) {
771771 return TRUE;
772772 }
@@ -866,8 +866,7 @@ BOOL CALLBACK EnumTouchingWindows(HWND hwnd, LPARAM lParam)
866866 OffsetRectMDI (& wnd );
867867
868868 // Return if this window is overlapped by another window
869- unsigned i ;
870- for (i = 0 ; i < snwnds .num ; i ++ ) {
869+ for (size_t i = 0 ; i < snwnds .num ; i ++ ) {
871870 if (RectInRect (& snwnds .it [i ].rc , & wnd )) {
872871 return TRUE;
873872 }
@@ -917,7 +916,7 @@ static int ResizeTouchingWindows(LPVOID lwptr)
917916 if (conf .FullWin ) {
918917 hwndSS = BeginDeferWindowPos (snwnds .num + 1 );
919918 }
920- unsigned i ;
919+ size_t i ;
921920 for (i = 0 ; i < snwnds .num ; i ++ ) {
922921 RECT * nwnd = & snwnds .it [i ].rc ;
923922 unsigned flag = snwnds .it [i ].flag ;
@@ -972,8 +971,7 @@ static void ResizeAllSnappedWindows()
972971 if (!conf .StickyResize || !snwnds .num ) return ;
973972
974973 HDWP hwndSS = BeginDeferWindowPos (snwnds .num + 1 );
975- unsigned i ;
976- for (i = 0 ; i < snwnds .num ; i ++ ) {
974+ for (size_t i = 0 ; i < snwnds .num ; i ++ ) {
977975 if (hwndSS && snwnds .it [i ].flag & TORESIZE ) {
978976 RECT bd ;
979977 FixDWMRect (snwnds .it [i ].hwnd , & bd );
@@ -1085,7 +1083,7 @@ void MoveSnap(int *_posx, int *_posy, int wndwidth, int wndheight, UCHAR pth)
10851083 thresholdx = thresholdy = pth ; // conf.SnapThreshold;
10861084
10871085 // Loop monitors and windows
1088- unsigned i , j ;
1086+ size_t i , j ;
10891087 for (i = 0 , j = 0 ; i < monitors .num || j < wnds .num ; ) {
10901088 RECT snapwnd ;
10911089 UCHAR snapinside = 0 ;
@@ -1189,7 +1187,7 @@ static void ResizeSnap(int *posx, int *posy, int *wndwidth, int *wndheight, UCHA
11891187 EnumOnce (& borders );
11901188
11911189 // Loop monitors and windows
1192- unsigned i , j ;
1190+ size_t i , j ;
11931191 for (i = 0 , j = 0 ; i < monitors .num || j < wnds .num ;) {
11941192 RECT snapwnd ;
11951193 UCHAR snapinside ;
@@ -1504,7 +1502,7 @@ static void GetAeroSnappingMetrics(int *leftWidth, int *rightWidth, int *topHeig
15041502
15051503 // Check on all the other snapped windows from the bottom most
15061504 // To give precedence to the topmost windows
1507- unsigned i = snwnds .num ;
1505+ size_t i = snwnds .num ;
15081506 while (i -- ) {
15091507 unsigned flag = snwnds .it [i ].flag ;
15101508 const RECT * wnd = & snwnds .it [i ].rc ;
@@ -2936,7 +2934,7 @@ static int ScrollPointedWindow(POINT pt, int delta, WPARAM wParam)
29362934 VK_XBUTTON1 ,// MK_XBUTTON1 }, 32
29372935 VK_XBUTTON2 ,// MK_XBUTTON2 } 64
29382936 };
2939- unsigned i ;
2937+ size_t i ;
29402938 for (i = 0 ; i < ARR_SZ (toOr ); i ++ ) // Should we use GetKeyState?
29412939 if (GetAsyncKeyState (toOr [i ]) & 0x8000 ) wp |= (1 <<i );
29422940
@@ -3746,9 +3744,8 @@ static void SetEdgeAndOffset(const RECT *wnd, const POINT pt)
37463744
37473745static void NextBorders (RECT * pos , const RECT * cur , const RECT * def )
37483746{
3749- unsigned i ;
37503747 CopyRect (pos , def );
3751- for (i = 0 ; i < snwnds .num ; i ++ ) {
3748+ for (size_t i = 0 ; i < snwnds .num ; i ++ ) {
37523749 const RECT * rc = & snwnds .it [i ].rc ;
37533750 const unsigned flg = snwnds .it [i ].flag ;
37543751 POINT tpt ;
@@ -4366,8 +4363,7 @@ static void MinimizeAllOtherWindows(HWND hwnd, int CurrentMonOnly)
43664363 if (restore == hwnd ) {
43674364 // We have to restore all saved windows (minhwnds) when
43684365 // we click again on the same hwnd and have everything saved...
4369- unsigned i ;
4370- for (i = 0 ; i < minhwnds .num ; i ++ ) {
4366+ for (size_t i = 0 ; i < minhwnds .num ; i ++ ) {
43714367 HWND hrest = minhwnds .it [i ];
43724368 if (IsWindow (hrest )
43734369 && IsIconic (hrest )
@@ -4395,8 +4391,7 @@ static void MinimizeAllOtherWindows(HWND hwnd, int CurrentMonOnly)
43954391
43964392static pure BOOL IsRectInMonitors (const RECT * rc )
43974393{
4398- unsigned i ;
4399- for (i = 0 ; i < monitors .num ; i ++ ) {
4394+ for (size_t i = 0 ; i < monitors .num ; i ++ ) {
44004395 int inx = monitors .it [i ].left < rc -> right - 8 && rc -> left + 8 < monitors .it [i ].right ;
44014396 int iny = monitors .it [i ].top < rc -> bottom - 8 && rc -> top + 8 < monitors .it [i ].bottom ;
44024397 if (inx && iny ) // Windows is inside one of the monitors.
@@ -4506,7 +4501,7 @@ static void TrackMenuOfWindows(WNDENUMPROC EnumProc, LPARAM flags)
45064501
45074502 HMENU menu = CreatePopupMenu ();
45084503 state .unikeymenu = menu ;
4509- unsigned i ;
4504+ size_t i ;
45104505 TCHAR * const failed_string = TEXT ("---" );
45114506
45124507 struct menuitemdata data [36 ]; // Always fits into the stack
@@ -4557,7 +4552,7 @@ static void TrackMenuOfWindows(WNDENUMPROC EnumProc, LPARAM flags)
45574552 GetCursorPos (& pt );
45584553 BringWindowToTop (g_mchwnd );
45594554 SetForegroundWindow (g_mchwnd );
4560- i = (unsigned )TrackPopupMenu (menu ,
4555+ i = (size_t )TrackPopupMenu (menu ,
45614556 TPM_RETURNCMD /*|TPM_NONOTIFY*/ |GetSystemMetrics (SM_MENUDROPALIGNMENT )
45624557 , pt .x , pt .y , 0 , g_mchwnd , NULL );
45634558 state .mdiclient = mdiclient ;
@@ -6128,8 +6123,7 @@ LRESULT CALLBACK HotKeysWinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
61286123static void freeblacklists ()
61296124{
61306125 struct blacklist * list = (struct blacklist * )& BlkLst ;
6131- unsigned i ;
6132- for (i = 0 ; i < sizeof (BlkLst )/sizeof (struct blacklist ); i ++ ) {
6126+ for (size_t i = 0 ; i < sizeof (BlkLst )/sizeof (struct blacklist ); i ++ ) {
61336127 free (list -> data );
61346128 free (list -> items );
61356129 list ++ ;
@@ -6165,8 +6159,7 @@ __declspec(dllexport) void WINAPI Unload()
61656159 }
61666160 }
61676161
6168- unsigned ac ;
6169- for (ac = AC_MENU ; ac < AC_MAXVALUE ; ac ++ )
6162+ for (unsigned ac = AC_MENU ; ac < AC_MAXVALUE ; ac ++ )
61706163 UnregisterHotKey (g_mainhwnd , 0xC000 + ac );
61716164
61726165 EnumThreadWindows (GetCurrentThreadId (), PostPinWindowsProcMessage , WM_CLOSE );
@@ -6295,8 +6288,7 @@ void readallblacklists(const TCHAR *inipath)
62956288 GetPrivateProfileSection (TEXT ("Blacklist" ), section , blacklist_section_length , inipath );
62966289
62976290 struct blacklist * list = & BlkLst .Processes ;
6298- unsigned i ;
6299- for (i = 0 ; i < sizeof (BlkLst )/sizeof (struct blacklist ); i ++ ) {
6291+ for (size_t i = 0 ; i < sizeof (BlkLst )/sizeof (struct blacklist ); i ++ ) {
63006292 readblacklist (section , list + i , BlackListStrings [i ]);
63016293 }
63026294 free (section );
@@ -6307,7 +6299,7 @@ void readallblacklists(const TCHAR *inipath)
63076299static unsigned readhotkeys (const TCHAR * inisection , const char * name , const TCHAR * def , UCHAR * keys , unsigned MaxKeys )
63086300{
63096301 LPCTSTR txt = GetSectionOptionCStr (inisection , name , def );
6310- unsigned i = 0 ;
6302+ size_t i = 0 ;
63116303 if (!txt || !* txt ) return i ;
63126304 const TCHAR * pos = txt ;
63136305 while (* pos ) {
@@ -6343,8 +6335,7 @@ void readbuttonactions(const TCHAR *inputsection)
63436335 "MoveUp" , "ResizeUp" ,
63446336 };
63456337
6346- unsigned i ;
6347- for (i = 0 ; i < ARR_SZ (buttons ); i ++ ) {
6338+ for (size_t i = 0 ; i < ARR_SZ (buttons ); i ++ ) {
63486339 enum action * const actionptr = & conf .Mouse [0 ]; // first action in list
63496340
63506341 char key [32 ];
@@ -6374,7 +6365,7 @@ void readbuttonactions(const TCHAR *inputsection)
63746365 actionptr [NACPB * i + 7 ] = readaction (inputsection , key );
63756366 }
63766367
6377- for (i = 0 ; i < NACPB ; i ++ ) {
6368+ for (size_t i = 0 ; i < NACPB ; i ++ ) {
63786369 // ScrollUp
63796370 if (conf .Mouse [21 * NACPB + i ] == AC_NONE )
63806371 conf .Mouse [21 * NACPB + i ] = conf .Mouse [20 * NACPB + i ];
@@ -6455,8 +6446,8 @@ void registerAllHotkeys(const TCHAR* inipath)
64556446 #define ACVALUE (a , b , c ) (#b),
64566447 static const char * action_names [] = { ACTION_MAP };
64576448 #undef ACVALUE
6458- unsigned ac ;
6459- for (ac = AC_MENU ; ac < ARR_SZ (action_names ); ac ++ ) {
6449+
6450+ for (unsigned ac = AC_MENU ; ac < ARR_SZ (action_names ); ac ++ ) {
64606451 WORD HK = GetSectionOptionInt (inisection , action_names [ac ], 0 );
64616452 if (LOBYTE (HK ) && HIBYTE (HK )) {
64626453 // Lobyte is the virtual key code and hibyte is the mod_key
@@ -6477,20 +6468,18 @@ void registerAllHotkeys(const TCHAR* inipath)
64776468static void readalluchars (UCHAR * dest , const TCHAR * const inisection , const struct OptionListItem * optlist , size_t listlen )
64786469{
64796470 // Read all char options
6480- unsigned i ;
6481- for (i = 0 ; i < listlen ; i ++ ) {
6471+ for (size_t i = 0 ; i < listlen ; i ++ ) {
64826472 * dest ++ = GetSectionOptionInt (inisection , optlist [i ].name , optlist [i ].def );
64836473 }
64846474}
64856475void readallinputSequences (const TCHAR * inisection )
64866476{
64876477 UCHAR buf [512 ];
64886478 char shrtN [6 ] = "Shrt0" ;
6489- size_t i ;
64906479
64916480 mem00 (conf .inputSequences , sizeof (conf .inputSequences ));
64926481
6493- for (i = 0 ; i < ARR_SZ (conf .inputSequences ); i ++ ) {
6482+ for (size_t i = 0 ; i < ARR_SZ (conf .inputSequences ); i ++ ) {
64946483 shrtN [4 ] = i < 10 ? '0' + i : 'A' - 10 + i ;
64956484 unsigned len = readhotkeys (inisection , shrtN , TEXT ("" ), buf + 1 , 508 ) / 2 ;
64966485 buf [0 ] = len ;
@@ -6521,7 +6510,6 @@ __declspec(dllexport) WNDPROC WINAPI Load(HWND mainhwnd, const TCHAR *inipath)
65216510#pragma comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
65226511#endif
65236512 // Load settings
6524- unsigned i ;
65256513 state .action = AC_NONE ;
65266514 state .shift = 0 ;
65276515 state .moving = 0 ;
@@ -6629,7 +6617,7 @@ __declspec(dllexport) WNDPROC WINAPI Load(HWND mainhwnd, const TCHAR *inipath)
66296617 { "HScrollKey" , TEXT ("10" ), conf .HScrollKey }, // VK_SHIFT
66306618 { "ESCKeys" , TEXT ("1B" ), conf .ESCkeys }, // VK_ESCAPE = 1B
66316619 };
6632- for (i = 0 ; i < ARR_SZ (hklst ); i ++ ) {
6620+ for (size_t i = 0 ; i < ARR_SZ (hklst ); i ++ ) {
66336621 readhotkeys (inisection , hklst [i ].name , hklst [i ].def , hklst [i ].dst , MAXKEYS );
66346622 }
66356623 UCHAR eHKs [MAXKEYS + 1 ]; // Key to be sent at the end of a movment.
@@ -6640,7 +6628,7 @@ __declspec(dllexport) WNDPROC WINAPI Load(HWND mainhwnd, const TCHAR *inipath)
66406628 int nb = readhotkeys (inisection , "MenuAccelMap" , NULL , conf .MenuAccelMap , ARR_SZ (conf .MenuAccelMap ) - 1 );
66416629
66426630 // Fill the rest with usual accelerators
6643- for (i = nb ; i < ARR_SZ (conf .MenuAccelMap ); i ++ ) {
6631+ for (size_t i = nb ; i < ARR_SZ (conf .MenuAccelMap ); i ++ ) {
66446632 if (conf .NumberMenuItems )
66456633 conf .MenuAccelMap [i ] = i < 10 ? TEXT ('0' )+ i : TEXT ('A' )+ i - 10 ;
66466634 else
0 commit comments