diff src/glyphs-msw.c @ 5125:b5df3737028a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 01:58:04 -0600
parents ae48681c47fa
children 07dcc7000bbf
line wrap: on
line diff
--- a/src/glyphs-msw.c	Wed Jan 20 07:05:57 2010 -0600
+++ b/src/glyphs-msw.c	Wed Feb 24 01:58:04 2010 -0600
@@ -202,7 +202,7 @@
 
       if (!bmp_data)
 	{
-	  xfree (bmp_info, BITMAPINFO *);
+	  xfree (bmp_info);
 	  return NULL;
 	}
 
@@ -233,7 +233,7 @@
 					     sizeof(RGBQUAD) * ncolors);
       if (!bmp_info)
 	{
-	  xfree (qtable, quant_table *);
+	  xfree (qtable);
 	  return NULL;
 	}
 
@@ -251,8 +251,8 @@
 
       if (!*bmp_data)
 	{
-	  xfree (qtable, quant_table *);
-	  xfree (bmp_info, BITMAPINFO *);
+	  xfree (qtable);
+	  xfree (bmp_info);
 	  return NULL;
 	}
 
@@ -279,7 +279,7 @@
 	      *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl);
 	    }
 	}
-      xfree (qtable, quant_table *);
+      xfree (qtable);
     }
   /* fix up the standard stuff */
   bmp_info->bmiHeader.biWidth = width;
@@ -474,8 +474,8 @@
 	image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice,
 				     instantiator);
 
-      xfree (bmp_info, BITMAPINFO *);
-      xfree (bmp_data, Binbyte *);
+      xfree (bmp_info);
+      xfree (bmp_data);
     }
 }
 
@@ -543,7 +543,7 @@
 				 (void **) (void *) &and_bits,
 				 0,0)))
     {
-      xfree (bmp_info, BITMAPINFO *);
+      xfree (bmp_info);
       return;
     }
 
@@ -570,7 +570,7 @@
 		 bmp_info,
 		 DIB_RGB_COLORS) <= 0)
     {
-      xfree (bmp_info, BITMAPINFO *);
+      xfree (bmp_info);
       return;
     }
 
@@ -602,8 +602,8 @@
 	     bmp_info,
 	     DIB_RGB_COLORS);
 
-  xfree (bmp_info, BITMAPINFO *);
-  xfree (dibits, Binbyte *);
+  xfree (bmp_info);
+  xfree (dibits);
 
   SelectObject(hcdc, old);
 
@@ -854,7 +854,7 @@
   colortbl = xnew_array_and_zero (COLORREF, xpmimage.ncolors);
   if (!colortbl)
     {
-      xfree (*data, Binbyte *);
+      xfree (*data);
       XpmFreeXpmImage (&xpmimage);
       XpmFreeXpmInfo (&xpminfo);
       return 0;
@@ -910,8 +910,8 @@
 	}
 
     label_no_color:
-      xfree (*data, Binbyte *);
-      xfree (colortbl, COLORREF *);
+      xfree (*data);
+      xfree (colortbl);
       XpmFreeXpmImage (&xpmimage);
       XpmFreeXpmInfo (&xpminfo);
       return 0;
@@ -937,7 +937,7 @@
 
   XpmFreeXpmImage (&xpmimage);
   XpmFreeXpmInfo (&xpminfo);
-  xfree (colortbl, COLORREF *);
+  xfree (colortbl);
   return TRUE;
 }
 
@@ -968,9 +968,7 @@
 
   assert (!NILP (data));
 
-  TO_EXTERNAL_FORMAT (LISP_STRING, data,
-		      ALLOCA, (bytes, len),
-		      Qbinary);
+  LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary);
 
   /* in case we have color symbols */
   color_symbols = extract_xpm_color_names (device, domain,
@@ -988,9 +986,9 @@
     {
       while (nsymbols--)
 	{
-	  xfree (color_symbols[nsymbols].name, Ibyte *);
+	  xfree (color_symbols[nsymbols].name);
 	}
-      xfree(color_symbols, struct color_symbol *);
+      xfree (color_symbols);
     }
 
   /* build a bitmap from the eimage */
@@ -1000,15 +998,15 @@
       signal_image_error ("XPM to EImage conversion failed",
 			  image_instance);
     }
-  xfree (eimage, Binbyte *);
+  xfree (eimage);
 
   /* Now create the pixmap and set up the image instance */
   init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
 				     bmp_data, bmp_bits, 1, instantiator,
 				     x_hot, y_hot, transp);
 
-  xfree (bmp_info, BITMAPINFO *);
-  xfree (bmp_data, Binbyte *);
+  xfree (bmp_info);
+  xfree (bmp_data);
 }
 #endif /* HAVE_XPM */
 
@@ -1055,9 +1053,7 @@
 
   assert (!NILP (data));
 
-  TO_EXTERNAL_FORMAT (LISP_STRING, data,
-		      ALLOCA, (bytes, len),
-		      Qbinary);
+  LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary);
 
   /* Then slurp the image into memory, decoding along the way.
      The result is the image in a simple one-byte-per-pixel
@@ -1101,7 +1097,7 @@
 
 typedef struct
 {
-  CIbyte *name;
+  const Ascbyte *name;
   int	resource_id;
 } resource_t;
 
@@ -1243,7 +1239,7 @@
     {
       Extbyte *fname;
 
-      LOCAL_FILE_FORMAT_TO_TSTR (file, fname);
+      LISP_LOCAL_FILE_FORMAT_TO_TSTR (file, fname);
 
       if (NILP (resource_id))
 	resid = fname;
@@ -1254,7 +1250,7 @@
 							      type));
 
 	  if (!resid)
-	    LISP_STRING_TO_TSTR (resource_id, resid);
+	    resid = LISP_STRING_TO_TSTR (resource_id);
 	}
     }
   else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id,
@@ -1361,7 +1357,7 @@
 
   if (!new_data)
     {
-      xfree (bmp_info, BITMAPINFO *);
+      xfree (bmp_info);
       return NULL;
     }
 
@@ -1412,17 +1408,17 @@
 			     &bmp_buf,
 			     0,0);
 
-  xfree (bmp_info, BITMAPINFO *);
+  xfree (bmp_info);
 
   if (!bitmap || !bmp_buf)
     {
-      xfree (new_data, Binbyte *);
+      xfree (new_data);
       return NULL;
     }
 
   /* copy in the actual bitmap */
   memcpy (bmp_buf, new_data, height * new_width);
-  xfree (new_data, Binbyte *);
+  xfree (new_data);
 
   return bitmap;
 }
@@ -1573,9 +1569,9 @@
     {
       Binbyte *ext_data;
 
-      TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (mask_data))),
-			  C_STRING_ALLOCA, ext_data,
-			  Qbinary);
+      ext_data =
+	(Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))),
+					     Qbinary);
       mask = xbm_create_bitmap_from_data (hdc,
 					  ext_data,
 					  XINT (XCAR (mask_data)),
@@ -1603,9 +1599,9 @@
 
   assert (!NILP (data));
 
-  TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (XCDR (XCDR (data))),
-		      C_STRING_ALLOCA, ext_data,
-		      Qbinary);
+  ext_data =
+    (const Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))),
+					       Qbinary);
 
   xbm_instantiate_1 (image_instance, instantiator, pointer_fg,
 		     pointer_bg, dest_mask, XINT (XCAR (data)),
@@ -1650,9 +1646,7 @@
 
   assert (!NILP (data));
 
-  TO_EXTERNAL_FORMAT (LISP_STRING, data,
-		      C_STRING_ALLOCA, dstring,
-		      Qbinary);
+  dstring = (const Binbyte *) LISP_STRING_TO_EXTERNAL (data, Qbinary);
 
   if ((p = (Binbyte *) strchr ((char *) dstring, ':')))
     {
@@ -1724,7 +1718,7 @@
 	  write_fmt_string (printcharfun, "/0x%lx",
 			    (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p));
 	}
-      write_c_string (printcharfun, ")");
+      write_ascstring (printcharfun, ")");
       break;
 
     default:
@@ -1784,7 +1778,7 @@
 		    DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i));
 		  IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i) = 0;
 		}
-	      xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p), HBITMAP *);
+	      xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p));
 	      IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p) = 0;
 	    }
 	  if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
@@ -1798,7 +1792,7 @@
 
   if (p->data)
     {
-      xfree (p->data, void *);
+      xfree (p->data);
       p->data = 0;
     }
 }
@@ -2032,7 +2026,7 @@
       && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (p)))
     {
       Extbyte *lparam = 0;
-      LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p), lparam);
+      lparam = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p));
       qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
 		      WM_SETTEXT, 0, (LPARAM) lparam);
     }
@@ -2146,7 +2140,7 @@
 			  GWL_HINSTANCE),
 			 NULL);
 
-  qxeSetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance));
+  qxeSetWindowLong (wnd, GWL_USERDATA, (LONG)STORE_LISP_IN_VOID(image_instance));
   IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd;
 }
 
@@ -2250,7 +2244,7 @@
     }
 
   if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
-    LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm);
+    nm = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii));
 
   /* allocate space for the clip window and then allocate the clip window */
   ii->data = xnew_and_zero (struct mswindows_subwindow_data);
@@ -2272,7 +2266,7 @@
     gui_error ("window creation failed with code",
 	       make_int (GetLastError()));
 
-  C_STRING_TO_TSTR (class_, classext);
+  classext = ITEXT_TO_TSTR (class_);
 
   if ((wnd = qxeCreateWindowEx (exflags /* | WS_EX_NOPARENTNOTIFY*/,
 				classext,
@@ -2294,7 +2288,7 @@
 	       make_int (GetLastError()));
 
   IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd;
-  qxeSetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance));
+  qxeSetWindowLong (wnd, GWL_USERDATA, (LONG)STORE_LISP_IN_VOID(image_instance));
   /* set the widget font from the widget face */
   if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
     qxeSendMessage (wnd, WM_SETFONT,
@@ -2486,10 +2480,11 @@
       tvitem.item.lParam =
 	mswindows_register_gui_item (image_instance, item, domain);
       tvitem.item.mask |= TVIF_PARAM;
-      LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name, tvitem.item.pszText);
+      tvitem.item.pszText =
+	(LPWSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name);
     }
   else
-    LISP_STRING_TO_TSTR (item, tvitem.item.pszText);
+    tvitem.item.pszText = (LPWSTR) LISP_STRING_TO_TSTR (item);
       
   tvitem.item.cchTextMax = qxetcslen ((Extbyte *) tvitem.item.pszText);
       
@@ -2602,12 +2597,12 @@
       tcitem.lParam =
 	mswindows_register_gui_item (image_instance, item, domain);
       tcitem.mask |= TCIF_PARAM;
-      LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name, tcitem.pszText);
+      tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name);
     }
   else
     {
       CHECK_STRING (item);
-      LISP_STRING_TO_TSTR (item, tcitem.pszText);
+      tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (item);
     }
 
   tcitem.cchTextMax = qxetcslen ((Extbyte *) tcitem.pszText);
@@ -2813,7 +2808,7 @@
   LIST_LOOP (rest, items)
     {
       Extbyte *lparam;
-      LISP_STRING_TO_TSTR (XCAR (rest), lparam);
+      lparam = LISP_STRING_TO_TSTR (XCAR (rest));
       if (qxeSendMessage (wnd, CB_ADDSTRING, 0, (LPARAM)lparam) == CB_ERR)
 	gui_error ("error adding combo entries", instantiator);
     }
@@ -2930,8 +2925,7 @@
       SIZE size;
 
       SelectObject (hdc, mswindows_widget_hfont (face, domain, string));
-      TO_EXTERNAL_FORMAT (LISP_STRING, string, ALLOCA, (str, len),
-			  Qmswindows_tstr);
+      LISP_STRING_TO_SIZED_EXTERNAL (string, str, len, Qmswindows_tstr);
       qxeGetTextExtentPoint32 (hdc, str, len / XETCHAR_SIZE, &size);
       *width = size.cx;
     }