void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asset_id, const Ref<Texture> &p_preview, const String &p_download_url, const String &p_sha256_hash) { title->set_text(p_title); icon->set_texture(p_preview); asset_id = p_asset_id; if (!p_preview.is_valid()) icon->set_texture(get_icon("GodotAssetDefault", "EditorIcons")); host = p_download_url; sha256 = p_sha256_hash; asset_installer->connect("confirmed", this, "_close"); dismiss->set_normal_texture(get_icon("Close", "EditorIcons")); _make_request(); }
static int _copy_allocation(char *com, List allocated_blocks) { ListIterator results_i; allocated_block_t *allocated_block = NULL; allocated_block_t *temp_block = NULL; select_ba_request_t *request = NULL; int i = 1, j; int len = strlen(com); char letter = '\0'; int count = 1; int *geo = NULL, *geo_ptr = NULL; /* look for the space after copy */ while ((com[i-1] != ' ') && (i < len)) i++; if (i <= len) { /* Here we are looking for a real number for the count * instead of the params.cluster_base so atoi is ok */ if ((com[i] >= '0') && (com[i] <= '9')) count = atoi(com+i); else { letter = com[i]; i++; if (com[i] != '\n') { while ((com[i-1] != ' ') && (i < len)) i++; if ((com[i] >= '0') && (com[i] <= '9')) count = atoi(com+i); } } } results_i = list_iterator_create(allocated_blocks); while ((allocated_block = list_next(results_i)) != NULL) { temp_block = allocated_block; if (allocated_block->letter != letter) continue; break; } list_iterator_destroy(results_i); if (!letter) allocated_block = temp_block; if (!allocated_block) { memset(error_string, 0, 255); sprintf(error_string, "Could not find requested record to copy"); return 0; } for (i = 0; i < count; i++) { request = (select_ba_request_t*) xmalloc(sizeof(select_ba_request_t)); for (j = 0; j < params.cluster_dims; j++) { request->geometry[j] = allocated_block->request-> geometry[j]; request->conn_type[j] = allocated_block->request-> conn_type[j]; } request->size = allocated_block->request->size; request->rotate =allocated_block->request->rotate; request->elongate = allocated_block->request->elongate; request->deny_pass = allocated_block->request->deny_pass; #ifndef HAVE_BGL request->small16 = allocated_block->request->small16; request->small64 = allocated_block->request->small64; request->small256 = allocated_block->request->small256; #endif request->small32 = allocated_block->request->small32; request->small128 = allocated_block->request->small128; request->rotate_count= 0; request->elongate_count = 0; request->elongate_geos = list_create(NULL); request->avail_mp_bitmap = NULL; results_i = list_iterator_create(request->elongate_geos); while ((geo_ptr = list_next(results_i)) != NULL) { geo = xmalloc(sizeof(int) * params.cluster_dims); for (j = 0; j < params.cluster_dims; j++) geo[j] = geo_ptr[j]; list_append(request->elongate_geos, geo); } list_iterator_destroy(results_i); if ((allocated_block = _make_request(request)) == NULL) { memset(error_string, 0, 255); sprintf(error_string, "Problem with the copy\n" "Are you sure there is enough room for it?"); xfree(request); return 0; } list_append(allocated_blocks, allocated_block); } return 1; }
static int _full_request(select_ba_request_t *request, bitstr_t *usable_mp_bitmap, List allocated_blocks) { char *tmp_char = NULL, *tmp_char2 = NULL; allocated_block_t *allocated_block; int rc = 1; if (!strcasecmp(layout_mode,"OVERLAP")) bg_configure_reset_ba_system(true); if (usable_mp_bitmap) bg_configure_ba_set_removable_mps(usable_mp_bitmap, 1); /* * Here is where we do the allocating of the partition. * It will send a request back which we will throw into * a list just incase we change something later. */ if (!bg_configure_new_ba_request(request)) { memset(error_string, 0, 255); if (request->size != -1) { sprintf(error_string, "Problems with request for %d\n" "Either you put in something " "that doesn't work,\n" "or we are unable to process " "your request.", request->size); rc = 0; } else { tmp_char = bg_configure_give_geo(request->geometry, params.cluster_dims, 1); sprintf(error_string, "Problems with request of size %s\n" "Either you put in something " "that doesn't work,\n" "or we are unable to process " "your request.", tmp_char); xfree(tmp_char); rc = 0; } } else { if ((allocated_block = _make_request(request)) != NULL) list_append(allocated_blocks, allocated_block); else { if (request->geometry[0] != (uint16_t)NO_VAL) tmp_char = bg_configure_give_geo( request->geometry, params.cluster_dims, 1); tmp_char2 = bg_configure_give_geo(request->start, params.cluster_dims, 1); memset(error_string, 0, 255); sprintf(error_string, "allocate failure\nSize requested " "was %d MidPlanes\n", request->size); if (tmp_char) { sprintf(error_string + strlen(error_string), "Geo requested was %s\n", tmp_char); xfree(tmp_char); } else { sprintf(error_string + strlen(error_string), "No geometry could be laid out " "for that size\n"); } sprintf(error_string + strlen(error_string), "Start position was %s", tmp_char2); xfree(tmp_char2); rc = 0; } } if (usable_mp_bitmap) bg_configure_ba_reset_all_removed_mps(); return rc; }