Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-11-05 16:04:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-11-05 16:04:46 +0300
commit18d7fbe4f58c86f6f91b1e9e5c1f7f0c593a1d0f (patch)
tree464a796b5e52172d6ddb2eef426b82683fa23583 /source/blender/windowmanager
parent2837a7e198a15381ec00e190c1c7c9a628d3412b (diff)
Cleanup: order buffer length after the buffer
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_keymap.h18
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c51
2 files changed, 39 insertions, 30 deletions
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 4f96e40d9ff..8a94472aaf5 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -68,7 +68,7 @@ wmKeyMapItem *WM_keymap_add_menu_pie(struct wmKeyMap *keymap, const char *idname
int val, int modifier, int keymodifier);
bool WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
-int WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, const int len, char *r_str);
+int WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, char *result, const int result_len);
wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid);
wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid);
@@ -83,12 +83,14 @@ int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
/* Modal Keymap */
int WM_modalkeymap_items_to_string(
- struct wmKeyMap *km, const int propvalue, const bool compact, const int len, char *r_str);
+ struct wmKeyMap *km, const int propvalue, const bool compact,
+ char *result, const int result_len);
int WM_modalkeymap_operator_items_to_string(
- struct wmOperatorType *ot, const int propvalue, const bool compact, const int len, char *r_str);
+ struct wmOperatorType *ot, const int propvalue, const bool compact,
+ char *result, const int result_len);
char *WM_modalkeymap_operator_items_to_string_buf(
struct wmOperatorType *ot, const int propvalue, const bool compact,
- const int max_len, int *r_available_len, char **r_str);
+ const int max_len, int *r_available_len, char **r_result);
wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, const struct EnumPropertyItem *items);
wmKeyMap *WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname);
@@ -109,14 +111,16 @@ int WM_keymap_map_type_get(struct wmKeyMapItem *kmi);
const char *WM_key_event_string(const short type, const bool compact);
int WM_keymap_item_raw_to_string(
const short shift, const short ctrl, const short alt, const short oskey, const short keymodifier,
- const short val, const short type, const bool compact, const int len, char *r_str);
+ const short val, const short type, const bool compact,
+ char *result, const int result_len);
wmKeyMapItem *WM_key_event_operator(
const struct bContext *C, const char *opname, int opcontext,
struct IDProperty *properties, const bool is_hotkey,
struct wmKeyMap **r_keymap);
-char *WM_key_event_operator_string(
+char *WM_key_event_operator_string(
const struct bContext *C, const char *opname, int opcontext,
- struct IDProperty *properties, const bool is_strict, int len, char *r_str);
+ struct IDProperty *properties, const bool is_strict,
+ char *result, const int result_len);
const char *WM_bool_as_string(bool test);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 8dab50a6f29..910b7eadf4c 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -940,7 +940,7 @@ const char *WM_key_event_string(const short type, const bool compact)
int WM_keymap_item_raw_to_string(
const short shift, const short ctrl, const short alt, const short oskey,
const short keymodifier, const short val, const short type, const bool compact,
- const int len, char *r_str)
+ char *result, const int result_len)
{
#define ADD_SEP if (p != buf) *p++ = ' '; (void)0
@@ -1000,20 +1000,23 @@ int WM_keymap_item_raw_to_string(
BLI_assert(p - buf < sizeof(buf));
/* We need utf8 here, otherwise we may 'cut' some unicode chars like arrows... */
- return BLI_strncpy_utf8_rlen(r_str, buf, len);
+ return BLI_strncpy_utf8_rlen(result, buf, result_len);
#undef ADD_SEP
}
-int WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, const int len, char *r_str)
+int WM_keymap_item_to_string(
+ wmKeyMapItem *kmi, const bool compact,
+ char *result, const int result_len)
{
return WM_keymap_item_raw_to_string(
- kmi->shift, kmi->ctrl, kmi->alt, kmi->oskey, kmi->keymodifier, kmi->val, kmi->type,
- compact, len, r_str);
+ kmi->shift, kmi->ctrl, kmi->alt, kmi->oskey, kmi->keymodifier, kmi->val, kmi->type,
+ compact, result, result_len);
}
int WM_modalkeymap_items_to_string(
- wmKeyMap *km, const int propvalue, const bool compact, const int len, char *r_str)
+ wmKeyMap *km, const int propvalue, const bool compact,
+ char *result, const int result_len)
{
int totlen = 0;
bool add_sep = false;
@@ -1023,17 +1026,17 @@ int WM_modalkeymap_items_to_string(
/* Find all shortcuts related to that propvalue! */
for (kmi = WM_modalkeymap_find_propvalue(km, propvalue);
- kmi && totlen < (len - 2);
+ kmi && totlen < (result_len - 2);
kmi = wm_modalkeymap_find_propvalue_iter(km, kmi, propvalue))
{
if (add_sep) {
- r_str[totlen++] = '/';
- r_str[totlen] = '\0';
+ result[totlen++] = '/';
+ result[totlen] = '\0';
}
else {
add_sep = true;
}
- totlen += WM_keymap_item_to_string(kmi, compact, len - totlen, &r_str[totlen]);
+ totlen += WM_keymap_item_to_string(kmi, compact, &result[totlen], result_len - totlen);
}
}
@@ -1041,25 +1044,26 @@ int WM_modalkeymap_items_to_string(
}
int WM_modalkeymap_operator_items_to_string(
- wmOperatorType *ot, const int propvalue, const bool compact, const int len, char *r_str)
+ wmOperatorType *ot, const int propvalue, const bool compact,
+ char *result, const int result_len)
{
- return WM_modalkeymap_items_to_string(ot->modalkeymap, propvalue, compact, len, r_str);
+ return WM_modalkeymap_items_to_string(ot->modalkeymap, propvalue, compact, result, result_len);
}
char *WM_modalkeymap_operator_items_to_string_buf(
wmOperatorType *ot, const int propvalue, const bool compact,
- const int max_len, int *r_available_len, char **r_str)
+ const int max_len, int *r_available_len, char **r_result)
{
- char *ret = *r_str;
+ char *ret = *r_result;
if (*r_available_len > 1) {
int used_len = WM_modalkeymap_operator_items_to_string(
- ot, propvalue, compact, min_ii(*r_available_len, max_len), ret) + 1;
+ ot, propvalue, compact, ret, min_ii(*r_available_len, max_len)) + 1;
*r_available_len -= used_len;
- *r_str += used_len;
+ *r_result += used_len;
if (*r_available_len == 0) {
- (*r_str)--; /* So that *str keeps pointing on a valid char, we'll stay on it anyway. */
+ (*r_result)--; /* So that *result keeps pointing on a valid char, we'll stay on it anyway. */
}
}
else {
@@ -1126,7 +1130,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
if (IDP_EqualsProperties_ex(properties, properties_default, is_strict)) {
char kmi_str[128];
- WM_keymap_item_to_string(kmi, false, sizeof(kmi_str), kmi_str);
+ WM_keymap_item_to_string(kmi, false, kmi_str, sizeof(kmi_str));
/* Note gievn properties could come from other things than menu entry... */
printf("%s: Some set values in menu entry match default op values, "
"this might not be desired!\n", opname);
@@ -1276,7 +1280,7 @@ static wmKeyMapItem *wm_keymap_item_find(
kmi = wm_keymap_item_find_props(C, opname, opcontext, properties_default, is_strict, is_hotkey, &km);
if (kmi) {
char kmi_str[128];
- WM_keymap_item_to_string(kmi, false, sizeof(kmi_str), kmi_str);
+ WM_keymap_item_to_string(kmi, false, kmi_str, sizeof(kmi_str));
printf("%s: Some set values in keymap entry match default op values, "
"this might not be desired!\n", opname);
printf("\tkm: '%s', kmi: '%s'\n", km->idname, kmi_str);
@@ -1302,13 +1306,14 @@ static wmKeyMapItem *wm_keymap_item_find(
char *WM_key_event_operator_string(
const bContext *C, const char *opname, int opcontext,
- IDProperty *properties, const bool is_strict, int len, char *r_str)
+ IDProperty *properties, const bool is_strict,
+ char *result, const int result_len)
{
wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, false, is_strict, NULL);
-
+
if (kmi) {
- WM_keymap_item_to_string(kmi, false, len, r_str);
- return r_str;
+ WM_keymap_item_to_string(kmi, false, result, result_len);
+ return result;
}
return NULL;