Skip to content

Commit

Permalink
fixes for current V version
Browse files Browse the repository at this point in the history
  • Loading branch information
bstnbuck committed Mar 3, 2024
1 parent 02c9d1e commit 9416846
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions vshred.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import rand
import os
import flag

const (
// 1MB
buffersize = 1048576
)
// 1MB
const buffersize = 1048576

struct Options {
no_stop bool
Expand Down Expand Up @@ -121,15 +119,15 @@ fn shred_file(file_str string, rounds int, options Options) ! {
// use buffersize for byte array length
if (file_len_temp + buffersize) <= file_len && file_len > buffersize {
if i != rounds {
mut random_bytes := []byte{}
mut random_bytes := []u8{}

// create new output as random byte array of buffer size
for _ in 0 .. buffersize {
random_bytes << rand.u8()
}
f.write_to(file_len_temp, random_bytes)!
} else {
mut nulls_bytes := []byte{}
mut nulls_bytes := []u8{}

// create new output as random byte array of buffer size
for _ in 0 .. buffersize {
Expand All @@ -140,15 +138,15 @@ fn shred_file(file_str string, rounds int, options Options) ! {
file_len_temp += buffersize
} else {
if i != rounds {
mut random_bytes := []byte{}
mut random_bytes := []u8{}

// create new output as random byte array of buffer size
for _ in 0 .. file_len - file_len_temp {
random_bytes << rand.u8()
}
f.write_to(file_len_temp, random_bytes)!
} else {
mut nulls_bytes := []byte{}
mut nulls_bytes := []u8{}

// create new output as random byte array of buffer size
for _ in 0 .. file_len - file_len_temp {
Expand Down

0 comments on commit 9416846

Please sign in to comment.