diff -ur engine-2.4.orig/include/graphite/Segment.h engine-2.4/include/graphite/Segment.h
--- engine-2.4.orig/include/graphite/Segment.h	2010-05-25 07:45:14.000000000 +0200
+++ engine-2.4/include/graphite/Segment.h	2012-05-03 19:45:36.000000000 +0200
@@ -64,7 +64,7 @@
 	virtual ~Segment();
 
 	// Basic copy constructor:
-	Segment(Segment & seg);
+	Segment(const Segment & seg);
 
 	// For making modified copies of segments:
 	static Segment * LineContextSegment(Segment & seg, bool fStartLine, bool fEndLine);
diff -ur engine-2.4.orig/src/font/TtfUtil.cpp engine-2.4/src/font/TtfUtil.cpp
--- engine-2.4.orig/src/font/TtfUtil.cpp	2012-04-27 19:18:57.000000000 +0200
+++ engine-2.4/src/font/TtfUtil.cpp	2012-05-03 19:45:36.000000000 +0200
@@ -805,12 +805,14 @@
 	uint16 * pStr = reinterpret_cast<uint16 *>(pWStr);
 	uint16 * const pStrEnd = pStr + (nSize == 0 ? gr::utf16len(pStr) : nSize);
 
+#ifndef USE_STDLIB_WORKAROUNDS
 	std::transform(pStr, pStrEnd, pStr, read<uint16>);
-
-//		for (int i = 0; i < nSize; i++)
-//		{ // swap the wide characters in the string
-//			pStr[i] = gr::utf16(read(uint16(pStr[i])));
-//		}
+#else
+	for (int i = 0; i < nSize; i++)
+	{	// swap the wide characters in the string
+		pStr[i] = gr::utf16(read(uint16(pStr[i])));
+	}
+#endif
 }
 
 /*----------------------------------------------------------------------------------------------
@@ -1249,7 +1251,7 @@
 		(&pGlyph->end_pts_of_contours[cContours]);
 	
 	// skip over hints & point to first flag
-	int cbHints = read(*(uint16 *)pbGlyph);
+	int cbHints = read(*(const uint16 *)pbGlyph);
 	pbGlyph += sizeof(uint16);
 	pbGlyph += cbHints;
 
@@ -1303,7 +1305,7 @@
 			}
 			else
 			{
-				prgnX[iFlag] = read(*(int16 *)pbGlyph);
+				prgnX[iFlag] = read(*(const int16 *)pbGlyph);
 				pbGlyph += sizeof(int16);
 			}
 		}
@@ -1332,7 +1334,7 @@
 			}
 			else
 			{
-				prgnY[iFlag] = read(*(int16 *)pbGlyph);
+				prgnY[iFlag] = read(*(const int16 *)pbGlyph);
 				pbGlyph += sizeof(int16);
 			}
 		}
@@ -1368,9 +1370,9 @@
 	size_t iCurrentComp = 0;
 	do 
 	{
-		GlyphFlags = read(*((uint16 *)pbGlyph));
+		GlyphFlags = read(*((const uint16 *)pbGlyph));
 		pbGlyph += sizeof(uint16);
-		prgnCompId[iCurrentComp++] = read(*((uint16 *)pbGlyph));
+		prgnCompId[iCurrentComp++] = read(*((const uint16 *)pbGlyph));
 		pbGlyph += sizeof(uint16);
 		if (iCurrentComp >= cnCompIdTotal) 
 			return false;
@@ -1412,18 +1414,18 @@
 	uint16 GlyphFlags;
 	do 
 	{
-		GlyphFlags = read(*((uint16 *)pbGlyph));
+		GlyphFlags = read(*((const uint16 *)pbGlyph));
 		pbGlyph += sizeof(uint16);
-		if (read(*((uint16 *)pbGlyph)) == nCompId)
+		if (read(*((const uint16 *)pbGlyph)) == nCompId)
 		{
 			pbGlyph += sizeof(uint16); // skip over glyph id of component
 			fOffset = (GlyphFlags & CompoundGlyph::ArgsAreXYValues) == CompoundGlyph::ArgsAreXYValues;
 
 			if (GlyphFlags & CompoundGlyph::Arg1Arg2Words )
 			{
-				a = read(*(int16 *)pbGlyph);
+				a = read(*(const int16 *)pbGlyph);
 				pbGlyph += sizeof(int16);
-				b = read(*(int16 *)pbGlyph);
+				b = read(*(const int16 *)pbGlyph);
 				pbGlyph += sizeof(int16);
 			}
 			else
@@ -1477,9 +1479,9 @@
 	uint16 GlyphFlags;
 	do 
 	{
-		GlyphFlags = read(*((uint16 *)pbGlyph));
+		GlyphFlags = read(*((const uint16 *)pbGlyph));
 		pbGlyph += sizeof(uint16);
-		if (read(*((uint16 *)pbGlyph)) == nCompId)
+		if (read(*((const uint16 *)pbGlyph)) == nCompId)
 		{
 			pbGlyph += sizeof(uint16); // skip over glyph id of component
 			pbGlyph += GlyphFlags & CompoundGlyph::Arg1Arg2Words  ? 4 : 2; // skip over placement data
@@ -1491,7 +1493,7 @@
 
 			if (GlyphFlags & CompoundGlyph::HaveScale)
 			{
-				flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
 				flt12 = 0;
 				flt21 = 0;
@@ -1499,22 +1501,22 @@
 			}
 			else if (GlyphFlags & CompoundGlyph::HaveXAndYScale)
 			{
-				flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
 				flt12 = 0;
 				flt21 = 0;
-				flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
 			}
 			else if (GlyphFlags & CompoundGlyph::HaveTwoByTwo)
 			{
-				flt11 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt11 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
-				flt12 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt12 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
-				flt21 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt21 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
-				flt22 = fixed_to_float<14>(read(*(uint16 *)pbGlyph));
+				flt22 = fixed_to_float<14>(read(*(const uint16 *)pbGlyph));
 				pbGlyph += sizeof(uint16);
 			}
 			else
diff -ur engine-2.4.orig/src/generic/Debug.cpp engine-2.4/src/generic/Debug.cpp
--- engine-2.4.orig/src/generic/Debug.cpp	2010-05-13 16:39:27.000000000 +0200
+++ engine-2.4/src/generic/Debug.cpp	2012-05-03 19:45:36.000000000 +0200
@@ -13,7 +13,7 @@
 ----------------------------------------------------------------------------------------------*/
 
 #ifdef _WIN32
-#include <Windows.h>
+#include <windows.h>
 #endif
 //#include "common.h"
 //#include "Main.h"
diff -ur engine-2.4.orig/src/segment/FileInput.cpp engine-2.4/src/segment/FileInput.cpp
--- engine-2.4.orig/src/segment/FileInput.cpp	2010-05-22 20:35:07.000000000 +0200
+++ engine-2.4/src/segment/FileInput.cpp	2012-05-03 19:45:36.000000000 +0200
@@ -88,7 +88,7 @@
 /*----------------------------------------------------------------------------------------------
 	Initialize the stream to a buffer.
 ----------------------------------------------------------------------------------------------*/
-bool GrBufferIStream::OpenBuffer(byte * pbBuffer, int cb)
+bool GrBufferIStream::OpenBuffer(const byte * pbBuffer, int cb)
 {
 	Assert(m_pbStart == NULL);
 	Assert(m_pbNext == NULL);
diff -ur engine-2.4.orig/src/segment/FileInput.h engine-2.4/src/segment/FileInput.h
--- engine-2.4.orig/src/segment/FileInput.h	2008-05-20 10:02:16.000000000 +0200
+++ engine-2.4/src/segment/FileInput.h	2012-05-03 19:45:36.000000000 +0200
@@ -54,7 +54,7 @@
 	virtual void GetPositionInFont(long * plPos) = 0;
 	virtual void SetPositionInFont(long lPos) = 0;
 
-	virtual bool OpenBuffer(byte * pbBuffer, int cb) = 0;
+	virtual bool OpenBuffer(const byte * pbBuffer, int cb) = 0;
 	virtual void CloseBuffer() = 0;
 
 protected:
@@ -87,16 +87,16 @@
 	virtual void GetPositionInFont(long * plPos);
 	virtual void SetPositionInFont(long lPos);
 
-	virtual bool OpenBuffer(byte * pbBuffer, int cb);
+	virtual bool OpenBuffer(const byte * pbBuffer, int cb);
 	virtual void CloseBuffer()
 	{
 		Close();
 	}
 
 protected:
-	byte * m_pbStart;
-	byte * m_pbNext;
-	byte * m_pbLim;
+	const byte * m_pbStart;
+	const byte * m_pbNext;
+	const byte * m_pbLim;
 };
 
 } // namespace gr
diff -ur engine-2.4.orig/src/segment/FontFace.cpp engine-2.4/src/segment/FontFace.cpp
--- engine-2.4.orig/src/segment/FontFace.cpp	2011-03-21 17:13:25.000000000 +0100
+++ engine-2.4/src/segment/FontFace.cpp	2012-05-03 19:45:36.000000000 +0200
@@ -338,9 +338,9 @@
 
 //	ibGlocStart = cbGlatTbl;
 	fOk = CheckTableVersions(&grstrm,
-    		(byte *)pSilfTbl, 0,
-    		(byte *)pGlocTbl, 0,
-    		(byte *)pFeatTbl, 0,
+    		(const byte *)pSilfTbl, 0,
+    		(const byte *)pGlocTbl, 0,
+    		(const byte *)pFeatTbl, 0,
     		&m_fxdBadVersion);
 	if (!fOk)
 	{
@@ -374,7 +374,7 @@
 	try 
 	{
 		// Parse the "Silf" table.
-		grstrm.OpenBuffer((byte*)pSilfTbl, cbSilfSz);
+		grstrm.OpenBuffer((const byte*)pSilfTbl, cbSilfSz);
 		int chwGlyphIDMax, fxdVersion;
 		bool f = ReadSilfTable(grstrm, 0, 0, cbSilfSz, &chwGlyphIDMax, &fxdVersion);
 		grstrm.Close();
@@ -389,8 +389,8 @@
 		{
 			GrBufferIStream grstrmGlat;
 	
-			grstrm.OpenBuffer((byte *)pGlocTbl, cbGlocSz);
-			grstrmGlat.OpenBuffer((byte *)pGlatTbl, cbGlatSz);
+			grstrm.OpenBuffer((const byte *)pGlocTbl, cbGlocSz);
+			grstrmGlat.OpenBuffer((const byte *)pGlatTbl, cbGlatSz);
 			f = ReadGlocAndGlatTables(grstrm, 0, grstrmGlat, 0, chwGlyphIDMax, fxdVersion);
 			grstrm.Close();
 			grstrmGlat.Close();
@@ -403,7 +403,7 @@
 		}
 	
 		//	Parse the "Feat" table.
-		grstrm.OpenBuffer((byte *)pFeatTbl, cbFeatSz);
+		grstrm.OpenBuffer((const byte *)pFeatTbl, cbFeatSz);
 		f = ReadFeatTable(grstrm, 0);
 		grstrm.Close();
 		if (!f)
@@ -416,7 +416,7 @@
 		//	Parse the "Sill" table.
 		if (pSillTbl)
 		{
-			grstrm.OpenBuffer((byte *)pSillTbl, cbSillSz);
+			grstrm.OpenBuffer((const byte *)pSillTbl, cbSillSz);
 			f = ReadSillTable(grstrm, 0);
 			grstrm.Close();
 			if (!f)
@@ -549,7 +549,7 @@
 
 	if (!m_fNameTblCopy)
 	{
-		res = (pNameTbl = (byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail;
+		res = (pNameTbl = (const byte *)pfont->getTable(TtfUtil::TableIdTag(ktiName), &cbNameSz)) ? kresOk : kresFail;
 		fOk = pNameTbl && (cbNameSz == 0 || TtfUtil::CheckTable(ktiName, pNameTbl, cbNameSz));
 		if (!fOk)
 		{
diff -ur engine-2.4.orig/src/segment/GrEngine.cpp engine-2.4/src/segment/GrEngine.cpp
--- engine-2.4.orig/src/segment/GrEngine.cpp	2012-04-27 19:18:57.000000000 +0200
+++ engine-2.4/src/segment/GrEngine.cpp	2012-05-03 19:45:36.000000000 +0200
@@ -889,9 +889,9 @@
 	implementation of the engine can't handle.
 ----------------------------------------------------------------------------------------------*/
 bool GrEngine::CheckTableVersions(GrIStream * pgrstrm,
-		byte *pSilfTbl, int lSilfStart,
-		byte *pGlobTbl, int lGlocStart,
-		byte *pFeatTbl, int lFeatStart,
+		const byte *pSilfTbl, int lSilfStart,
+		const byte *pGlobTbl, int lGlocStart,
+		const byte *pFeatTbl, int lFeatStart,
 		int * pfxdBadVersion)
 {
 	pgrstrm->OpenBuffer(pSilfTbl, sizeof(int));
diff -ur engine-2.4.orig/src/segment/GrEngine.h engine-2.4/src/segment/GrEngine.h
--- engine-2.4.orig/src/segment/GrEngine.h	2012-04-27 19:18:57.000000000 +0200
+++ engine-2.4/src/segment/GrEngine.h	2012-05-03 19:45:36.000000000 +0200
@@ -547,9 +547,9 @@
 	void DestroyEverything();
 
 	bool CheckTableVersions(GrIStream * pgrstrm,
-		byte *silf_tbl, int lSilfStart,
-		byte *gloc_tbl, int lGlocStart,
-		byte *feat_tbl, int lFeatStart,
+		const byte *silf_tbl, int lSilfStart,
+		const byte *gloc_tbl, int lGlocStart,
+		const byte *feat_tbl, int lFeatStart,
 		int * pfxdBadVersion);
 	//bool ReadSileTable(GrIStream & grstrm, long lTableSTart,
 	//	int * pmFontEmUnits, bool * pfMismatchedBase);
diff -ur engine-2.4.orig/src/segment/Segment.cpp engine-2.4/src/segment/Segment.cpp
--- engine-2.4.orig/src/segment/Segment.cpp	2012-03-14 20:45:41.000000000 +0100
+++ engine-2.4/src/segment/Segment.cpp	2012-05-03 19:45:36.000000000 +0200
@@ -432,7 +432,7 @@
 /*----------------------------------------------------------------------------------------------
 	Basic copy method.
 ----------------------------------------------------------------------------------------------*/
-Segment::Segment(Segment & seg)
+Segment::Segment(const Segment & seg)
 {
 	int islout;
 
