int upload_kernelcache() { struct stat buf; char kernelcache[255]; irecv_error_t error = IRECV_E_SUCCESS; memset(kernelcache, '\0', 255); memset(&buf, '\0', sizeof(buf)); snprintf(kernelcache, 254, "kernelcache.release.%c%c%c", device->model[0], device->model[1], device->model[2]); debug("Checking if kernelcache already exists\n"); if (stat(kernelcache, &buf) != 0) { if (fetch_image(kernelcache, kernelcache) < 0) { error("Unable to upload kernelcache\n"); return -1; } } debug("Resetting device counters\n"); error = irecv_reset_counters(client); if (error != IRECV_E_SUCCESS) { debug("%s\n", irecv_strerror(error)); error("Unable upload kernelcache\n"); return -1; } error = irecv_send_file(client, kernelcache, 1); if (error != IRECV_E_SUCCESS) { debug("%s\n", irecv_strerror(error)); error("Unable upload kernelcache\n"); return -1; } return 0; }
void MainWindow::set_preview_photo(PhotoInfo pi) { PhotoMetaData pmd; QString absolute_file_name = photos_root.absoluteFilePath(pi.relative_file_path); this->statusBar()->showMessage(absolute_file_name); QImage pmI; if(photos_root.exists(pi.relative_file_path)) { pmI = fetch_image(absolute_file_name, ui->QL_preview->size(), pmd); } else {//Photo reference in db but not on disk pmd.valid = false; pmI.load(":/Images/Icons/chhobi-icon.png"); qDebug() << pi.relative_file_path << ": If this zombie is not purged next load, we have a coding error"; } preview.set_meta_data(pmd); if(pmd.type == PHOTO) preview.set_pixmap(QPixmap::fromImage(pmI)); else if(pmd.type == MOVIE) preview.set_pixmap(QPixmap(":/Images/Icons/cholochitro.png")); ui->QL_preview->setPixmap(preview.get_photo()); ui->captionEdit->setText(pmd.caption); set_datetime(pmd); set_metadata_table(pmd); set_keywords_table(pmd); }
static void * thread_routine(void * arg) { SDL_Surface * surf = NULL; loader_t * loader = (loader_t *)arg; engine_t * engine = loader->engine; image_fifo_t * image_fifo = loader->image_fifo; img_t *img; while(1) { surf = fetch_image(engine); if(surf == NULL ) { continue; } img=malloc(sizeof(img_t)); memset(img,0,sizeof(img_t)); img->surf = surf; img->ratio = (double)(img->surf->w) / (double)(img->surf->h); if( img->ratio > 1.0 ) { img->w = 1.0; img->h = 1.0/img->ratio; } else { img->w = 1.0*img->ratio; img->h = 1.0; } image_fifo_push( image_fifo, img ); } return NULL; }
Image::Image(const Glib::RefPtr<Post> &post_, const std::shared_ptr<ImageFetcher>& image_fetcher, sigc::slot<void, const ImageState&> state_change_callback) : Gtk::Bin(), post(post_), event_box(Gtk::manage(new Gtk::EventBox())), image(Gtk::manage(new Gtk::Image())), image_state(NONE), is_changing_state(false), scaled_width(-1), scaled_height(-1), is_scaled(false), am_fetching_thumb(false), am_fetching_image(false), canceller(std::make_shared<Canceller>()), ifetcher(image_fetcher) { set_has_window(false); set_redraw_on_allocate(false); set_name("imagewindow"); event_box->set_events(Gdk::BUTTON_PRESS_MASK); event_box->set_visible_window(false); event_box->signal_button_press_event().connect( sigc::mem_fun(*this, &Image::on_image_click) ); image->set_name("image"); image->set_halign(Gtk::ALIGN_START); image->set_valign(Gtk::ALIGN_START); event_box->add(*image); add(*event_box); state_changed_dispatcher.connect(sigc::mem_fun(*this, &Image::run_state_changed_callbacks)); signal_state_changed.connect(state_change_callback); if (post->has_image()) { std::string ext = post->get_image_ext(); if (ext.compare(".gif") == 0) { fetch_image(); } else { fetch_thumbnail(); } } else { g_error("Horizon::Image created for post %" G_GINT64_FORMAT " that has no image.", post->get_id()); } image->signal_unmap() .connect(sigc::mem_fun(*this, &Image::on_image_unmap)); image->signal_unrealize().connect(sigc::mem_fun(*this, &Image::on_image_unrealize)); image->signal_draw() .connect(sigc::mem_fun(*this, &Image::on_image_draw), false); }
static void web_set_url_cover_art(GtkClipboard* board, const gchar* uri, gpointer p) { library_view_t* view = (library_view_t* ) p; if (uri != NULL) { char* image_uri = mc_strdup(uri); hre_trim(image_uri); log_debug3("got uri %s, view = %p", image_uri, view); if ((strncasecmp(image_uri, "http://", 7) == 0) || (strncasecmp(image_uri, "https://", 8) == 0)) { GtkTreeSelection* sel = gtk_tree_view_get_selection(view->tview); GtkTreeModel* model; GtkTreeIter iter; log_debug2("tree selection: %p", sel); if (gtk_tree_selection_get_selected(sel, &model, &iter)) { log_debug("ok"); int row = gtk_list_model_iter_to_row(GTK_LIST_MODEL(model), iter); track_t* track = playlist_model_get_track(view->playlist_model, row); log_debug2("track = %p", track); const char* artid = track_get_artid(track); log_debug3("fetch image %s, %s", image_uri, artid); fetch_image(image_uri, artid, image_fetched, view); } else { GtkMessageDialog* dialog = GTK_MESSAGE_DIALOG( gtk_message_dialog_new(btb_main_window(view->btb), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Please select a track to set the cover art for") ) ); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (GTK_WIDGET(dialog)); } } else { GtkMessageDialog* dialog = GTK_MESSAGE_DIALOG( gtk_message_dialog_new (btb_main_window(view->btb), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _("Copy an http URL for an image to the clipboard") ) ); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (GTK_WIDGET(dialog)); } mc_free(image_uri); } }
int fetch_firmware_image(const char* type, const char* output) { char name[64]; char path[255]; memset(name, '\0', 64); memset(path, '\0', 255); snprintf(name, 63, "%s.%s.img3", type, device->model); snprintf(path, 254, "Firmware/all_flash/all_flash.%s.production/%s", device->model, name); debug("Preparing to fetch firmware image from Apple's servers\n"); if (fetch_image(path, output) < 0) { error("Unable to fetch firmware image from Apple's servers\n"); } return 0; }
int fetch_dfu_image(const char* type, const char* output) { char name[64]; char path[255]; memset(name, '\0', 64); memset(path, '\0', 255); snprintf(name, 63, "%s.%s.RELEASE.dfu", type, device->model); snprintf(path, 254, "Firmware/dfu/%s", name); debug("Preparing to fetch DFU image from Apple's servers\n"); if (fetch_image(path, output) < 0) { error("Unable to fetch DFU image from Apple's servers\n"); return -1; } return 0; }
void Image::set_state(const ImageState new_state) { switch (new_state) { case NONE: set_none_state(); break; case THUMBNAIL: set_thumb_state(); break; case EXPAND: case FULL: if (!unscaled_image) { is_changing_state = true; fetch_image(); } else { set_expand_state(); } break; } }
static bool download_by_checksum(flow_c * c, char * checksum, const char * storage_relative_to) { char filename[2048]; if (!create_path_from_relative(c, storage_relative_to, true, filename, 2048, "/visuals/%s.png", checksum)) { FLOW_add_to_callstack(c); return false; } fprintf(stderr, "%s (trusted)\n", &filename[0]); if (access(filename, F_OK) != -1) { return true; // Already exists! } char url[2048]; flow_snprintf(url, 2048, "http://s3-us-west-2.amazonaws.com/imageflow-resources/visual_test_checksums/%s.png", checksum); // TODO: fix actual URL if (!fetch_image(url, filename)) { FLOW_add_to_callstack(c); return false; } return true; }
/* TODO: spoiler state */ bool Image::on_image_click(GdkEventButton *) { switch (image_state) { case NONE: break; case THUMBNAIL: if (!unscaled_image) { fetch_image(); is_changing_state = true; } else { set_expand_state(); } break; case EXPAND: // For now fall through, we don't have a 'Full' implementation case FULL: set_thumb_state(); break; default: break; } return true; }