MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / read_log

Function read_log

gtk/src/queuehandler.c:840–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838
839#define ACTIVITY_MAX_READ_SZ (1024*1024)
840static void read_log (signal_user_data_t * ud, const char * log_path)
841{
842 FILE * f;
843 size_t size, req_size;
844 GtkTextIter iter;
845 char * buf;
846
847 if (ud->extra_activity_path != NULL &&
848 !strcmp(ud->extra_activity_path, log_path))
849 {
850 return;
851 }
852 g_free(ud->extra_activity_path);
853 ud->extra_activity_path = g_strdup(log_path);
854
855 gtk_text_buffer_set_text(ud->extra_activity_buffer, "", 0);
856
857 f = g_fopen(log_path, "r");
858 if (f == NULL)
859 {
860 return;
861 }
862 fseek(f, 0, SEEK_END);
863 req_size = ftell(f);
864 fseek(f, 0, SEEK_SET);
865 if (req_size > ACTIVITY_MAX_READ_SZ)
866 {
867 req_size = ACTIVITY_MAX_READ_SZ;
868 }
869 buf = g_malloc(req_size);
870 while (!feof(f))
871 {
872 size = fread(buf, 1, req_size, f);
873 if (size <= 0)
874 {
875 break;
876 }
877 gtk_text_buffer_get_end_iter(ud->extra_activity_buffer, &iter);
878 gtk_text_buffer_insert(ud->extra_activity_buffer, &iter, buf, size);
879 }
880 fclose(f);
881 g_free(buf);
882}
883
884// Display/Hide queue activity log pane
885// Choose buffer to display. Queue logs use 1 of 2 available buffers

Callers 1

ghb_queue_select_logFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected