diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 1 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8c8e4bb034f..64d9a23b6a6 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1185,8 +1185,15 @@ int new_id(ListBase *lb, ID *id, const char *tname) * easier to assign each time then to check if its needed */ name[sizeof(name)-1]= 0; - if(name[0] == '\0') + if(name[0] == '\0') { + /* disallow empty names */ strcpy(name, ID_FALLBACK_NAME); + } + else { + /* disallow non utf8 chars, + * the interface checks for this but new ID's based on file names dont */ + BLI_utf8_invalid_strip(name, strlen(name)); + } result = check_for_dupid(lb, id, name); strcpy(id->name+2, name); @@ -1377,8 +1384,9 @@ void text_idbutton(struct ID *id, char *text) text[4]= 0; } } - else - strcpy(text, ""); + else { + text[0]= '\0'; + } } void rename_id(ID *id, char *name) diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 0867acbfb60..5f435aa0cbe 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -544,6 +544,7 @@ void file_draw_list(const bContext *C, ARegion *ar) uiBut *but = uiDefBut(block, TEX, 1, "", spos, sy-layout->tile_h-3, but_width, layout->textheight*2, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,""); uiButSetRenameFunc(but, renamebutton_cb, file); + uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ if ( 0 == uiButActiveOnly(C, block, but)) { file->flags &= ~EDITING; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 2c16d4f2b56..6cc191757ed 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -233,7 +233,7 @@ static const char *py_safe_unicode_to_byte(PyObject *py_str, PyObject **coerce) } } -static PyObject *py_safe_byte_to_unicode(char *str) +static PyObject *py_safe_byte_to_unicode(const char *str) { PyObject *result= PyUnicode_FromString(str); if(result) { |