slen = strlen(text);
         XCharStruct overall_return;
 
-        (void)XTextExtents(xfont, (char*) text.c_str(), slen, &direction,
+        (void)XTextExtents(xfont, (const char*) text.c_str(), slen, &direction,
                                  &ascent, &descent, &overall_return);
 
         cx = overall_return.width;
     int direction, ascent, descent2;
     XCharStruct overall;
 
-    XTextExtents( xfont, (char*) string.c_str(), string.length(), &direction,
+    XTextExtents( xfont, (const char*) string.c_str(), string.length(), &direction,
         &ascent, &descent2, &overall);
 
     if (width)
 
     XCharStruct overall;
     int slen = string.length();
 
-    XTextExtents((XFontStruct*) pFontStruct, (char*) string.c_str(), slen,
+    XTextExtents((XFontStruct*) pFontStruct, (const char*) string.c_str(), slen,
                  &direction, &ascent, &descent2, &overall);
 
     if ( x )