repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 761303824752effaa3d7c9f9b2eeb0548c912045:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 761303824752effaa3d7c9f9b2eeb0548c912045
Author: Marc Lehmann 
Date:   Thu May 17 20:05:55 2012 +0000

    *** empty log message ***

diff --git a/src/rxvtfont.C b/src/rxvtfont.C
index 3813b7c6922f395952cdc423b947536c04f4ecf7..
index ..c1ea1b5a8ba9f8ebf7252e398c829f29b42e905d 100644
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -1787,14 +1787,7 @@ found:

       if (!fmap[hi])
         {
-          // we use [1] here because C++ has no separate new and new [] forms,
-          // and pagemap is char[256], so new incorrectly assumes we want to
-          // allocate an array of chars instead of a single pagemap.
-          // we can either cast the resulting pointer to (pagemap *) or
-          // allocate an array of pagemaps, returning a pointer to the first member
-          // this is no extra overhead, as new even allocates an array for
-          // "new pagemap"
-          fmap[hi] = new pagemap[1];
+          fmap[hi] = new pagemap;
           memset (fmap[hi], 0xff, sizeof (pagemap));
         }

diff --git a/src/rxvtfont.h b/src/rxvtfont.h
index 60b356b85e34fe2a2f56af320ac5ec852245e3ae..
index ..3652d32026d9d504beae1d07dc3882aee358a912 100644
--- a/src/rxvtfont.h
+++ b/src/rxvtfont.h
@@ -108,7 +108,18 @@ private:
   simplevec fonts;
   const rxvt_fallback_font *fallback;

-  typedef unsigned char pagemap[256];
+  // this once was a "typedef xxx pagemap[256]
+  // but c++ arrays are not normal types, and cnanot be
+  // put into containers, new doesn't work for them etc. etc.
+  // so we wrap out array into an objetc that acts like one. doh.
+  // example: C++ has no separate new and new [] forms,
+  // and if pagemap is char[256], new incorrectly assumes we want to
+  // allocate an array of chars instead of a single pagemap.
+  struct pagemap
+  {
+    unsigned char cppsucks[256];
+    unsigned char &operator [](int i) { return cppsucks [i]; };
+  };
   vector fmap;

   void clear ();

-----END OF PAGE-----