* log current time
*/
time_t now;
- struct tm *timenow = NULL;
+ struct tm timenow;
time(&now);
- localtime_r(&now, timenow);
+ localtime_r(&now, &timenow);
- if (timenow) {
- char buf[64] = { 0 };
- asctime_r(timenow, buf);
+ char buf[64] = { 0 };
+ asctime_r(&timenow, buf);
- fprintf(m_flog, "[ %s ] %s\n", log_message[level], buf);
- fprintf(m_flog, "\t%s\n", str_log);
+ fprintf(m_flog, "[ %s ] %s\n", log_message[level], buf);
+ fprintf(m_flog, "\t%s\n", str_log);
- fflush(m_flog);
- }
+ fflush(m_flog);
}
void
&format_return, &nitems_return, &bytes_after_return,
&data);
- if (ret == Success) {
- if ((type_return == XA_WINDOW) && (format_return == 32) && (data)) {
- app_window = *(Window *)data;
- if (data)
- XFree(data);
+ if (data) {
+ if (ret == Success) {
+ if ((type_return == XA_WINDOW) && (format_return == 32) && (data)) {
+ app_window = *(Window *)data;
+ }
}
+ XFree(data);
}
}
#endif
SclPoint pos = {0, 0};
const SclLayout* layout = cache->get_cur_layout(window);
- if (layout) {
+ if (utils && layout) {
sclint scnWidth, scnHeight;
utils->get_screen_resolution(&scnWidth, &scnHeight);
}
if (ret) {
context->set_cur_key_modifier(touch_id, KEY_MODIFIER_LONGKEY);
- if (coordinate->button_type & BUTTON_TYPE_MULTITAP) {
- button_context->multitap_index = 0;
+ if (coordinate && button_context) {
+ if (coordinate->button_type & BUTTON_TYPE_MULTITAP) {
+ button_context->multitap_index = 0;
+ }
}
}
}
scl_check_arrindex(layout, MAX_SCL_LAYOUT) && scl_check_arrindex(m_focus_key, MAX_KEY)) {
SclLayoutKeyCoordinatePointer cur = sclres_layout_key_coordinate_pointer_frame[layout][m_focus_key];
SclWindowContext *window_context = windows->get_window_context(m_focus_window);
- SclRectangle cur_key_coordinate;
+ SclRectangle cur_key_coordinate = {0, 0, 0, 0};
if (window_context) {
cur_key_coordinate.x = cur->x + window_context->geometry.x;
cur_key_coordinate.y = cur->y + window_context->geometry.y;
CSCLEventHandler *handler = CSCLEventHandler::get_instance();
CSCLResourceCache *cache = CSCLResourceCache::get_instance();
SclResParserManager *sclres_manager = SclResParserManager::get_instance();
+
+ if (!context || !windows || !handler || !cache || !sclres_manager) return;
+
sclshort layout = NOT_USED;
sclwindow prev_window = m_focus_window;
/* To compare with buttons in popup window, let's convert to global coordinates */
SclWindowContext *window_context = windows->get_window_context(m_focus_window);
- SclRectangle cur_key_coordinate;
+ SclRectangle cur_key_coordinate = {0, 0, 0, 0};
if (window_context && cur && cache) {
cur_key_coordinate.x = cur->x + window_context->geometry.x;
cur_key_coordinate.y = cur->y + window_context->geometry.y;
SclWindowContext *base_window_context = windows->get_window_context(windows->get_base_window());
SclWindowContext *popup_window_context = windows->get_window_context(popup_window);
- SclRectangle base_key_coordinate;
+ SclRectangle base_key_coordinate = {0, 0, 0, 0};
if (base_window_context) {
base_key_coordinate.x = base_key->x + base_window_context->geometry.x;
base_key_coordinate.y = base_key->y + base_window_context->geometry.y;
SCL_DEBUG();
if (priv && sclres_layout_key_coordinate_pointer_frame) {
- CSCLResourceCache *cache = CSCLResourceCache::get_instance();
clear_privatekeyproperties(priv);
/* gets the value of the previous key properties */
scl_assert_return(keyCoordinate.valid == TRUE);
/* Sets the default properties base on the properties values of the given context */
- cache->copy_to_privatekeyproperties(&keyCoordinate, priv);
+ CSCLResourceCache *cache = CSCLResourceCache::get_instance();
+ if (cache) {
+ cache->copy_to_privatekeyproperties(&keyCoordinate, priv);
+ }
}
}
CSCLUtils *utils = CSCLUtils::get_instance();
CSCLContext *context = CSCLContext::get_instance();
CSCLResourceCache *cache = CSCLResourceCache::get_instance();
+
+ if (!utils || !context || !cache) return FALSE;
+
sclwindow pressed_window = context->get_cur_pressed_window(context->get_last_touch_device_id());
scl8 pressed_key = context->get_cur_pressed_key(context->get_last_touch_device_id());
class String_Encoder:public IString_Encoder{
public:
String_Encoder() {
- m_file = NULL;
+ m_file.clear();
}
void set_path(const char* file) {
- this->m_file = file;
+ m_file = file;
}
/* @ insert str to string vector */
int encode() const {
ResourceStorage storage;
encode(storage);
- storage.toFile(m_file);
+ storage.toFile(m_file.c_str());
return storage.get_size();
}
int encode(int& offset) const {
ResourceStorage storage;
encode(storage);
- storage.toFile(m_file, offset);
+ storage.toFile(m_file.c_str(), offset);
return storage.get_size();
}
private:
std::vector<std::string> m_vec_string;
- const char* m_file;
+ std::string m_file;
};
#endif
SclLayoutKeyCoordinatePointer **cur_key) {
assert(cur_node != NULL);
- Row row;
+ Row row = {0};
if (row_y) {
set_default_row_value(&row, cur_rec_layout, *row_y);
}
for (int shift_loop = 0;shift_loop < SCL_SHIFT_STATE_MAX;shift_loop++) {
if ((shift_state == shift_loop || shift_state == -1)) {
xmlChar* key = xmlNodeGetContent(child_node);
- cur_rec->key_value[shift_loop][multichar_state] = (sclchar*)key;
- if (auto_upper) {
- if (xmlStrlen(key) == 1 && shift_loop != SCL_SHIFT_STATE_OFF) {
- /* Let's manipulate the string for auto_upper */
- *key = toupper(*(cur_rec->key_value[SCL_SHIFT_STATE_OFF][multichar_state]));
+ if (key) {
+ cur_rec->key_value[shift_loop][multichar_state] = (sclchar*)key;
+ if (auto_upper) {
+ if (xmlStrlen(key) == 1 && shift_loop != SCL_SHIFT_STATE_OFF) {
+ /* Let's manipulate the string for auto_upper */
+ *key = toupper(*(cur_rec->key_value[SCL_SHIFT_STATE_OFF][multichar_state]));
+ }
}
+ add_key_string(key);
}
- add_key_string(key);
}
}
}