summaryrefslogtreecommitdiff
path: root/src/lib/ecore_imf
diff options
context:
space:
mode:
authorJihoon Kim <jihoon48.kim@samsung.com>2018-03-15 20:26:40 +0900
committerJihoon Kim <jihoon48.kim@samsung.com>2018-03-26 08:05:45 +0900
commit54b689f3e0fe8e3b6ff702f0b0e1fb080ed171d9 (patch)
tree7157824af561dcbf6299851a086f86284ed68e3d /src/lib/ecore_imf
parente9b7844bb8d6427a804db314872eb935635f40e8 (diff)
ecore_imf: check validation before accessing context class
Change-Id: Id329b87167caa71aadd8ca454c50e9aaca275415 Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
Diffstat (limited to 'src/lib/ecore_imf')
-rw-r--r--src/lib/ecore_imf/ecore_imf_context.c85
1 files changed, 46 insertions, 39 deletions
diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c
index a04708f..32c0bb9 100644
--- a/src/lib/ecore_imf/ecore_imf_context.c
+++ b/src/lib/ecore_imf/ecore_imf_context.c
@@ -210,7 +210,7 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx)
210 if (show_req_ctx == ctx) 210 if (show_req_ctx == ctx)
211 show_req_ctx = NULL; 211 show_req_ctx = NULL;
212 212
213 if (ctx->klass->del) ctx->klass->del(ctx); 213 if (ctx->klass && ctx->klass->del) ctx->klass->del(ctx);
214 214
215 if (ctx->callbacks) 215 if (ctx->callbacks)
216 { 216 {
@@ -240,7 +240,8 @@ ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
240 "ecore_imf_context_client_window_set"); 240 "ecore_imf_context_client_window_set");
241 return; 241 return;
242 } 242 }
243 if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window); 243
244 if (ctx->klass && ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window);
244 ctx->window = window; 245 ctx->window = window;
245} 246}
246 247
@@ -265,7 +266,8 @@ ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
265 "ecore_imf_context_client_canvas_set"); 266 "ecore_imf_context_client_canvas_set");
266 return; 267 return;
267 } 268 }
268 if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas); 269
270 if (ctx->klass && ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas);
269 ctx->client_canvas = canvas; 271 ctx->client_canvas = canvas;
270} 272}
271 273
@@ -292,7 +294,7 @@ ecore_imf_context_show(Ecore_IMF_Context *ctx)
292 } 294 }
293 295
294 show_req_ctx = ctx; 296 show_req_ctx = ctx;
295 if (ctx->klass->show) ctx->klass->show(ctx); 297 if (ctx->klass && ctx->klass->show) ctx->klass->show(ctx);
296} 298}
297 299
298EAPI void 300EAPI void
@@ -305,7 +307,7 @@ ecore_imf_context_hide(Ecore_IMF_Context *ctx)
305 return; 307 return;
306 } 308 }
307 309
308 if (ctx->klass->hide) ctx->klass->hide(ctx); 310 if (ctx->klass && ctx->klass->hide) ctx->klass->hide(ctx);
309} 311}
310 312
311EAPI void 313EAPI void
@@ -317,7 +319,8 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu
317 "ecore_imf_context_preedit_string_get"); 319 "ecore_imf_context_preedit_string_get");
318 return; 320 return;
319 } 321 }
320 if (ctx->klass->preedit_string_get) 322
323 if (ctx->klass && ctx->klass->preedit_string_get)
321 ctx->klass->preedit_string_get(ctx, str, cursor_pos); 324 ctx->klass->preedit_string_get(ctx, str, cursor_pos);
322 else 325 else
323 { 326 {
@@ -335,7 +338,7 @@ ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, cha
335 "ecore_imf_context_preedit_string_with_attributes_get"); 338 "ecore_imf_context_preedit_string_with_attributes_get");
336 return; 339 return;
337 } 340 }
338 if (ctx->klass->preedit_string_with_attributes_get) 341 if (ctx->klass && ctx->klass->preedit_string_with_attributes_get)
339 ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos); 342 ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos);
340 else 343 else
341 { 344 {
@@ -354,7 +357,8 @@ ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
354 "ecore_imf_context_focus_in"); 357 "ecore_imf_context_focus_in");
355 return; 358 return;
356 } 359 }
357 if (ctx->klass->focus_in) ctx->klass->focus_in(ctx); 360
361 if (ctx->klass && ctx->klass->focus_in) ctx->klass->focus_in(ctx);
358} 362}
359 363
360EAPI void 364EAPI void
@@ -366,7 +370,8 @@ ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
366 "ecore_imf_context_focus_out"); 370 "ecore_imf_context_focus_out");
367 return; 371 return;
368 } 372 }
369 if (ctx->klass->focus_out) ctx->klass->focus_out(ctx); 373
374 if (ctx->klass && ctx->klass->focus_out) ctx->klass->focus_out(ctx);
370} 375}
371 376
372EAPI void 377EAPI void
@@ -378,7 +383,8 @@ ecore_imf_context_reset(Ecore_IMF_Context *ctx)
378 "ecore_imf_context_reset"); 383 "ecore_imf_context_reset");
379 return; 384 return;
380 } 385 }
381 if (ctx->klass->reset) ctx->klass->reset(ctx); 386
387 if (ctx->klass && ctx->klass->reset) ctx->klass->reset(ctx);
382} 388}
383 389
384EAPI void 390EAPI void
@@ -390,7 +396,8 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
390 "ecore_imf_context_cursor_position_set"); 396 "ecore_imf_context_cursor_position_set");
391 return; 397 return;
392 } 398 }
393 if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos); 399
400 if (ctx->klass && ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos);
394} 401}
395 402
396EAPI void 403EAPI void
@@ -402,7 +409,7 @@ ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int
402 "ecore_imf_context_cursor_location_set"); 409 "ecore_imf_context_cursor_location_set");
403 return; 410 return;
404 } 411 }
405 if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h); 412 if (ctx->klass && ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h);
406} 413}
407 414
408EAPI void 415EAPI void
@@ -414,7 +421,7 @@ ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit)
414 "ecore_imf_context_use_preedit_set"); 421 "ecore_imf_context_use_preedit_set");
415 return; 422 return;
416 } 423 }
417 if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit); 424 if (ctx->klass && ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit);
418} 425}
419 426
420EAPI void 427EAPI void
@@ -431,7 +438,7 @@ ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool predict
431 { 438 {
432 ctx->allow_prediction = prediction; 439 ctx->allow_prediction = prediction;
433 440
434 if (ctx->klass->prediction_allow_set) 441 if (ctx->klass && ctx->klass->prediction_allow_set)
435 ctx->klass->prediction_allow_set(ctx, prediction); 442 ctx->klass->prediction_allow_set(ctx, prediction);
436 } 443 }
437} 444}
@@ -463,7 +470,7 @@ ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocap
463 { 470 {
464 ctx->autocapital_type = autocapital_type; 471 ctx->autocapital_type = autocapital_type;
465 472
466 if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type); 473 if (ctx->klass && ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type);
467 } 474 }
468} 475}
469 476
@@ -517,7 +524,7 @@ ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode in
517 "ecore_imf_context_input_mode_set"); 524 "ecore_imf_context_input_mode_set");
518 return; 525 return;
519 } 526 }
520 if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode); 527 if (ctx->klass && ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode);
521 ctx->input_mode = input_mode; 528 ctx->input_mode = input_mode;
522} 529}
523 530
@@ -542,7 +549,7 @@ ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type
542 "ecore_imf_context_filter_event"); 549 "ecore_imf_context_filter_event");
543 return EINA_FALSE; 550 return EINA_FALSE;
544 } 551 }
545 if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event); 552 if (ctx->klass && ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event);
546 return EINA_FALSE; 553 return EINA_FALSE;
547} 554}
548 555
@@ -840,7 +847,7 @@ ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx)
840 return; 847 return;
841 } 848 }
842 849
843 if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx); 850 if (ctx->klass && ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx);
844} 851}
845 852
846EAPI void 853EAPI void
@@ -853,7 +860,7 @@ ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx)
853 return; 860 return;
854 } 861 }
855 862
856 if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx); 863 if (ctx->klass && ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx);
857} 864}
858 865
859EAPI void 866EAPI void
@@ -868,7 +875,7 @@ ecore_imf_context_input_hint_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints i
868 875
869 if (ctx->input_hints != input_hints) 876 if (ctx->input_hints != input_hints)
870 { 877 {
871 if (ctx->klass->input_hint_set) 878 if (ctx->klass && ctx->klass->input_hint_set)
872 ctx->klass->input_hint_set(ctx, input_hints); 879 ctx->klass->input_hint_set(ctx, input_hints);
873 880
874 ctx->input_hints = input_hints; 881 ctx->input_hints = input_hints;
@@ -902,7 +909,7 @@ ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
902 if ((ctx->input_panel_enabled) || 909 if ((ctx->input_panel_enabled) ||
903 (getenv("ECORE_IMF_INPUT_PANEL_ENABLED"))) 910 (getenv("ECORE_IMF_INPUT_PANEL_ENABLED")))
904 { 911 {
905 if (ctx->klass->show) ctx->klass->show(ctx); 912 if (ctx->klass && ctx->klass->show) ctx->klass->show(ctx);
906 } 913 }
907} 914}
908 915
@@ -919,7 +926,7 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
919 if ((ctx->input_panel_enabled) || 926 if ((ctx->input_panel_enabled) ||
920 (getenv("ECORE_IMF_INPUT_PANEL_ENABLED"))) 927 (getenv("ECORE_IMF_INPUT_PANEL_ENABLED")))
921 { 928 {
922 if (ctx->klass->hide) ctx->klass->hide(ctx); 929 if (ctx->klass && ctx->klass->hide) ctx->klass->hide(ctx);
923 } 930 }
924} 931}
925 932
@@ -935,7 +942,7 @@ ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input
935 942
936 if (ctx->input_panel_layout != layout) 943 if (ctx->input_panel_layout != layout)
937 { 944 {
938 if (ctx->klass->input_panel_layout_set) 945 if (ctx->klass && ctx->klass->input_panel_layout_set)
939 ctx->klass->input_panel_layout_set(ctx, layout); 946 ctx->klass->input_panel_layout_set(ctx, layout);
940 947
941 ctx->input_panel_layout = layout; 948 ctx->input_panel_layout = layout;
@@ -952,7 +959,7 @@ ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx)
952 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; 959 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
953 } 960 }
954 961
955 if (ctx->klass->input_panel_layout_get) 962 if (ctx->klass && ctx->klass->input_panel_layout_get)
956 return ctx->input_panel_layout; 963 return ctx->input_panel_layout;
957 else 964 else
958 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; 965 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
@@ -996,7 +1003,7 @@ ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Inp
996 1003
997 if (ctx->input_panel_lang != lang) 1004 if (ctx->input_panel_lang != lang)
998 { 1005 {
999 if (ctx->klass->input_panel_language_set) 1006 if (ctx->klass && ctx->klass->input_panel_language_set)
1000 ctx->klass->input_panel_language_set(ctx, lang); 1007 ctx->klass->input_panel_language_set(ctx, lang);
1001 1008
1002 ctx->input_panel_lang = lang; 1009 ctx->input_panel_lang = lang;
@@ -1055,7 +1062,7 @@ ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *dat
1055 1062
1056 if (!data) return; 1063 if (!data) return;
1057 1064
1058 if (ctx->klass->input_panel_imdata_set) 1065 if (ctx->klass && ctx->klass->input_panel_imdata_set)
1059 ctx->klass->input_panel_imdata_set(ctx, data, len); 1066 ctx->klass->input_panel_imdata_set(ctx, data, len);
1060} 1067}
1061 1068
@@ -1071,7 +1078,7 @@ ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int
1071 1078
1072 if (!data) return; 1079 if (!data) return;
1073 1080
1074 if (ctx->klass->input_panel_imdata_get) 1081 if (ctx->klass && ctx->klass->input_panel_imdata_get)
1075 ctx->klass->input_panel_imdata_get(ctx, data, len); 1082 ctx->klass->input_panel_imdata_get(ctx, data, len);
1076} 1083}
1077 1084
@@ -1088,7 +1095,7 @@ ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_
1088 if (ctx->input_panel_return_key_type != return_key_type) 1095 if (ctx->input_panel_return_key_type != return_key_type)
1089 { 1096 {
1090 ctx->input_panel_return_key_type = return_key_type; 1097 ctx->input_panel_return_key_type = return_key_type;
1091 if (ctx->klass->input_panel_return_key_type_set) 1098 if (ctx->klass && ctx->klass->input_panel_return_key_type_set)
1092 ctx->klass->input_panel_return_key_type_set(ctx, return_key_type); 1099 ctx->klass->input_panel_return_key_type_set(ctx, return_key_type);
1093 } 1100 }
1094} 1101}
@@ -1119,7 +1126,7 @@ ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Ei
1119 if (ctx->input_panel_return_key_disabled != disabled) 1126 if (ctx->input_panel_return_key_disabled != disabled)
1120 { 1127 {
1121 ctx->input_panel_return_key_disabled = disabled; 1128 ctx->input_panel_return_key_disabled = disabled;
1122 if (ctx->klass->input_panel_return_key_disabled_set) 1129 if (ctx->klass && ctx->klass->input_panel_return_key_disabled_set)
1123 ctx->klass->input_panel_return_key_disabled_set(ctx, disabled); 1130 ctx->klass->input_panel_return_key_disabled_set(ctx, disabled);
1124 } 1131 }
1125} 1132}
@@ -1149,7 +1156,7 @@ ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bo
1149 1156
1150 if (ctx->input_panel_caps_lock_mode != mode) 1157 if (ctx->input_panel_caps_lock_mode != mode)
1151 { 1158 {
1152 if (ctx->klass->input_panel_caps_lock_mode_set) 1159 if (ctx->klass && ctx->klass->input_panel_caps_lock_mode_set)
1153 ctx->klass->input_panel_caps_lock_mode_set(ctx, mode); 1160 ctx->klass->input_panel_caps_lock_mode_set(ctx, mode);
1154 1161
1155 ctx->input_panel_caps_lock_mode = mode; 1162 ctx->input_panel_caps_lock_mode = mode;
@@ -1179,7 +1186,7 @@ ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *
1179 return; 1186 return;
1180 } 1187 }
1181 1188
1182 if (ctx->klass->input_panel_geometry_get) 1189 if (ctx->klass && ctx->klass->input_panel_geometry_get)
1183 ctx->klass->input_panel_geometry_get(ctx, x, y, w, h); 1190 ctx->klass->input_panel_geometry_get(ctx, x, y, w, h);
1184} 1191}
1185 1192
@@ -1194,7 +1201,7 @@ ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx)
1194 return ECORE_IMF_INPUT_PANEL_STATE_HIDE; 1201 return ECORE_IMF_INPUT_PANEL_STATE_HIDE;
1195 } 1202 }
1196 1203
1197 if (ctx->klass->input_panel_state_get) 1204 if (ctx->klass && ctx->klass->input_panel_state_get)
1198 state = ctx->klass->input_panel_state_get(ctx); 1205 state = ctx->klass->input_panel_state_get(ctx);
1199 1206
1200 return state; 1207 return state;
@@ -1322,7 +1329,7 @@ ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char *
1322 return; 1329 return;
1323 } 1330 }
1324 1331
1325 if (ctx->klass->input_panel_language_locale_get) 1332 if (ctx->klass && ctx->klass->input_panel_language_locale_get)
1326 ctx->klass->input_panel_language_locale_get(ctx, lang); 1333 ctx->klass->input_panel_language_locale_get(ctx, lang);
1327 else 1334 else
1328 { 1335 {
@@ -1340,7 +1347,7 @@ ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, i
1340 return; 1347 return;
1341 } 1348 }
1342 1349
1343 if (ctx->klass->candidate_panel_geometry_get) 1350 if (ctx->klass && ctx->klass->candidate_panel_geometry_get)
1344 ctx->klass->candidate_panel_geometry_get(ctx, x, y, w, h); 1351 ctx->klass->candidate_panel_geometry_get(ctx, x, y, w, h);
1345} 1352}
1346 1353
@@ -1382,7 +1389,7 @@ ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Dire
1382 1389
1383 if (ctx->bidi_direction != direction) 1390 if (ctx->bidi_direction != direction)
1384 { 1391 {
1385 if (ctx->klass->bidi_direction_set) 1392 if (ctx->klass && ctx->klass->bidi_direction_set)
1386 ctx->klass->bidi_direction_set(ctx, direction); 1393 ctx->klass->bidi_direction_set(ctx, direction);
1387 1394
1388 ctx->bidi_direction = direction; 1395 ctx->bidi_direction = direction;
@@ -1413,7 +1420,7 @@ ecore_imf_context_keyboard_mode_get(Ecore_IMF_Context *ctx)
1413 return ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE; 1420 return ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE;
1414 } 1421 }
1415 1422
1416 if (ctx->klass->keyboard_mode_get) 1423 if (ctx->klass && ctx->klass->keyboard_mode_get)
1417 mode = ctx->klass->keyboard_mode_get(ctx); 1424 mode = ctx->klass->keyboard_mode_get(ctx);
1418 1425
1419 return mode; 1426 return mode;
@@ -1429,7 +1436,7 @@ ecore_imf_context_prediction_hint_set(Ecore_IMF_Context *ctx, const char *predic
1429 return; 1436 return;
1430 } 1437 }
1431 1438
1432 if (ctx->klass->prediction_hint_set) 1439 if (ctx->klass && ctx->klass->prediction_hint_set)
1433 ctx->klass->prediction_hint_set(ctx, prediction_hint); 1440 ctx->klass->prediction_hint_set(ctx, prediction_hint);
1434} 1441}
1435 1442
@@ -1445,7 +1452,7 @@ ecore_imf_context_mime_type_accept_set(Ecore_IMF_Context *ctx, const char *mime_
1445 1452
1446 if (!mime_type) return; 1453 if (!mime_type) return;
1447 1454
1448 if (ctx->klass->mime_type_accept_set) 1455 if (ctx->klass && ctx->klass->mime_type_accept_set)
1449 ctx->klass->mime_type_accept_set(ctx, mime_type); 1456 ctx->klass->mime_type_accept_set(ctx, mime_type);
1450} 1457}
1451 1458
@@ -1461,7 +1468,7 @@ ecore_imf_context_input_panel_position_set(Ecore_IMF_Context *ctx, int x, int y)
1461 1468
1462 if (x < 0 || y < 0) return; 1469 if (x < 0 || y < 0) return;
1463 1470
1464 if (ctx->klass->input_panel_position_set) 1471 if (ctx->klass && ctx->klass->input_panel_position_set)
1465 ctx->klass->input_panel_position_set(ctx, x, y); 1472 ctx->klass->input_panel_position_set(ctx, x, y);
1466} 1473}
1467 1474