Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: src/IBusChewingEngine.gob

Issue 668239: Fix memory errors in third_party/ibus-chewing/files/src. (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 requires 2.0.0 1 requires 2.0.0
2 2
3 %alltop{ 3 %alltop{
4 /* 4 /*
5 * Copyright © 2009 Red Hat, Inc. All rights reserved. 5 * Copyright © 2009 Red Hat, Inc. All rights reserved.
6 * Copyright © 2009 Ding-Yi Chen <dchen at redhat.com> 6 * Copyright © 2009 Ding-Yi Chen <dchen at redhat.com>
7 * 7 *
8 * This file is part of the ibus-chewing Project. 8 * This file is part of the ibus-chewing Project.
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 #else 268 #else
269 ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_e vent_1_2; 269 ibus_engine_class->process_key_event = ibus_chewing_engine_process_key_e vent_1_2;
270 #endif /* IBUS_1_1 */ 270 #endif /* IBUS_1_1 */
271 } 271 }
272 272
273 private void load_setting(self){ 273 private void load_setting(self){
274 #define BUFFER_SIZE_LOCAL 200 274 #define BUFFER_SIZE_LOCAL 200
275 G_DEBUG_MSG(3,"[I3] load_setting()"); 275 G_DEBUG_MSG(3,"[I3] load_setting()");
276 int i; 276 int i;
277 gchar buf[BUFFER_SIZE_LOCAL]; 277 gchar buf[BUFFER_SIZE_LOCAL];
278 GValue gValue={0};
279 278
280 for (i=0; propSpecs[i].valueType!=G_TYPE_INVALID;i++){ 279 for (i=0; propSpecs[i].valueType!=G_TYPE_INVALID;i++){
280 GValue gValue={0};
281
281 G_DEBUG_MSG(4,"[I4] load_setting(), i=%d",i); 282 G_DEBUG_MSG(4,"[I4] load_setting(), i=%d",i);
282 if (ibus_config_get_value(self->config, "engine/Chewing",propSpecs[i ].key, &gValue)){ 283 if (ibus_config_get_value(self->config, "engine/Chewing",propSpecs[i ].key, &gValue)){
283 switch(propSpecs[i].valueType){ 284 switch(propSpecs[i].valueType){
284 case G_TYPE_BOOLEAN: 285 case G_TYPE_BOOLEAN:
285 buf[0]=(g_value_get_boolean(&gValue))? '1' : '0'; 286 buf[0]=(g_value_get_boolean(&gValue))? '1' : '0';
286 buf[1]='\0'; 287 buf[1]='\0';
287 break; 288 break;
288 case G_TYPE_UINT: 289 case G_TYPE_UINT:
289 g_snprintf(buf,BUFFER_SIZE_LOCAL,"%u", 290 g_snprintf(buf,BUFFER_SIZE_LOCAL,"%u",
290 g_value_get_uint(&gValue)); 291 g_value_get_uint(&gValue));
(...skipping 18 matching lines...) Expand all
309 ); 310 );
310 if (propSpecs[i].defaultValue){ 311 if (propSpecs[i].defaultValue){
311 g_strlcpy(buf,propSpecs[i].defaultValue, BUFFER_SIZE_LOCAL); 312 g_strlcpy(buf,propSpecs[i].defaultValue, BUFFER_SIZE_LOCAL);
312 }else{ 313 }else{
313 continue; 314 continue;
314 } 315 }
315 } 316 }
316 /* Add property to dialog */ 317 /* Add property to dialog */
317 maker_dialog_add_property(MAKER_DIALOG(self->setting_dialog),&propSp ecs[i],buf,self); 318 maker_dialog_add_property(MAKER_DIALOG(self->setting_dialog),&propSp ecs[i],buf,self);
318 maker_dialog_apply_widget_value(MAKER_DIALOG(self->setting_dialog),p ropSpecs[i].key); 319 maker_dialog_apply_widget_value(MAKER_DIALOG(self->setting_dialog),p ropSpecs[i].key);
319 » g_value_unset(&gValue); 320 » if (G_IS_VALUE(&gValue)) {
321 » g_value_unset(&gValue);
322 }
320 } 323 }
321 324
322 for (i=0; page_labels[i]!=NULL;i++){ 325 for (i=0; page_labels[i]!=NULL;i++){
323 maker_dialog_align_labels(MAKER_DIALOG(self->setting_dialog),page_la bels[i],1.0f, 0.5f); 326 maker_dialog_align_labels(MAKER_DIALOG(self->setting_dialog),page_la bels[i],1.0f, 0.5f);
324 } 327 }
325 gtk_widget_hide(self->setting_dialog); 328 gtk_widget_hide(self->setting_dialog);
326 #undef BUFFER_SIZE_LOCAL 329 #undef BUFFER_SIZE_LOCAL
327 } 330 }
328 331
329 protected void set_lookup_table_label(self,const gchar *labels){ 332 protected void set_lookup_table_label(self,const gchar *labels){
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 IBusProperty *prop=self_get_iBusProperty(self, prop_name); 955 IBusProperty *prop=self_get_iBusProperty(self, prop_name);
953 ibus_property_set_visible(prop,FALSE); 956 ibus_property_set_visible(prop,FALSE);
954 ibus_engine_update_property(engine,prop); 957 ibus_engine_update_property(engine,prop);
955 } 958 }
956 } 959 }
957 960
958 %{ 961 %{
959 #include "IBusChewingEngine-keys.c" 962 #include "IBusChewingEngine-keys.c"
960 %} 963 %}
961 964
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698