diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenfont/intern/blf_font_i18n.c | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenfont/intern/blf_font_i18n.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_font_i18n.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/source/blender/blenfont/intern/blf_font_i18n.c b/source/blender/blenfont/intern/blf_font_i18n.c index 2a69d714dc6..74113ae4ce1 100644 --- a/source/blender/blenfont/intern/blf_font_i18n.c +++ b/source/blender/blenfont/intern/blf_font_i18n.c @@ -36,80 +36,78 @@ #ifdef WITH_INTERNATIONAL -#include "BLI_fileops.h" -#include "BLI_string.h" +# include "BLI_fileops.h" +# include "BLI_string.h" struct FontBuf { - const char *filename; - uchar *data; - int data_len; + const char *filename; + uchar *data; + int data_len; }; -static struct FontBuf unifont_ttf = {"droidsans.ttf.gz"}; +static struct FontBuf unifont_ttf = {"droidsans.ttf.gz"}; static struct FontBuf unifont_mono_ttf = {"bmonofont-i18n.ttf.gz"}; static void fontbuf_load(struct FontBuf *fb) { - const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts"); - if (fontpath) { - char unifont_path[1024]; - BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, fb->filename); - fb->data = (uchar *)BLI_file_ungzip_to_mem(unifont_path, &fb->data_len); - - } - else { - printf("%s: 'fonts' data path not found for '%s', continuing\n", __func__, fb->filename); - } + const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts"); + if (fontpath) { + char unifont_path[1024]; + BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, fb->filename); + fb->data = (uchar *)BLI_file_ungzip_to_mem(unifont_path, &fb->data_len); + } + else { + printf("%s: 'fonts' data path not found for '%s', continuing\n", __func__, fb->filename); + } } static void fontbuf_free(struct FontBuf *fb) { - MEM_SAFE_FREE(fb->data); - fb->data_len = 0; + MEM_SAFE_FREE(fb->data); + fb->data_len = 0; } static uchar *fontbuf_get_mem(struct FontBuf *fb, int *r_size) { - if (fb->data == NULL) { - fontbuf_load(fb); - } - *r_size = fb->data_len; - return fb->data; + if (fb->data == NULL) { + fontbuf_load(fb); + } + *r_size = fb->data_len; + return fb->data; } #endif /* WITH_INTERNATIONAL */ - uchar *BLF_get_unifont(int *r_unifont_size) { #ifdef WITH_INTERNATIONAL - return fontbuf_get_mem(&unifont_ttf, r_unifont_size); + return fontbuf_get_mem(&unifont_ttf, r_unifont_size); #else - UNUSED_VARS(r_unifont_size); - return NULL; + UNUSED_VARS(r_unifont_size); + return NULL; #endif } uchar *BLF_get_unifont_mono(int *r_unifont_size) { #ifdef WITH_INTERNATIONAL - return fontbuf_get_mem(&unifont_mono_ttf, r_unifont_size); + return fontbuf_get_mem(&unifont_mono_ttf, r_unifont_size); #else - UNUSED_VARS(r_unifont_size); - return NULL; + UNUSED_VARS(r_unifont_size); + return NULL; #endif } void BLF_free_unifont(void) { #ifdef WITH_INTERNATIONAL - fontbuf_free(&unifont_ttf); + fontbuf_free(&unifont_ttf); #endif } void BLF_free_unifont_mono(void) { #ifdef WITH_INTERNATIONAL - fontbuf_free(&unifont_mono_ttf); + fontbuf_free(&unifont_mono_ttf); #endif } |