Skip to content

Commit 9cf7d98

Browse files
committed
docs: Fix markdown
Replace tabs with spaces in docs Signed-off-by: Kostis Papazafeiropoulos <papazof@gmail.com>
1 parent db359b6 commit 9cf7d98

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

docs/using-the-vaccel-go-package.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ Those functions must follow a specific signature, which is presented below:
116116
```go
117117
/* Let's say you want to handle the following structure */
118118
type MyData struct {
119-
Size uint32
120-
Arr []uint32
119+
Size uint32
120+
Arr []uint32
121121
}
122122

123123
/*
@@ -128,44 +128,44 @@ type MyData struct {
128128
*/
129129
func Serialize(buf unsafe.Pointer) (unsafe.Pointer, uint32) {
130130

131-
mydata := (*MyData)(buf)
132-
serialBuf := make([]uint32, mydata.Size + 1)
133-
serialBuf[0] = uint32(mydata.Size)
131+
mydata := (*MyData)(buf)
132+
serialBuf := make([]uint32, mydata.Size + 1)
133+
serialBuf[0] = uint32(mydata.Size)
134134

135-
var i uint32
136-
for i=0; i<mydata.Size; i++ {
137-
serialBuf[i + 1] = mydata.Arr[i]
138-
}
135+
var i uint32
136+
for i=0; i<mydata.Size; i++ {
137+
serialBuf[i + 1] = mydata.Arr[i]
138+
}
139139

140-
retBuf := unsafe.Pointer(&serialBuf[0])
141-
bytes := (mydata.Size + 1) * 4
140+
retBuf := unsafe.Pointer(&serialBuf[0])
141+
bytes := (mydata.Size + 1) * 4
142142

143-
return retBuf, bytes
143+
return retBuf, bytes
144144
}
145145

146146
/* Function that constructs an instance of MyData out of serialized data */
147147
func Deserialize(buf unsafe.Pointer) unsafe.Pointer {
148148

149-
sizeExtr := *((*uint32)(buf))
149+
sizeExtr := *((*uint32)(buf))
150150

151-
/* Convert unsafe.Pointer to Slice */
152-
var slice []uint32
153-
header := (*reflect.SliceHeader)(unsafe.Pointer(&slice))
154-
header.Data = uintptr(buf)
155-
header.Len = int(sizeExtr + 1)
156-
header.Cap = int(sizeExtr + 1)
151+
/* Convert unsafe.Pointer to Slice */
152+
var slice []uint32
153+
header := (*reflect.SliceHeader)(unsafe.Pointer(&slice))
154+
header.Data = uintptr(buf)
155+
header.Len = int(sizeExtr + 1)
156+
header.Cap = int(sizeExtr + 1)
157157

158-
/* Reconstruct the structure */
159-
mydatabuf := new(MyData)
160-
mydatabuf.Size = sizeExtr
161-
mydatabuf.Arr = make([]uint32, sizeExtr)
158+
/* Reconstruct the structure */
159+
mydatabuf := new(MyData)
160+
mydatabuf.Size = sizeExtr
161+
mydatabuf.Arr = make([]uint32, sizeExtr)
162162

163-
var i uint32
164-
for i=0; i<sizeExtr; i++ {
165-
mydatabuf.Arr[i] = slice[i + 1]
166-
}
163+
var i uint32
164+
for i=0; i<sizeExtr; i++ {
165+
mydatabuf.Arr[i] = slice[i + 1]
166+
}
167167

168-
return unsafe.Pointer(mydatabuf)
168+
return unsafe.Pointer(mydatabuf)
169169
}
170170
```
171171

@@ -178,7 +178,7 @@ var myDataInput MyData = ...
178178
err = read.AddNonSerialArg(&myDataInput, 0, Serialize)
179179

180180
if err != 0 {
181-
[...]
181+
[...]
182182
}
183183
```
184184

@@ -188,7 +188,7 @@ if err != 0 {
188188
outbuf := write.ExtractNonSerialArg(0, Deserialize)
189189

190190
if outbuf == nil {
191-
[...]
191+
[...]
192192
}
193193

194194
mydata_out := (*MyData)(outbuf)

0 commit comments

Comments
 (0)