From 3a8c7be9e4740c5627c9e49eb50c3687a959d7e6 Mon Sep 17 00:00:00 2001 From: Xiao Xiangquan Date: Fri, 12 Aug 2011 13:43:21 +0000 Subject: code clear, insert blf_gettext.c to blf.c --- source/blender/blenfont/BLF_api.h | 1 - source/blender/blenfont/CMakeLists.txt | 1 - source/blender/blenfont/intern/blf.c | 8 ++++++ source/blender/blenfont/intern/blf_gettext.c | 40 --------------------------- source/blender/blenfont/intern/blf_lang.c | 10 +++---- source/blender/editors/include/ED_datafiles.h | 2 +- source/blender/python/generic/blf_py_api.c | 4 +-- 7 files changed, 16 insertions(+), 50 deletions(-) delete mode 100755 source/blender/blenfont/intern/blf_gettext.c (limited to 'source/blender') diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 6f6003fa670..837ca814fbf 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -34,7 +34,6 @@ #ifndef BLF_API_H #define BLF_API_H -#include struct rctf; int BLF_init(int points, int dpi); diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index cc677d39b10..82099d4f125 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -40,7 +40,6 @@ set(SRC intern/blf.c intern/blf_dir.c intern/blf_font.c - intern/blf_gettext.c intern/blf_glyph.c intern/blf_lang.c intern/blf_util.c diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index c0e62b1c0c7..82094fdecdd 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -299,6 +300,13 @@ void BLF_enable(int fontid, int option) font->flags |= option; } +char* BLF_gettext(const char *msgid) +{ + if( msgid!=NULL && strlen(msgid)>0 ) + return gettext( msgid ); + return ""; +} + void BLF_disable(int fontid, int option) { FontBLF *font; diff --git a/source/blender/blenfont/intern/blf_gettext.c b/source/blender/blenfont/intern/blf_gettext.c deleted file mode 100755 index c82baed555c..00000000000 --- a/source/blender/blenfont/intern/blf_gettext.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: blf_gettext.c 37094 2011-06-02 11:22:22Z xiaoxiangquan $ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2008 Blender Foundation. - * All rights reserved. - * - * Contributor(s): Blender Foundation. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/blenfont/intern/blf_gettext.c - * \ingroup blf - */ - -#include -#include - -char* BLF_gettext(const char *msgid) -{ - if( msgid!=NULL && strlen(msgid)>0 ) - return gettext( msgid ); - return ""; -} diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index cc55eb585ed..28d1f57c619 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -140,8 +140,11 @@ void BLF_lang_set(const char *str) char *locreturn; if(str==NULL) str = lang_to_locale[U.language]; - BLI_setenv("LANG", str); - BLI_setenv("LANGUAGE", str); + if( str[0]!=0 ) + { + BLI_setenv("LANG", str); + BLI_setenv("LANGUAGE", str); + } locreturn= setlocale(LC_ALL, str); if (locreturn == NULL) { @@ -161,9 +164,6 @@ void BLF_lang_set(const char *str) bindtextdomain(DOMAIN_NAME, global_messagepath); /* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */ BLI_strncpy(global_language, str, sizeof(global_language)); - -// printf( "<<< %s %s %s \n", setlocale(LC_MESSAGES,NULL), getenv("LANG"), getenv("LANGUAGE") ); - } void BLF_lang_encoding(const char *str) diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h index 6831f80092c..b6792635f30 100644 --- a/source/blender/editors/include/ED_datafiles.h +++ b/source/blender/editors/include/ED_datafiles.h @@ -57,7 +57,7 @@ extern int datatoc_bmonofont_ttf_size; extern char datatoc_bmonofont_ttf[]; extern int datatoc_bunifont_ttf_size; -extern char* get_datatoc_bunifont_ttf(); +extern char* get_datatoc_bunifont_ttf(void); /* Brush icon datafiles */ /* TODO: this could be simplified by putting all diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index a6bbb26be86..a389fda924e 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -381,7 +381,7 @@ static PyObject *py_blf_gettext(PyObject *UNUSED(self), PyObject *args) { char* msgid; char* msgstr; - char* error_handle; + char* error_handle=NULL; if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid)) return NULL; @@ -404,7 +404,7 @@ PyDoc_STRVAR(py_blf_fake_gettext_doc, static PyObject *py_blf_fake_gettext(PyObject *UNUSED(self), PyObject *args) { char* msgid; - char* error_handle; + char* error_handle = NULL; if (!PyArg_ParseTuple(args, "s:blf.gettext", &msgid)) return NULL; -- cgit v1.2.3