[Xquartz-changes] xserver: Branch 'master' - 12 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Oct 19 09:13:29 PDT 2015


Rebased ref, commits from common ancestor:
commit 27ad21254f257bac6c647315d749ee69f20c24e0
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Oct 18 23:01:53 2015 -0700

    XQuartz: Cleanup formatting of DarwinEQInit that was butchered by automation a few years ago
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 0c8e7c4..5577297 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -367,14 +367,12 @@ DarwinEQInit(void)
 {
     int *p;
 
-    for (p = darwin_x11_modifier_mask_list, darwin_all_modifier_mask = 0; *p;
-         p++) {
+    for (p = darwin_x11_modifier_mask_list; *p; p++) {
         darwin_x11_modifier_mask |= *p;
     }
 
-    for (p = darwin_all_modifier_mask_additions,
-         darwin_all_modifier_mask = darwin_x11_modifier_mask;
-         *p; p++) {
+    darwin_all_modifier_mask = darwin_x11_modifier_mask;
+    for (p = darwin_all_modifier_mask_additions; *p; p++) {
         darwin_all_modifier_mask |= *p;
     }
 
@@ -387,7 +385,6 @@ DarwinEQInit(void)
      */
     if (!darwinEvents) {
         darwinEvents = InitEventList(GetMaximumEventsNum());
-        ;
 
         if (!darwinEvents)
             FatalError("Couldn't allocate event buffer\n");
commit 3db7e332d374bf8cee581c31b7d50d7ac0509187
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Oct 18 23:03:23 2015 -0700

    XQuartz: Make sure that darwin_all_modifier_mask_additions is 0-terminated
    
    Found by ASan
    
    X.Org X Server 1.17.99.901 Build Date: 20151018
    ================================================================
    ==40471==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000101fed7a4 at pc 0x000101584030 bp 0x70000029f920 sp 0x70000029f918
    READ of size 4 at 0x000101fed7a4 thread T7
        #0 0x10158402f in DarwinEQInit darwinEvents.c:377
        #1 0x10157f3bc in InitInput darwin.c:566
        #2 0x101be87ad in dix_main main.c:268
        #3 0x10159131b in server_thread quartzStartup.c:66
        #4 0x7fff8a535c12 in _pthread_body (/usr/lib/system/libsystem_pthread.dylib+0x3c12)
        #5 0x7fff8a535b8f in _pthread_start (/usr/lib/system/libsystem_pthread.dylib+0x3b8f)
        #6 0x7fff8a533374 in thread_start (/usr/lib/system/libsystem_pthread.dylib+0x1374)
    
    0x000101fed7a4 is located 0 bytes to the right of global variable 'darwin_all_modifier_mask_additions' defined in 'darwinEvents.c:181:12'
    (0x101fed7a0) of size 4
    SUMMARY: AddressSanitizer: global-buffer-overflow darwinEvents.c:377 DarwinEQInit
    Shadow bytes around the buggy address:
      0x1000203fdaa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdac0: f9 f9 f9 f9 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9
      0x1000203fdad0: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
      0x1000203fdae0: 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00 00 f9 f9 f9
    =>0x1000203fdaf0: f9 f9 f9 f9[04]f9 f9 f9 f9 f9 f9 f9 00 00 00 00
      0x1000203fdb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x1000203fdb40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa
      Heap right redzone:      fb
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack partial redzone:   f4
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
    Thread T7 created by T0 here:
        #0 0x10242ee99 in wrap_pthread_create
    (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib+0x37e99)
        #1 0x101591089 in create_thread quartzStartup.c:78
        #2 0x101590ed9 in QuartzInitServer quartzStartup.c:95
        #3 0x1015697eb in X11ApplicationMain X11Application.m:1277
        #4 0x101575dc0 in X11ControllerMain X11Controller.m:984
        #5 0x10159171a in server_main quartzStartup.c:127
        #6 0x101540fc0 in do_start_x11_server bundle-main.c:436
        #7 0x101544869 in _Xstart_x11_server mach_startupServer.c:189
        #8 0x101545c96 in mach_startup_server mach_startupServer.c:398
        #9 0x7fff8d1b70f3 in mach_msg_server (/usr/lib/system/libsystem_kernel.dylib+0x110f3)
        #10 0x1015416e7 in main bundle-main.c:774
        #11 0x7fff8bd975ac in start (/usr/lib/system/libdyld.dylib+0x35ac)
        #12 0x0  (<unknown module>)
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 9bf2f14..0c8e7c4 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -178,7 +178,7 @@ static int darwin_x11_modifier_mask_list[] = {
     0
 };
 
-static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, };
+static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, 0 };
 
 static void
 DarwinUpdateModifiers(int pressed,                    // KeyPress or KeyRelease
commit ec6294116cc41ff1c3be081b626952fb7e614244
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:52 2015 -0700

    osinit: Silence -Wunused-variable warnings
    
    osinit.c:161:24: warning: unused variable 'devnull' [-Wunused-variable,Unused Entity Issue]
        static const char *devnull = "/dev/null";
                           ^
    osinit.c:162:10: warning: unused variable 'fname' [-Wunused-variable,Unused Entity Issue]
        char fname[PATH_MAX];
             ^
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/os/osinit.c b/os/osinit.c
index ddd3fce..6ec2f11 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -158,8 +158,10 @@ void
 OsInit(void)
 {
     static Bool been_here = FALSE;
+#ifndef XQUARTZ
     static const char *devnull = "/dev/null";
     char fname[PATH_MAX];
+#endif
 
     if (!been_here) {
 #if !defined(WIN32) || defined(__CYGWIN__)
commit 0a5d54f721de7e3ab3b6f4b080190a92bbe3429b
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:51 2015 -0700

    dix: Silence -Wunused-variable warning by moving window.c off of legacy region defines
    
    window.c:223:15: warning: unused variable 'pScreen' [-Wunused-variable,Unused Entity Issue]
        ScreenPtr pScreen = pWin->drawable.pScreen;
                  ^
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/dix/window.c b/dix/window.c
index d57f320..69b5a7c 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -220,7 +220,6 @@ log_window_info(WindowPtr pWin, int depth)
     int i;
     const char *win_name, *visibility;
     BoxPtr rects;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
 
     for (i = 0; i < (depth << 2); i++)
         ErrorF(" ");
@@ -240,7 +239,7 @@ log_window_info(WindowPtr pWin, int depth)
         ErrorF(" (%s compositing: pixmap %x)",
                (pWin->redirectDraw == RedirectDrawAutomatic) ?
                "automatic" : "manual",
-               (unsigned) pScreen->GetWindowPixmap(pWin)->drawable.id);
+               (unsigned) pWin->drawable.pScreen->GetWindowPixmap(pWin)->drawable.id);
 #endif
 
     switch (pWin->visibility) {
@@ -259,10 +258,10 @@ log_window_info(WindowPtr pWin, int depth)
     }
     ErrorF(", %s", visibility);
 
-    if (REGION_NOTEMPTY(pScreen, &pWin->clipList)) {
+    if (RegionNotEmpty(&pWin->clipList)) {
         ErrorF(", clip list:");
-        rects = REGION_RECTS(&pWin->clipList);
-        for (i = 0; i < REGION_NUM_RECTS(&pWin->clipList); i++)
+        rects = RegionRects(&pWin->clipList);
+        for (i = 0; i < RegionNumRects(&pWin->clipList); i++)
             ErrorF(" [(%d, %d) to (%d, %d)]",
                    rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
         ErrorF("; extents [(%d, %d) to (%d, %d)]",
commit e09875701b980b8c4578fb310a922c9934c34eef
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:50 2015 -0700

    glx: Fix header length error checking in __glXDisp_RenderLarge
    
    glxcmds.c:2206:46: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare,Semantic Issue]
            if ((cmdlen = safe_pad(hdr->length)) < 0)
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index cbd4ede..0416dac 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2182,7 +2182,7 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
         __GLXrenderSizeData entry;
         int extra = 0;
         int left = (req->length << 2) - sz_xGLXRenderLargeReq;
-        size_t cmdlen;
+        int cmdlen;
         int err;
 
         /*
commit 5dc415048e4091b18cd7d123ebeae8f95ed5a4f5
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Oct 18 23:12:49 2015 -0700

    randr: Silence -Wshift-negative-value warnings
    
    rrtransform.c:199:23: warning: shifting a negative signed value is undefined [-Wshift-negative-value,Semantic Issue]
                rot_cos = F(-1);
                          ^~~~~
    rrtransform.c:114:14: note: expanded from macro 'F'
                    ^~~~~~~~~~~~~~
    ../render/picture.h:200:24: note: expanded from macro 'IntToxFixed'
                            ^~~~~~~~~~~~~~~~~~~~~~
    /opt/X11/include/pixman-1/pixman.h:130:56: note: expanded from macro 'pixman_int_to_fixed'
                                                               ~~~ ^
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 26b0649..d32b43a 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -196,7 +196,7 @@ RRTransformCompute(int x,
             f_rot_sin = 0;
             f_rot_dx = width;
             f_rot_dy = height;
-            rot_cos = F(-1);
+            rot_cos = F(~0u);
             rot_sin = F(0);
             rot_dx = F(width);
             rot_dy = F(height);
@@ -207,7 +207,7 @@ RRTransformCompute(int x,
             f_rot_dx = 0;
             f_rot_dy = width;
             rot_cos = F(0);
-            rot_sin = F(-1);
+            rot_sin = F(~0u);
             rot_dx = F(0);
             rot_dy = F(width);
             break;
@@ -230,7 +230,7 @@ RRTransformCompute(int x,
         scale_dy = 0;
         if (rotation & RR_Reflect_X) {
             f_scale_x = -1;
-            scale_x = F(-1);
+            scale_x = F(~0u);
             if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
                 f_scale_dx = width;
                 scale_dx = F(width);
@@ -242,7 +242,7 @@ RRTransformCompute(int x,
         }
         if (rotation & RR_Reflect_Y) {
             f_scale_y = -1;
-            scale_y = F(-1);
+            scale_y = F(~0u);
             if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
                 f_scale_dy = height;
                 scale_dy = F(height);
commit 9a2a05a9a7ba02921fa29844c4cad41243c41326
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:42 2015 -0700

    xdmcp: Declare XdmcpFatal _X_NORETURN
    
    xdmcp.c:1404:1: warning: function 'XdmcpFatal' could be declared with attribute 'noreturn'
    [-Wmissing-noreturn,Semantic Issue]
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/os/xdmcp.c b/os/xdmcp.c
index 7939b41..5bdcbe9 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -1399,6 +1399,7 @@ recv_alive_msg(unsigned length)
     }
 }
 
+_X_NORETURN
 static void
 XdmcpFatal(const char *type, ARRAY8Ptr status)
 {
commit a7a00e4bd8153e0386c7e58d6b30a7a96f15fdb0
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:39 2015 -0700

    security: Silence some benign -Wformat warnings
    
    XID may be either 'unsigned long' or 'unsigned int' depending on:
    
    typedef unsigned long CARD64;
    typedef unsigned int CARD32;
    typedef unsigned long long CARD64;
    typedef unsigned long CARD32;
    
    typedef unsigned long XID;
    typedef CARD32 XID;
    
    so when building with -Wformat, we get some warnings that are benign.  This silences them.
    
    security.c:215:52: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
        SecurityAudit("revoked authorization ID %d\n", pAuth->id);
                                                ~~     ^~~~~~~~~
                                                %lu
      CC       dpmsstubs.lo
    security.c:553:25: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
                            ^~~~~~~~~
    security.c:553:55: warning: format specifies type 'int' but the argument has type 'CARD32' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
                                                          ^~~~~~~~~~~~~~
    security.c:554:10: warning: format specifies type 'int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             pAuth->group, eventMask);
             ^~~~~~~~~~~~
    security.c:554:24: warning: format specifies type 'int' but the argument has type 'Mask' (aka 'unsigned long')
          [-Wformat,Format String Issue]
             pAuth->group, eventMask);
                           ^~~~~~~~~
    security.c:781:19: warning: format specifies type 'unsigned int' but the argument has type 'Mask' (aka 'unsigned
    long')
          [-Wformat,Format String Issue]
                      requested, rec->id, cid,
                      ^~~~~~~~~
    security.c:781:30: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                      requested, rec->id, cid,
                                 ^~~~~~~
    security.c:863:23: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                          rec->pWin->drawable.id, wClient(rec->pWin)->index,
                          ^~~~~~~~~~~~~~~~~~~~~~
    security.c:893:31: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                                  rec->pWin->drawable.id,
                                  ^~~~~~~~~~~~~~~~~~~~~~
    security.c:915:39: warning: format specifies type 'unsigned int' but the argument has type 'XID' (aka 'unsigned long')
          [-Wformat,Format String Issue]
                      rec->client->index, rec->pWin->drawable.id,
                                          ^~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/Xext/security.c b/Xext/security.c
index cce7c46..04382ff 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -212,7 +212,7 @@ SecurityDeleteAuthorization(void *value, XID id)
                 CloseDownClient(clients[i]);
         }
 
-    SecurityAudit("revoked authorization ID %d\n", pAuth->id);
+    SecurityAudit("revoked authorization ID %lu\n", (unsigned long)pAuth->id);
     free(pAuth);
     return Success;
 
@@ -549,9 +549,9 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
     WriteToClient(client, authdata_len, pAuthdata);
 
     SecurityAudit
-        ("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
-         client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
-         pAuth->group, eventMask);
+        ("client %d generated authorization %lu trust %d timeout %lu group %lu events %lu\n",
+         client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned long)pAuth->timeout,
+         (unsigned long)pAuth->group, (unsigned long)eventMask);
 
     /* the request succeeded; don't call RemoveAuthorization or free pAuth */
     return Success;
@@ -776,9 +776,9 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
             return;
     }
 
-    SecurityAudit("Security: denied client %d access %x to resource 0x%x "
+    SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
                   "of client %d on request %s\n", rec->client->index,
-                  requested, rec->id, cid,
+                  (unsigned long)requested, (unsigned long)rec->id, cid,
                   SecurityLookupRequestName(rec->client));
     rec->status = BadAccess;    /* deny access */
 }
@@ -858,9 +858,9 @@ SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
 
     if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
         SecurityAudit("Security: denied client %d access to property %s "
-                      "(atom 0x%x) window 0x%x of client %d on request %s\n",
+                      "(atom 0x%x) window 0x%lx of client %d on request %s\n",
                       rec->client->index, NameForAtom(name), name,
-                      rec->pWin->drawable.id, wClient(rec->pWin)->index,
+                      (unsigned long)rec->pWin->drawable.id, wClient(rec->pWin)->index,
                       SecurityLookupRequestName(rec->client));
         rec->status = BadAccess;
     }
@@ -887,10 +887,10 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
                 rec->events[i].u.u.type != ClientMessage) {
 
                 SecurityAudit("Security: denied client %d from sending event "
-                              "of type %s to window 0x%x of client %d\n",
+                              "of type %s to window 0x%lx of client %d\n",
                               rec->client->index,
                               LookupEventName(rec->events[i].u.u.type),
-                              rec->pWin->drawable.id,
+                              (unsigned long)rec->pWin->drawable.id,
                               wClient(rec->pWin)->index);
                 rec->status = BadAccess;
                 return;
@@ -911,8 +911,8 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
         return;
 
     SecurityAudit("Security: denied client %d from receiving an event "
-                  "sent to window 0x%x of client %d\n",
-                  rec->client->index, rec->pWin->drawable.id,
+                  "sent to window 0x%lx of client %d\n",
+                  rec->client->index, (unsigned long)rec->pWin->drawable.id,
                   wClient(rec->pWin)->index);
     rec->status = BadAccess;
 }
commit aa73d587fece225753d8e6b8773a9c8b85823bd9
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:38 2015 -0700

    xres: Silence -Wunused-function warnings when building !COMPOSITE or !RENDER
    
    xres.c:422:1: warning: unused function 'ResFindCompositeClientWindowPixmaps' [-Wunused-function,Unused Entity Issue]
    ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
    ^
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/Xext/xres.c b/Xext/xres.c
index 6b87c3d..83cc691 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -410,21 +410,21 @@ ResFindGCPixmaps(void *value, XID id, void *cdata)
         *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
 }
 
+#ifdef RENDER
 static void
 ResFindPicturePixmaps(void *value, XID id, void *cdata)
 {
-#ifdef RENDER
     ResFindResourcePixmaps(value, id, PictureType, cdata);
-#endif
 }
+#endif
 
+#ifdef COMPOSITE
 static void
 ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
 {
-#ifdef COMPOSITE
     ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
-#endif
 }
+#endif
 
 static int
 ProcXResQueryClientPixmapBytes(ClientPtr client)
commit 85eb90ea45e89033b97bf71a13c5c70fec8f6871
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:36 2015 -0700

    xdmauth: Correct miscall of abs() to instrad call labs()
    
    xdmauth.c:230:13: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of
    type
    'int'
          which may cause truncation of value [-Wabsolute-value,Semantic Issue]
            if (abs(now - client->time) > TwentyFiveMinutes) {
                ^
    xdmauth.c:230:13: note: use function 'labs' instead [Semantic Issue]
            if (abs(now - client->time) > TwentyFiveMinutes) {
                ^~~
                labs
    xdmauth.c:302:9: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type
    'int' which
          may cause truncation of value [-Wabsolute-value,Semantic Issue]
        if (abs(client->time - now) > TwentyMinutes) {
            ^
    xdmauth.c:302:9: note: use function 'labs' instead [Semantic Issue]
        if (abs(client->time - now) > TwentyMinutes) {
            ^~~
            labs
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/os/xdmauth.c b/os/xdmauth.c
index f11cbb9..482bc67 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -227,7 +227,7 @@ XdmClientAuthTimeout(long now)
     prev = 0;
     for (client = xdmClients; client; client = next) {
         next = client->next;
-        if (abs(now - client->time) > TwentyFiveMinutes) {
+        if (labs(now - client->time) > TwentyFiveMinutes) {
             if (prev)
                 prev->next = next;
             else
@@ -299,7 +299,7 @@ XdmAuthorizationValidate(unsigned char *plain, int length,
     }
     now += clockOffset;
     XdmClientAuthTimeout(now);
-    if (abs(client->time - now) > TwentyMinutes) {
+    if (labs(client->time - now) > TwentyMinutes) {
         free(client);
         if (reason)
             *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
commit 9f0fcd14b52f8481cbb3b3b9c6e06f64ff003cc8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:35 2015 -0700

    randr: Correct a miscall of abs() to instead call fabs()
    
    rrtransform.c:124:22: warning: using integer absolute value function 'abs' when
          argument is of floating point type [-Wabsolute-value,Semantic Issue]
                if ((v = abs(f_transform->m[j][i])) > max)
                         ^
    rrtransform.c:124:22: note: use function 'fabs' instead [Semantic Issue]
                if ((v = abs(f_transform->m[j][i])) > max)
                         ^~~
                         fabs
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 6137f85..26b0649 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -121,7 +121,7 @@ RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
 
     for (j = 0; j < 3; j++)
         for (i = 0; i < 3; i++)
-            if ((v = abs(f_transform->m[j][i])) > max)
+            if ((v = fabs(f_transform->m[j][i])) > max)
                 max = v;
     scale = limit / max;
     for (j = 0; j < 3; j++)
commit 610dd8a58a75bb6a5b7d7abbae476d1cc4be519e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Oct 14 15:13:34 2015 -0700

    mi: Correct a miscall of abs() to instead call fabs()
    
    miarc.c:1714:9: warning: using integer absolute value function
    'abs' when
          argument is of floating point type [-Wabsolute-value,Semantic Issue]
        if (abs(parc->angle2) >= 360.0)
            ^
    miarc.c:1714:9: note: use function 'fabs' instead [Semantic Issue]
        if (abs(parc->angle2) >= 360.0)
            ^~~
            fabs
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index 5e854b3..2588ee4 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1711,7 +1711,7 @@ miGetArcPts(SppArcPtr parc,     /* points to an arc */
         y1 = y2;
     }
     /* adjust the last point */
-    if (abs(parc->angle2) >= 360.0)
+    if (fabs(parc->angle2) >= 360.0)
         poly[cpt + i - 1] = poly[0];
     else {
         poly[cpt + i - 1].x = (miDcos(st + et) * parc->width / 2.0 + xc);


More information about the Xquartz-changes mailing list