/** * Mathematical operation / * it divides the subpixels with the value */ Pixel<T> operator/=(const T &rhs) { for(unsigned char i = 0; i < size_; ++i) { pixel_[i] /= rhs; validate_value(pixel_[i]); } return *this; }
/** * Mathematical operation / * if the size of the left hand side object is 0 the right hand side * else the size of both pixels has to be the same */ Pixel<T> operator/=(const Pixel<T> &rhs) { if(size_ == rhs.size()) { for(unsigned char i = 0; i < size_; ++i) { pixel_[i] /= rhs.get_pixel(i); validate_value(pixel_[i]); } return *this; } else if(size_ == 0) { size_ = rhs.size(); delete[] pixel_; T *temp = new T[size_]; for(unsigned char i = 0; i < size_; ++i) { temp[i] = rhs.get_pixel(i); } pixel_ = temp;; return *this; } std::ostringstream ss; ss << "A Division between pixels can only happen when they have the same " << "size!\t LHS: " << size_ << "\tRHS: "<< rhs.size() << '\n'; throw std::range_error(ss.str()); }
// called when cell has been edited static void renderer_edited(GtkCellRendererText *cell, const gchar *path_string, const gchar *new_text, gpointer user_data) { GtkWidget *tree = user_data; GtkTreeView *view = GTK_TREE_VIEW(tree); GtkTreeModel *model = gtk_tree_view_get_model(view); GtkTreeStore *store = GTK_TREE_STORE(model); GtkTreePath *path = gtk_tree_path_new_from_string(path_string); GtkTreeIter iter, child; IO_DEF *s; gchar *str; uint32_t value; gboolean valid; if (!gtk_tree_model_get_iter(model, &iter, path)) return; gtk_tree_model_get(model, &iter, COL_VALUE, &str, COL_S, &s, -1); sscanf(str, "%x", &value); g_free(str); // change value in memory if(validate_value(new_text, 2 *s->size)) { sscanf(new_text, "%x", &value); switch(s->size) { case 1: mem_wr_byte(s->addr, (uint8_t )value); break; case 2: mem_wr_word(s->addr, (uint16_t)value); break; case 4: mem_wr_long(s->addr, (uint32_t)value); break; default: break; } } // and change displayed value (don't rely on typed value !) str = rd_mem_as_str(s); gtk_tree_store_set(store, &iter, COL_VALUE, str, -1); g_free(str); // update bits (children nodes) for(valid = gtk_tree_model_iter_children(model, &child, &iter); valid; valid = gtk_tree_model_iter_next(model, &child)) { gchar* bit_adr; int bit_num; gtk_tree_model_get(model, &child, COL_NAME, &str, COL_ADDR, &bit_adr, -1); sscanf(bit_adr, "%i", &bit_num); gtk_tree_store_set(store, &child, COL_BTNACT, rd_bit(s, bit_num), -1); } gtk_tree_path_free(path); }
static int gt_obo_parse_tree_validate_stanzas(const GtOBOParseTree *obo_parse_tree, GtError *err) { unsigned long i; int had_err = 0; gt_error_check(err); gt_assert(obo_parse_tree); for (i = 0; !had_err && i < gt_obo_parse_tree_num_of_stanzas(obo_parse_tree); i++) { GtOBOStanza *stanza = *(GtOBOStanza**) gt_array_get(obo_parse_tree->stanzas, i); if (!strcmp(gt_obo_parse_tree_get_stanza_type(obo_parse_tree, i), "Term")) { had_err = validate_value(stanza, "id", err); if (!had_err) had_err = validate_value(stanza, "name", err); } else if (!strcmp(gt_obo_parse_tree_get_stanza_type(obo_parse_tree, i), "Typedef")) { had_err = validate_value(stanza, "id", err); if (!had_err) had_err = validate_value(stanza, "name", err); } else if (!strcmp(gt_obo_parse_tree_get_stanza_type(obo_parse_tree, i), "Instance")) { had_err = validate_value(stanza, "id", err); if (!had_err) had_err = validate_value(stanza, "name", err); if (!had_err) had_err = validate_value(stanza, "instance_of", err); } } return had_err; }
/** * @return returns a reference to the calling object, the object has only one * subpixel that has the value of the average gray value */ Pixel<T> &grey() { T *del = pixel_; pixel_ = new T[1](); for(unsigned char i = 0; i < size_; ++i) { pixel_[0] += del[i] / size_; } validate_value(pixel_[0]); delete[] del; size_ = 1; return *this; }
static void renderer_edited(GtkCellRendererText * cell, const gchar * path_string, const gchar * new_text, gpointer user_data) { GtkWidget *tree = user_data; GtkTreeView *view = GTK_TREE_VIEW(tree); GtkTreeModel *model = gtk_tree_view_get_model(view); GtkTreeStore *store = GTK_TREE_STORE(model); GtkTreePath *path = gtk_tree_path_new_from_string(path_string); GtkTreeIter iter; uint32_t value; gint n; if (!gtk_tree_model_get_iter(model, &iter, path)) return; if (strlen(path_string) < 3) return; // set new value n = path_string[2] - '0'; switch(path_string[0] - '0') { case 1: // Ax if(validate_value(new_text, 8)) { sscanf(new_text, "%x", &value); gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); ti68k_register_set_addr(n, value); if((n == 6) || (n == 7)) dbgstack_refresh_window(); } break; case 0: // Dx if(validate_value(new_text, 8)) { sscanf(new_text, "%x", &value); gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); ti68k_register_set_data(n, value); } break; case 2: // Others switch(n) { case 0: // pc if(validate_value(new_text, 6)) { sscanf(new_text, "%x", &value); gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); ti68k_register_set_pc(value); } break; case 1: // usp if(validate_value(new_text, 6)) { sscanf(new_text, "%x", &value); gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); ti68k_register_set_usp(value); } break; case 2: // ssp if(validate_value(new_text, 6)) { sscanf(new_text, "%x", &value); gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); ti68k_register_set_ssp(value); } break; case 3: // sr if(validate_value(new_text, 4)) { sscanf(new_text, "%x", &value); gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); ti68k_register_set_sr(value); // update usp <=> ssp dbgregs_refresh_window(); dbgstack_refresh_window(); } break; case 4: // super-flags if(ti68k_register_set_flags(new_text, NULL)) { uint32_t data; gchar *sdata; gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); // update sr, too gtk_tree_path_free(path); path = gtk_tree_path_new_from_string("2:2"); if (!gtk_tree_model_get_iter(model, &iter, path)) return; ti68k_register_get_sr(&data); sdata = g_strdup_printf("%04x", data); gtk_tree_store_set(store, &iter, COL_VALUE, sdata, -1); g_free(sdata); // update usp <=> ssp dbgregs_refresh_window(); dbgstack_refresh_window(); } case 5: // user-flags if(ti68k_register_set_flags(NULL, new_text)) { uint32_t data; gchar *sdata; gtk_tree_store_set(store, &iter, COL_VALUE, new_text, -1); // update sr, too gtk_tree_path_free(path); path = gtk_tree_path_new_from_string("2:2"); if (!gtk_tree_model_get_iter(model, &iter, path)) return; ti68k_register_get_sr(&data); sdata = g_strdup_printf("%04x", data); gtk_tree_store_set(store, &iter, COL_VALUE, sdata, -1); g_free(sdata); } break; break; } break; default: break; } gtk_tree_path_free(path); }
static int validate_tag(tag_t *tag) { int start_len, end_len; char *str; char start_name[128]; char end_name[128]; //int i,j; //char *ch,*ch1; //fprintf(stderr,"\r\nInside validate_tag with tag->start_len:%d & tag->start_name\n",tag->start_len); //ch = tag->start_name; //for (i=0;i<tag->start_len;i++ ) //{ // fprintf(stderr,"%c",*ch++); //} start_len = tag->start_len-2; // ignore open and closing braces if(tag->attr_len) // ignore space + attributes start_len = start_len - (tag->attr_len+1); strncpy(start_name, tag->start_name + 1, start_len); start_name[start_len] = 0x00; /* start tag must be valid here */ if(validate_start_tag(tag->start_name, tag->start_len)) return -1; //fprintf(stderr,"\r\nInside validate_tag with tag->end_len:%d & tag->end_name\n",tag->end_len); //ch1 = tag->end_name; //for (j=0;j<tag->end_len;j++ ) //{ // fprintf(stderr,"%c",*ch1++); //} if(!tag->empty) { end_len = tag->end_len-3; // ignore braces and / strncpy(end_name, tag->end_name+2, end_len); end_name[end_len] = 0x00; if(tag->end_name[1] != '/') { if(tag->value_len == 0) return 1; /* no match, treat as a child */ return -6; /* value with no end tag is incorrect */ } if(strcmp(start_name, end_name)) return -5; /* start an end tag don't match */ } if(validate_attributes(tag->attr_name, tag->attr_len)) return -2; if(validate_value(tag->value_name, tag->value_len)) return -3; if(validate_end_tag(tag->end_name, tag->end_len)) return -4; if(start_len) { str = malloc(start_len+1); if(!str) return -5; memcpy(str, start_name, start_len); str[start_len] = 0x00; tag->name = str; } if(tag->value_len) { str = malloc(tag->value_len+1); if(!str) return -6; memcpy(str, tag->value_name, tag->value_len); str[tag->value_len] = 0x00; tag->value = str; } if(tag->attr_len) { str = malloc(tag->attr_len+1); if(!str) return -7; memcpy(str, tag->attr_name, tag->attr_len); str[tag->attr_len] = 0x00; tag->attr = str; } return 0; /* match */ }
layer *read_mouse_layer(xmlDocPtr document, xmlNodePtr this_node) { // Local variables GString *message; // Used to construct message strings layer *tmp_layer; // Temporary layer layer_mouse *tmp_mouse_ob; // Temporary mouse layer object xmlChar *tmp_xmlChar; // Temporary xmlChar pointer gboolean usable_input = TRUE; // Used as a flag to indicate if all validation was successful gfloat *validated_gfloat; // Receives known good gfloat values from the validation function guint *validated_guint; // Receives known good guint values from the validation function GString *validated_string; // Receives known good strings from the validation function // Initialisation message = g_string_new(NULL); // Construct a new mouse pointer layer tmp_mouse_ob = g_new0(layer_mouse, 1); tmp_layer = g_new0(layer, 1); tmp_layer->object_type = TYPE_MOUSE_CURSOR; tmp_layer->object_data = (GObject *) tmp_mouse_ob; tmp_layer->external_link = g_string_new(NULL); tmp_layer->visible = TRUE; tmp_layer->background = FALSE; tmp_layer->external_link_window = g_string_new("_self"); tmp_layer->start_time = 0.0; tmp_layer->transition_in_type = TRANS_LAYER_NONE; tmp_layer->transition_in_duration = 0.0; tmp_layer->duration = get_default_layer_duration(); tmp_layer->transition_out_type = TRANS_LAYER_NONE; tmp_layer->transition_out_duration = 0.0; // Load the highlight layer values while (NULL != this_node) { if ((!xmlStrcmp(this_node->name, (const xmlChar *) "x_offset_start"))) { // Get the starting x offset tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(X_OFFSET, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED248: %s", _("Error"), _("There was something wrong with an x offset start value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->x_offset_start = 0; // Fill in the value, just to be safe } else { tmp_layer->x_offset_start = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "y_offset_start"))) { // Get the starting y offset tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(Y_OFFSET, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED249: %s", _("Error"), _("There was something wrong with a y offset start value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->y_offset_start = 0; // Fill in the value, just to be safe } else { tmp_layer->y_offset_start = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "x_offset_finish"))) { // Get the finishing x offset tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(X_OFFSET, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED250: %s", _("Error"), _("There was something wrong with an x offset finish value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->x_offset_finish = 0; // Fill in the value, just to be safe } else { tmp_layer->x_offset_finish = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "y_offset_finish"))) { // Get the finishing y offset tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(Y_OFFSET, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED251: %s", _("Error"), _("There was something wrong with a y offset finish value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->y_offset_finish = 0; // Fill in the value, just to be safe } else { tmp_layer->y_offset_finish = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "width"))) { // Get the width tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(LAYER_WIDTH, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED252: %s", _("Error"), _("There was something wrong with a layer width value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_mouse_ob->width = 1; // Fill in the value, just to be safe } else { tmp_mouse_ob->width = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "height"))) { // Get the height tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(LAYER_HEIGHT, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED253: %s", _("Error"), _("There was something wrong with a layer height value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_mouse_ob->height = 1; // Fill in the value, just to be safe } else { tmp_mouse_ob->height = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "click"))) { // Get the mouse click type tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_string = validate_value(MOUSE_CLICK, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_string) { g_string_printf(message, "%s ED254: %s", _("Error"), _("There was something wrong with a mouse click value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_mouse_ob->click = MOUSE_NONE; // Fill in the value, just to be safe } else { tmp_mouse_ob->click = MOUSE_NONE; // Set the default if (0 == g_ascii_strncasecmp(validated_string->str, "left_one", 8)) tmp_mouse_ob->click = MOUSE_LEFT_ONE; if (0 == g_ascii_strncasecmp(validated_string->str, "left_double", 11)) tmp_mouse_ob->click = MOUSE_LEFT_DOUBLE; if (0 == g_ascii_strncasecmp(validated_string->str, "left_triple", 11)) tmp_mouse_ob->click = MOUSE_LEFT_TRIPLE; if (0 == g_ascii_strncasecmp(validated_string->str, "right_one", 9)) tmp_mouse_ob->click = MOUSE_RIGHT_ONE; if (0 == g_ascii_strncasecmp(validated_string->str, "right_double", 12)) tmp_mouse_ob->click = MOUSE_RIGHT_DOUBLE; if (0 == g_ascii_strncasecmp(validated_string->str, "right_triple", 12)) tmp_mouse_ob->click = MOUSE_RIGHT_TRIPLE; if (0 == g_ascii_strncasecmp(validated_string->str, "middle_one", 10)) tmp_mouse_ob->click = MOUSE_MIDDLE_ONE; if (0 == g_ascii_strncasecmp(validated_string->str, "middle_double", 13)) tmp_mouse_ob->click = MOUSE_MIDDLE_DOUBLE; if (0 == g_ascii_strncasecmp(validated_string->str, "middle_triple", 13)) tmp_mouse_ob->click = MOUSE_MIDDLE_TRIPLE; g_string_free(validated_string, TRUE); validated_string = NULL; } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "start_time"))) { // Get the start time tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_gfloat = validate_value(LAYER_DURATION, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_gfloat) { g_string_printf(message, "%s ED344: %s", _("Error"), _("There was something wrong with a layer start time value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->start_time = 0; // Fill in the value, just to be safe } else { tmp_layer->start_time = *validated_gfloat; g_free(validated_gfloat); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "duration"))) { // Get the finish frame tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_gfloat = validate_value(LAYER_DURATION, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_gfloat) { g_string_printf(message, "%s ED345: %s", _("Error"), _("There was something wrong with a layer duration value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->duration = 0; // Fill in the value, just to be safe } else { tmp_layer->duration = *validated_gfloat; g_free(validated_gfloat); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "visible"))) { // Get the visibility tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_guint = validate_value(LAYER_VISIBLE, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_guint) { g_string_printf(message, "%s ED257: %s", _("Error"), _("There was something wrong with a layer visibility value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->visible = 0; // Fill in the value, just to be safe } else { tmp_layer->visible = *validated_guint; g_free(validated_guint); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "name"))) { // Get the name of the layer tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_string = validate_value(LAYER_NAME, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_string) { g_string_printf(message, "%s ED258: %s", _("Error"), _("There was something wrong with a layer name value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->name = g_string_new("Empty"); // Fill in the value, just to be safe } else { tmp_layer->name = validated_string; // We keep the validated string instead of copying then freeing it validated_string = NULL; } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "external_link"))) { // Get the URL associated with the layer tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_string = validate_value(EXTERNAL_LINK, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_string) { g_string_printf(message, "%s ED259: %s", _("Error"), _("There was something wrong with an external link value in the project file.")); display_warning(message->str); usable_input = FALSE; } else { tmp_layer->external_link = g_string_assign(tmp_layer->external_link, validated_string->str); g_string_free(validated_string,TRUE); validated_string = NULL; } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "external_link_window"))) { // Get the window to open the URL associated with the layer tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_string = validate_value(EXTERNAL_LINK_WINDOW, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_string) { g_string_printf(message, "%s ED260: %s", _("Error"), _("There was something wrong with an external link target window value in the project file.")); display_warning(message->str); usable_input = FALSE; } else { tmp_layer->external_link_window = g_string_assign(tmp_layer->external_link_window, validated_string->str); g_string_free(validated_string,TRUE); validated_string = NULL; } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "transition_in_type"))) { // Get the type of transition in tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_string = validate_value(TRANSITION_TYPE, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_string) { g_string_printf(message, "%s ED321: %s", _("Error"), _("There was something wrong with a transition in type value in the project file.")); display_warning(message->str); usable_input = FALSE; } else { if (0 == g_ascii_strncasecmp(validated_string->str, "fade", 4)) { tmp_layer->transition_in_type = TRANS_LAYER_FADE; } else { tmp_layer->transition_in_type = TRANS_LAYER_NONE; } g_string_free(validated_string, TRUE); validated_string = NULL; } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "transition_in_duration"))) { // Get the transition in duration tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_gfloat = validate_value(TRANSITION_DURATION, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_gfloat) { g_string_printf(message, "%s ED322: %s", _("Error"), _("There was something wrong with a transition in duration value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->transition_in_duration = 1; // Fill in the value, just to be safe } else { tmp_layer->transition_in_duration = *validated_gfloat; g_free(validated_gfloat); } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "transition_out_type"))) { // Get the type of transition out tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_string = validate_value(TRANSITION_TYPE, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_string) { g_string_printf(message, "%s ED323: %s", _("Error"), _("There was something wrong with a transition out type value in the project file.")); display_warning(message->str); usable_input = FALSE; } else { if (0 == g_ascii_strncasecmp(validated_string->str, "fade", 4)) { tmp_layer->transition_out_type = TRANS_LAYER_FADE; } else { tmp_layer->transition_out_type = TRANS_LAYER_NONE; } g_string_free(validated_string, TRUE); validated_string = NULL; } } if ((!xmlStrcmp(this_node->name, (const xmlChar *) "transition_out_duration"))) { // Get the transition out duration tmp_xmlChar = xmlNodeListGetString(document, this_node->xmlChildrenNode, 1); validated_gfloat = validate_value(TRANSITION_DURATION, V_CHAR, tmp_xmlChar); xmlFree(tmp_xmlChar); if (NULL == validated_gfloat) { g_string_printf(message, "%s ED324: %s", _("Error"), _("There was something wrong with a transition out duration value in the project file.")); display_warning(message->str); usable_input = FALSE; tmp_layer->transition_out_duration = 1; // Fill in the value, just to be safe } else { tmp_layer->transition_out_duration = *validated_gfloat; g_free(validated_gfloat); } } this_node = this_node->next; } // Free memory allocated in this function g_string_free(message, TRUE); // Return the validated mouse layer, or an indicator of failure if (TRUE == usable_input) { return tmp_layer; } else { // Free the newly allocated mouse layer data, as it didn't pass validation, so we won't use it layer_free(tmp_layer); return NULL; } }
bool he_value_page_c::validate_this() { if (!m_input->IsEnabled()) return true; return validate_value(); }