File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ open class AnyImageHDU : AnyHDU {
42
42
43
43
var new = Data ( )
44
44
vectors. forEach { vector in
45
- let data = vector. withUnsafeBytes { ptr in
45
+ // and don't foret the bigEndian here or data is screwed (Fixing issue #14)
46
+ let data = vector. bigEndian. withUnsafeBytes { ptr in
46
47
Data ( buffer: ptr. bindMemory ( to: ByteFormat . self) )
47
48
}
48
49
new. append ( data)
@@ -63,7 +64,8 @@ open class AnyImageHDU : AnyHDU {
63
64
64
65
var new = Data ( )
65
66
vectors. forEach { vector in
66
- let data = vector. withUnsafeBytes { ptr in
67
+ // and don't foret the bigEndian here or data is screwed (Fixing issue #14)
68
+ let data = vector. bigEndian. withUnsafeBytes { ptr in
67
69
Data ( buffer: ptr. bindMemory ( to: ByteFormat . self) )
68
70
}
69
71
new. append ( data)
@@ -103,12 +105,14 @@ open class AnyImageHDU : AnyHDU {
103
105
104
106
if var data = self . dataUnit as? Data {
105
107
// append to data unit
106
- vector. withUnsafeBytes { ptr in
108
+ // and don't foret the bigEndian here or data is screwed (Fixing issue #14)
109
+ vector. bigEndian. withUnsafeBytes { ptr in
107
110
data. append ( ptr. bindMemory ( to: ByteFormat . self) )
108
111
}
109
112
} else {
110
113
// set data unit
111
- self . dataUnit = vector. withUnsafeBytes { ptr in
114
+ // and don't foret the bigEndian here or data is screwed (Fixing issue #14)
115
+ self . dataUnit = vector. bigEndian. withUnsafeBytes { ptr in
112
116
Data ( buffer: ptr. bindMemory ( to: ByteFormat . self) )
113
117
}
114
118
You can’t perform that action at this time.
0 commit comments