diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-05 05:42:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-05 05:42:52 +0400 |
commit | a4b71f4e01227d1d6508d8a5cb02301c19523469 (patch) | |
tree | 6b4ccc25835d3ae48a1ebf924be14db2ab5eefd1 /source/blender/editors/interface/interface_ops.c | |
parent | 65b214ed04c65dd4f5f7169a8c5c9e06405b5033 (diff) |
fix for various redundant checks and possibly fix some crashes in rare situations.
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 67c0d04a79f..e8b8959fd43 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -908,19 +908,19 @@ static void UI_OT_editsource(wmOperatorType *ot) void edittranslation_find_po_file(const char *root, const char *uilng, char *path, const size_t maxlen) { - char t[32]; /* Should be more than enough! */ + char tstr[32]; /* Should be more than enough! */ /* First, full lang code. */ - sprintf(t, "%s.po", uilng); + BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng); BLI_join_dirfile(path, maxlen, root, uilng); - BLI_join_dirfile(path, maxlen, path, t); + BLI_join_dirfile(path, maxlen, path, tstr); if (BLI_is_file(path)) return; /* Now try without the second iso code part (_ES in es_ES). */ - strncpy(t, uilng, 2); - strcpy(t + 2, uilng + 5); /* Because of some codes like sr_SR@latin... */ - BLI_join_dirfile(path, maxlen, root, t); - sprintf(t, "%s.po", t); - BLI_join_dirfile(path, maxlen, path, t); + strncpy(tstr, uilng, 2); + BLI_strncpy(tstr + 2, uilng + 5, sizeof(tstr) - 2); /* Because of some codes like sr_SR@latin... */ + BLI_join_dirfile(path, maxlen, root, tstr); + strcat(tstr, ".po"); + BLI_join_dirfile(path, maxlen, path, tstr); if (BLI_is_file(path)) return; path[0] = '\0'; |