]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/xwindow.c
(no commit message)
[imagemagick] / MagickCore / xwindow.c
index 248e497576f43b307504bcbda759cf3ee6627bd5..95d8ba1f3c5a635327f6eeb6a9d0387078253d12 100644 (file)
 %                       MagickCore X11 Utility Methods                        %
 %                                                                             %
 %                               Software Design                               %
-%                                 John Cristy                                 %
+%                                    Cristy                                   %
 %                                  July 1992                                  %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -1315,6 +1315,7 @@ MagickPrivate XVisualInfo *XBestVisualInfo(Display *display,
       */
       root_window=XRootWindow(display,XDefaultScreen(display));
       status=False;
+      number_maps=0;
       if (LocaleCompare(map_type,"list") != 0)
         {
           /*
@@ -2059,7 +2060,7 @@ MagickPrivate void XDisplayImageInfo(Display *display,
   */
   (void) IdentifyImage(image,file,MagickTrue,exception);
   (void) fclose(file);
-  text=FileToString(filename,~0,exception);
+  text=FileToString(filename,~0UL,exception);
   (void) RelinquishUniqueFileResource(filename);
   if (text == (char *) NULL)
     {
@@ -4433,17 +4434,20 @@ static Image *XGetWindowImage(Display *display,const Window window,
                 {
                   pixel=XGetPixel(ximage,x,y);
                   color=(pixel >> red_shift) & red_mask;
-                  color=(65535UL*color)/red_mask;
-                  SetPixelRed(composite_image,
-                    ScaleShortToQuantum((unsigned short) color),q);
+                  if (red_mask != 0)
+                    color=(65535UL*color)/red_mask;
+                  SetPixelRed(composite_image,ScaleShortToQuantum(
+                    (unsigned short) color),q);
                   color=(pixel >> green_shift) & green_mask;
-                  color=(65535UL*color)/green_mask;
-                  SetPixelGreen(composite_image,
-                    ScaleShortToQuantum((unsigned short) color),q);
+                  if (green_mask != 0)
+                    color=(65535UL*color)/green_mask;
+                  SetPixelGreen(composite_image,ScaleShortToQuantum(
+                    (unsigned short) color),q);
                   color=(pixel >> blue_shift) & blue_mask;
-                  color=(65535UL*color)/blue_mask;
-                  SetPixelBlue(composite_image,
-                    ScaleShortToQuantum((unsigned short) color),q);
+                  if (blue_mask != 0)
+                    color=(65535UL*color)/blue_mask;
+                  SetPixelBlue(composite_image,ScaleShortToQuantum(
+                    (unsigned short) color),q);
                   q+=GetPixelChannels(composite_image);
                 }
                 status=SyncCacheViewAuthenticPixels(composite_view,exception);
@@ -4942,7 +4946,7 @@ MagickExport Image *XImportImage(const ImageInfo *image_info,
           /*
             Select window by ID or name.
           */
-          if (isdigit((unsigned char) *image_info->filename) != 0)
+          if (isdigit((int) ((unsigned char) *image_info->filename)) != 0)
             target=XWindowByID(display,root,(Window)
               strtol(image_info->filename,(char **) NULL,0));
           if (target == (Window) NULL)
@@ -5295,7 +5299,7 @@ MagickPrivate XWindows *XInitializeWindows(Display *display,
   windows->group_leader.id=(Window) NULL;
   if (resource_info->window_group != (char *) NULL)
     {
-      if (isdigit((unsigned char) *resource_info->window_group) != 0)
+      if (isdigit((int) ((unsigned char) *resource_info->window_group)) != 0)
         windows->group_leader.id=XWindowByID(display,root_window,(Window)
           strtol((char *) resource_info->window_group,(char **) NULL,0));
       if (windows->group_leader.id == (Window) NULL)
@@ -8929,7 +8933,7 @@ MagickExport MagickBooleanType XRemoteCommand(Display *display,
       /*
         Search window hierarchy and identify any clients by name or ID.
       */
-      if (isdigit((unsigned char) *window) != 0)
+      if (isdigit((int) ((unsigned char) *window)) != 0)
         remote_window=XWindowByID(display,root_window,(Window)
           strtol((char *) window,(char **) NULL,0));
       if (remote_window == (Window) NULL)