public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: guile-gtk@sources.redhat.com
Subject: gdk-image-new-bitmap and malloc
Date: Mon, 07 Jul 2003 22:31:00 -0000	[thread overview]
Message-ID: <87d6gmm0km.fsf@zip.com.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

A bit of a bug fix,

        * gdk-support.c (gdk_image_new_bitmap_interp): Copy data into a
        malloced block, as demanded by gdk_image_new_bitmap.


[-- Attachment #2: gdk-support.c.image-bitmap.diff --]
[-- Type: text/plain, Size: 794 bytes --]

--- gdk-support.c.~1.24.~	2003-06-19 11:03:47.000000000 +1000
+++ gdk-support.c	2003-07-07 17:56:13.000000000 +1000
@@ -1122,10 +1122,15 @@
 gdk_image_new_bitmap_interp (GdkVisual *visual, guchar data[], int count,
 			     gint width, gint height)
 {
+  static const char func_name[] = "gdk-image-new-bitmap";
+  gpointer  m_data;
   if (count * 8 < width * height)
-    scm_misc_error ("gdk-image-new-bitmap", "source bitmap is too small",
-		    SCM_EOL);
-  return gdk_image_new_bitmap (visual, data, width, height);
+    scm_misc_error (func_name, "source bitmap is too small", SCM_EOL);
+  m_data = malloc (count);
+  if (m_data == NULL)
+    scm_memory_error (func_name);
+  memcpy (m_data, data, count);
+  return gdk_image_new_bitmap (visual, m_data, width, height);
 }
 
 GdkBitmap *

                 reply	other threads:[~2003-07-07 22:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d6gmm0km.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=guile-gtk@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).