[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14553] trunk/blender/source/blender: Suggestion by GSR; move "extern C" into header file, remove "_" from

Ken Hughes khughes at pacific.edu
Fri Apr 25 21:18:24 CEST 2008


Revision: 14553
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14553
Author:   khughes
Date:     2008-04-25 21:18:24 +0200 (Fri, 25 Apr 2008)

Log Message:
-----------
Suggestion by GSR; move "extern C" into header file, remove "_" from
utf8towchar function name.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_font.h
    trunk/blender/source/blender/blenkernel/intern/font.c
    trunk/blender/source/blender/ftfont/intern/FTF_TTFont.cpp
    trunk/blender/source/blender/src/editfont.c

Modified: trunk/blender/source/blender/blenkernel/BKE_font.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_font.h	2008-04-25 18:28:59 UTC (rev 14552)
+++ trunk/blender/source/blender/blenkernel/BKE_font.h	2008-04-25 19:18:24 UTC (rev 14553)
@@ -31,6 +31,10 @@
 #ifndef BKE_VFONT_H
 #define BKE_VFONT_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include <wchar.h>
 
 struct VFont;
@@ -65,7 +69,11 @@
 void chtoutf8(unsigned long c, char *o);
 void wcs2utf8s(char *dst, wchar_t *src);
 int wcsleninu8(wchar_t *src);
-int utf8towchar_(wchar_t *w, char *c);
+int utf8towchar(wchar_t *w, char *c);
 
+#ifdef __cplusplus
+}
 #endif
 
+#endif
+

Modified: trunk/blender/source/blender/blenkernel/intern/font.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/font.c	2008-04-25 18:28:59 UTC (rev 14552)
+++ trunk/blender/source/blender/blenkernel/intern/font.c	2008-04-25 19:18:24 UTC (rev 14553)
@@ -179,7 +179,7 @@
 
 */
 
-int utf8towchar_(wchar_t *w, char *c)
+int utf8towchar(wchar_t *w, char *c)
 {
 	int len=0;
 
@@ -661,7 +661,7 @@
 	utf8len = utf8slen(cu->str);
 	tmp = mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
 	
-	utf8towchar_(mem, cu->str);
+	utf8towchar(mem, cu->str);
 
 	// Count the wchar_t string length
 	slen = wcslen(mem);

Modified: trunk/blender/source/blender/ftfont/intern/FTF_TTFont.cpp
===================================================================
--- trunk/blender/source/blender/ftfont/intern/FTF_TTFont.cpp	2008-04-25 18:28:59 UTC (rev 14552)
+++ trunk/blender/source/blender/ftfont/intern/FTF_TTFont.cpp	2008-04-25 19:18:24 UTC (rev 14553)
@@ -31,10 +31,7 @@
 #include <locale.h>
 #include "libintl.h"
 #include "BLI_blenlib.h"
-
-extern "C" {
 #include "BKE_font.h"
-}
 
 #include "../FTF_Settings.h"
 
@@ -292,9 +289,9 @@
 	/* note; this utf8towchar() function I totally don't understand... without using translations it 
 	   removes special characters completely. So, for now we just skip that then. (ton) */
 	if (FTF_USE_GETTEXT & flag) 
-		utf8towchar_(wstr, gettext(str));
+		utf8towchar(wstr, gettext(str));
 	else if (FTF_INPUT_UTF8 & flag) 
-		utf8towchar_(wstr, str);
+		utf8towchar(wstr, str);
 
 	glGetFloatv(GL_CURRENT_COLOR, color);
 	
@@ -351,7 +348,7 @@
 		removes special characters completely. So, for now we just skip that then. (ton) */
 
 	if (FTF_USE_GETTEXT & flag) {
-		len=utf8towchar_(wstr, gettext(str));
+		len=utf8towchar(wstr, gettext(str));
 
 		if(mode == FTF_PIXMAPFONT) {
 			return font->Advance(wstr);
@@ -377,9 +374,9 @@
 	int len=0;
   
 	if (FTF_USE_GETTEXT & flag) 
-		len=utf8towchar_(wstr,gettext(str));
+		len=utf8towchar(wstr,gettext(str));
 	else 
-		len=utf8towchar_(wstr,str);
+		len=utf8towchar(wstr,str);
 
 	font->BBox(wstr, *llx, *lly, *llz, *urx, *ury, *urz);
 }

Modified: trunk/blender/source/blender/src/editfont.c
===================================================================
--- trunk/blender/source/blender/src/editfont.c	2008-04-25 18:28:59 UTC (rev 14552)
+++ trunk/blender/source/blender/src/editfont.c	2008-04-25 19:18:24 UTC (rev 14553)
@@ -319,7 +319,7 @@
 	{
 		int tmplen;
 		wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
-		tmplen = utf8towchar_(mem, strp);
+		tmplen = utf8towchar(mem, strp);
 		wcscat(textbuf, mem);
 		MEM_freeN(mem);
 		cu->len += tmplen;
@@ -686,7 +686,7 @@
 						if(cu->len+filelen<MAXTEXT) {
 							int tmplen;
 							wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
-							tmplen = utf8towchar_(mem, strp);
+							tmplen = utf8towchar(mem, strp);
 							wcscat(textbuf, mem);
 							MEM_freeN(mem);
 							cu->len += tmplen;
@@ -969,7 +969,7 @@
 		{
 			int tmplen;
 			wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
-			tmplen = utf8towchar_(mem, strp);
+			tmplen = utf8towchar(mem, strp);
 //			mem =utf8s2wc(strp);
 			wcscat(textbuf, mem);
 			MEM_freeN(mem);
@@ -1033,7 +1033,7 @@
 		if(cu->len+filelen<MAXTEXT) {
 			int tmplen;
 			wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
-			tmplen = utf8towchar_(mem, strp);
+			tmplen = utf8towchar(mem, strp);
 			wcscat(textbuf, mem);
 			MEM_freeN(mem);
 			cu->len += tmplen;
@@ -1064,7 +1064,7 @@
 	if(oldstr==NULL) oldstr= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "oldstrbuf");
 	
 	// Convert the original text to wchar_t
-	utf8towchar_(textbuf, cu->str);
+	utf8towchar(textbuf, cu->str);
 	wcscpy(oldstr, textbuf);
 		
 	cu->len= wcslen(textbuf);





More information about the Bf-blender-cvs mailing list