Skip to content

Commit 891d4c1

Browse files
committed
Shorten the number of passes for performance reasons. Also fix memory leak
1 parent b10f1da commit 891d4c1

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

src/corrupt.c

+2-14
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,12 @@ static uint8_t corrupt_step(RaiderCorrupt* corrupt, const off_t filesize, const
102102
fwrite(pattern, sizeof(char), length, fp);
103103
if (g_task_return_error_if_cancelled (corrupt->task)) {fclose(fp);return 1;}
104104

105-
double current = ((double)loop_num/32.0) + (double)i/times*1.0/32.0;
105+
double current = ((double)loop_num/10.0) + (double)i/times*1.0/10.0;
106106

107107
// Only update the progress when the jump is large enough.
108108
if (current - corrupt->progress >= .01)
109109
{
110110
corrupt->progress = current;
111-
printf("%d, %f\n", loop_num, current);
112111
raider_file_row_set_progress_num(corrupt->row, corrupt->progress);
113112
g_main_context_invoke (NULL, raider_file_row_set_progress, corrupt->row);
114113

@@ -124,19 +123,8 @@ uint8_t corrupt_file(RaiderCorrupt* corrupt)
124123
const char* steps[] = {"\x77\x77\x77", "\x76\x76\x76",
125124
"\x33\x33\x33", "\x35\x35\x35",
126125
"\x55\x55\x55", "\xAA\xAA\xAA",
127-
"\x92\x49\x24", "\x49\x24\x92",
128-
"\x55\x55\x55", "\x20\x02\x03",
129-
"\x11\x11\x11", "\x01\x01\x01",
130-
"\x22\x22\x22", "\x33\x33\x33",
131126
"\x44\x44\x44", "\x55\x55\x55",
132-
"\x66\x66\x66", "\x77\x77\x77",
133-
"\x88\x88\x88", "\x99\x99\x99",
134-
"\xAA\xAA\xAA", "\xBB\xBB\xBB",
135-
"\xCC\xCC\xCC", "\xDD\xDD\xDD",
136-
"\xEE\xEE\xEE", "\xFF\xFF\xFF",
137-
"\x92\x49\x24", "\x49\x24\x92",
138-
"\x24\x92\x49", "\x6D\xB6\xDB",
139-
"\xB6\xDB\x6D", "\xDB\x6D\xB6"};
127+
"\x66\x66\x66", "\x77\x77\x77"};
140128

141129
int steps_num = sizeof(steps) / sizeof(steps[0]);
142130
uint8_t ret = 0;

src/raider-file-row.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ static void raider_file_row_close (GtkWidget* window, gpointer data)
128128
/** Shredding section */
129129
void shredding_finished(GObject *source_object, GAsyncResult *res, gpointer user_data)
130130
{
131-
printf("Done\n");
132-
133131
RaiderFileRow* row = g_task_get_task_data(G_TASK(res));
134132

135133
g_mutex_unlock (&row->mutex);
134+
g_object_unref(row->cancel);
136135

137136
/* Make sure that the user can use the window after the row is destroyed. */
138137
gtk_widget_set_visible(GTK_WIDGET(row->popover), FALSE);

0 commit comments

Comments
 (0)