1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Merge pull request #987 from ChiefGokhlayeh/pr/#986

Random bytes appended to rescuesdriq output and wrong timestamp
This commit is contained in:
Edouard Griffiths 2021-08-19 01:46:15 +02:00 committed by GitHub
commit 7bd741ab3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,18 +84,15 @@ func copyContent(reader *bufio.Reader, writer *bufio.Writer, blockSize uint) {
for {
n, err := reader.Read(p)
if err != nil {
if err == io.EOF {
if err == nil || err == io.EOF {
writer.Write(p[0:n])
sz += int64(n)
break
} else {
fmt.Println("An error occurred during content copy. Aborting")
if err == io.EOF {
break
}
} else {
writer.Write(p)
sz += int64(blockSize) * 4096
fmt.Println("An error occurred during content copy. Aborting")
break
}
fmt.Printf("Wrote %d bytes\r", sz)
@ -133,6 +130,11 @@ func main() {
// make a read buffer
reader := bufio.NewReader(fi)
var headerOrigin HeaderStd = analyze(reader)
if !*assumeMilliseconds {
headerOrigin.StartTimestamp = headerOrigin.StartTimestamp * (int64(time.Second) / int64(time.Millisecond))
}
printHeader(&headerOrigin)
if flagSeen["out"] {
@ -160,8 +162,6 @@ func main() {
}
} else if *timeNow {
headerOrigin.StartTimestamp = int64(time.Now().UnixNano() / int64(time.Millisecond))
} else if !*assumeMilliseconds {
headerOrigin.StartTimestamp = headerOrigin.StartTimestamp * (int64(time.Millisecond) / int64(time.Second))
}
fmt.Println("\nHeader is now")