parrgar21 / heekscad

Automatically exported from code.google.com/p/heekscad
Other
0 stars 0 forks source link

glfont.cpp has endian problems #226

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, 

I built heekscad on my Powerbook under OSX. I noticed an endianess problem
with gl fonts. This can be solved with the following patch.

Cheers Torsten

--- glfont2.cpp.orig    2009-12-01 22:36:05.000000000 +0100
+++ glfont2.cpp 2009-11-30 22:32:01.000000000 +0100
@@ -22,6 +22,16 @@
 #include "glfont2.h"
 using namespace glfont;

+#ifdef __BIG_ENDIAN__
+inline void endian_swap(int& x)
+{
+    x = (x>>24) | 
+        ((x<<8) & 0x00FF0000) |
+        ((x>>8) & 0x0000FF00) |
+        (x<<24);
+}
+#endif
+
 //*******************************************************************
 //GLFont Class Implementation
 //*******************************************************************
@@ -66,6 +76,10 @@
    header.tex = tex;

    //Allocate space for character array
+#ifdef __BIG_ENDIAN__
+   endian_swap(header.end_char);
+   endian_swap(header.start_char);
+#endif
    num_chars = header.end_char - header.start_char + 1;
    if ((header.chars = new GLFontChar[num_chars]) == NULL)
        return false;

Original issue reported on code.google.com by tsadow...@gmx.net on 1 Dec 2009 at 9:40

GoogleCodeExporter commented 8 years ago
Hi Torsten,
I've built just a few of the cnc modules for Leopard on Intel and Tiger on 
PowerPC.
Could you give us a little info on building all of HeeksCAD for mac? 
Thanks,
Dan

Original comment by ddfalck2...@yahoo.com on 2 Dec 2009 at 2:18

GoogleCodeExporter commented 8 years ago
Torsten, I have made the change you suggested, without myself having any
understanding of it.
Let me know if you want to make changes to HeeksCAD yourself and I will add you 
as a
"committer".
Dan Heeks.

Original comment by danhe...@gmail.com on 2 Dec 2009 at 3:06

GoogleCodeExporter commented 8 years ago
Hi Dan,

if "committer" means I can write wiki pages the first would be BuildOnMac. Time
permitting I would like to work on a feature tree but how to do this should be
dicussed first.

Torsten

Original comment by tsadow...@gmx.net on 2 Dec 2009 at 7:34