Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dix/screenint_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static inline ScreenPtr dixGetMasterScreen(void) {
* @return pointer to idx'th screen or NULL
*/
static inline ScreenPtr dixGetScreenPtr(unsigned int idx) {
if (idx < screenInfo.numScreens)
if (idx < (unsigned int)screenInfo.numScreens)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what’s the best way of fixing that. Alternatively we could make the index signed. Or make numScreens unsigned if that doesn’t break the ABI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that making the index signed is better, since it gives the compiler more room for optimization.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I've been planning to make this unsigned some day - but we yet have to make sure this wouldn't cause any ABI break (because it's part of the ABI).

return screenInfo.screens[idx];
return NULL;
}
Expand All @@ -52,7 +52,7 @@ static inline ScreenPtr dixGetScreenPtr(unsigned int idx) {
* @return TRUE if the screen at this index exists
*/
static inline bool dixScreenExists(unsigned int idx) {
return ((idx < screenInfo.numScreens) &&
return ((idx < (unsigned int)screenInfo.numScreens) &&
(screenInfo.screens[idx] != NULL));
}

Expand All @@ -65,7 +65,7 @@ static inline bool dixScreenExists(unsigned int idx) {
*/
#define DIX_FOR_EACH_SCREEN(__LAMBDA__) \
do { \
for (unsigned walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) { \
for (int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) { \
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx]; \
(void)walkScreen; \
__LAMBDA__; \
Expand Down Expand Up @@ -103,7 +103,7 @@ static inline bool dixScreenExists(unsigned int idx) {
*/
#define DIX_FOR_EACH_GPU_SCREEN(__LAMBDA__) \
do { \
for (unsigned walkScreenIdx = 0; walkScreenIdx < screenInfo.numGPUScreens; walkScreenIdx++) { \
for (int walkScreenIdx = 0; walkScreenIdx < screenInfo.numGPUScreens; walkScreenIdx++) { \
ScreenPtr walkScreen = screenInfo.gpuscreens[walkScreenIdx]; \
(void)walkScreen; \
__LAMBDA__; \
Expand Down