Rob Pike
30b1b9a36a
Rework gobs to fix bad bug related to sharing of id's between encoder and decoder side.
...
Fix is to move all decoder state into the decoder object.
Fixes #215 .
R=rsc
CC=golang-dev
https://golang.org/cl/155077
2009-11-16 23:32:30 -08:00
Robert Griesemer
baba292998
- replaced gofmt expression formatting algorithm with
...
rsc's algorithm
- applied gofmt -w misc src
- partial CL (remaining files in other CLs)
R=rsc, r
http://go/go-review/1026036
2009-11-09 21:13:17 -08:00
Robert Griesemer
40621d5c0d
remove semis after statements in one-statement statement lists
...
R=rsc, r
http://go/go-review/1025029
2009-11-09 12:07:39 -08:00
Robert Griesemer
a05a5465c8
- application of gofmt with one-line composite literal structs enabled
...
- this CL is dependent on CL 1025008
R=r, rsc
http://go/go-review/1025009
2009-11-06 16:33:53 -08:00
Robert Griesemer
368f8cbc75
- fine-tuning of one-line func heuristic (nodes.go)
...
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)
R=r, rsc
CC=go-dev
http://go/go-review/1026006
2009-11-06 14:24:38 -08:00
Robert Griesemer
8cd2e76404
- gofmt'ing of some stragglers, now with correct comment indentation
...
in special cases
- re-gofmt'ing of some files that are now improved
R=r, rsc
http://go/go-review/1023003
2009-11-05 17:02:55 -08:00
Robert Griesemer
f65e42d039
gofmt-ify gob
...
(the one-line struct types used in composite literals will become
one line again in another cleanup round; don't worry about them now)
R=r
http://go/go-review/1016056
2009-11-05 14:53:42 -08:00
Rob Pike
c0e0f82e49
better code for allocation through indirection
...
R=rsc
DELTA=11 (3 added, 5 deleted, 3 changed)
OCL=35583
CL=35583
2009-10-11 18:07:47 -07:00
Rob Pike
330ab5fddb
fix bugs in gob.
...
1) didn't handle attempts to encode non-structs properly.
2) if there were multiple indirections involving allocation, didn't allocate the
intermediate cells.
tests added.
R=rsc
DELTA=82 (65 added, 5 deleted, 12 changed)
OCL=35582
CL=35582
2009-10-11 17:37:22 -07:00
Russ Cox
094f1d5990
more lgtm files from gofmt
...
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00
Russ Cox
c2ec9583a0
apply gofmt to go, gob, hash, http, image, io, json, log
...
R=gri
DELTA=1359 (138 added, 32 deleted, 1189 changed)
OCL=35408
CL=35420
2009-10-06 19:41:51 -07:00
Rob Pike
6efd7e6b8f
move strings.Buffer into bytes
...
delete strings.Buffer
add a test for a bug not caught before (mustn't install zero-length blocks)
R=rsc
DELTA=987 (289 added, 587 deleted, 111 changed)
OCL=34850
CL=34850
2009-09-21 12:59:14 -07:00
Rob Pike
fed4770685
step 2 of the great buffer shift.
...
make strings.Buffer handle strings and bytes with comparable efficiency.
if ok, next step will be to move this code to bytes.Buffer and terminate
strings.Buffer's short happy life.
R=rsc
DELTA=292 (212 added, 0 deleted, 80 changed)
OCL=34837
CL=34849
2009-09-21 12:20:15 -07:00
Rob Pike
7be770071f
use buf.String() instead of string(buf.Bytes())
...
use strings.Buffer instead of bytes.Buffer in some places
R=rsc
DELTA=40 (0 added, 3 deleted, 37 changed)
OCL=34770
CL=34775
2009-09-17 23:51:06 -07:00
Russ Cox
20011bc878
unused imports
...
R=r
OCL=34731
CL=34731
2009-09-17 10:27:04 -07:00
Rob Pike
d5be41fc4e
rename bytes.Buffer.Data() to bytes.Buffer.Bytes()
...
R=rsc
DELTA=152 (6 added, 0 deleted, 146 changed)
OCL=34695
CL=34701
2009-09-16 15:15:00 -07:00
Russ Cox
ca6a0fee1b
more "declared and not used".
...
the last round omitted := range and only
checked 1 out of N vars in a multi-var :=
R=r
OCL=34624
CL=34638
2009-09-15 09:41:59 -07:00
Russ Cox
28eba4877b
fix "declared and not used" errors in non-test code.
...
R=r
DELTA=112 (6 added, 57 deleted, 49 changed)
OCL=34610
CL=34610
2009-09-14 17:20:29 -07:00
Rob Pike
f966ba1df9
use the new type switch multicase to clean up a little.
...
R=rsc
DELTA=28 (7 added, 16 deleted, 5 changed)
OCL=34487
CL=34487
2009-09-09 10:32:26 -07:00
Russ Cox
58a0d6cebc
two gob nits found with stricter 6g
...
(6g had a few pretty major bugs
where it was more lax than it should
have been when checking when things
satisfied interfaces; i fixed them and
this turned up.)
R=r
DELTA=2 (0 added, 0 deleted, 2 changed)
OCL=34243
CL=34248
2009-09-02 09:03:42 -07:00
Rob Pike
c62b9d8f2a
can't encode array or slice - catch in sendType rather than failing in Encode
...
R=rsc
DELTA=38 (33 added, 3 deleted, 2 changed)
OCL=34101
CL=34104
2009-08-30 19:46:35 -07:00
Russ Cox
26a2642fc3
fix codec test bug - uint -> uint8
...
R=r
OCL=33913
CL=33913
2009-08-26 16:19:59 -07:00
Russ Cox
b5c57fea96
delete forward type declarations
...
R=r
DELTA=163 (1 added, 149 deleted, 13 changed)
OCL=33106
CL=33111
2009-08-12 14:40:47 -07:00
Russ Cox
a5bf45e389
convert gob to whole-package compilation.
...
had to reorder some init code.
R=r
DELTA=136 (15 added, 110 deleted, 11 changed)
OCL=33071
CL=33102
2009-08-12 13:19:27 -07:00
Rob Pike
98607d01fc
handle unsupported types safely.
...
R=rsc
DELTA=154 (71 added, 6 deleted, 77 changed)
OCL=32483
CL=32492
2009-07-29 17:24:25 -07:00
Rob Pike
1fc0960fb4
clean up EOF
...
R=rsc
DELTA=5 (0 added, 1 deleted, 4 changed)
OCL=32465
CL=32467
2009-07-29 15:24:42 -07:00
Rob Pike
1f6e18fdce
handle some error conditions involving bad data.
...
R=rsc
DELTA=32 (24 added, 1 deleted, 7 changed)
OCL=32461
CL=32463
2009-07-29 15:10:29 -07:00
Rob Pike
b85147cd70
change the encoding of uints to simplify overflow checking and to make them
...
easier and faster to read. they are now either a one-byte value or a n-byte value
preceded by a byte holding -n.
R=rsc
DELTA=150 (45 added, 7 deleted, 98 changed)
OCL=32381
CL=32387
2009-07-28 17:20:19 -07:00
Russ Cox
123ff2ebb8
bug177: anonymous struct fields in reflect
...
(reported by iant)
R=r
DELTA=50 (32 added, 12 deleted, 6 changed)
OCL=32263
CL=32385
2009-07-28 17:01:46 -07:00
Rob Pike
483e4fc409
- clean up code creating keys for type maps
...
- derive int, uint, float, uintptr decoders based on their size
- add overflow checks in decode
R=rsc
DELTA=407 (281 added, 44 deleted, 82 changed)
OCL=32286
CL=32290
2009-07-28 12:59:39 -07:00
Russ Cox
ca01716934
fix build - broke with uint32 -> int change in reflect SliceHeader
...
TBR=r
OCL=32225
CL=32225
2009-07-27 11:23:49 -07:00
Rob Pike
5aa174557a
clean up for public use: make some stuff private, add doc comments.
...
R=rsc
DELTA=298 (202 added, 0 deleted, 96 changed)
OCL=32006
CL=32224
2009-07-27 11:02:06 -07:00
Rob Pike
ba0cf083a2
change reflect.Type.Name() into two functions: Name() and PkgPath() for ease of use.
...
R=rsc
DELTA=31 (8 added, 2 deleted, 21 changed)
OCL=31778
CL=31792
2009-07-17 14:20:33 -07:00
Rob Pike
cb0a02f028
ignore missing structs
...
R=rsc
DELTA=113 (74 added, 14 deleted, 25 changed)
OCL=31776
CL=31776
2009-07-17 11:38:31 -07:00
Rob Pike
be2cf952a8
clean up the code, flow errors out to decoder.
...
R=rsc
DELTA=99 (32 added, 22 deleted, 45 changed)
OCL=31759
CL=31759
2009-07-16 23:01:10 -07:00
Rob Pike
1399badb02
- allow wire type and receive type to differ.
...
- still TODO: ignoring struct fields.
R=rsc
DELTA=309 (240 added, 2 deleted, 67 changed)
OCL=31750
CL=31750
2009-07-16 17:55:16 -07:00
Rob Pike
04ae91cf71
clean up the decode loop and fix a couple of bad prints
...
R=rsc
DELTA=15 (8 added, 2 deleted, 5 changed)
OCL=31738
CL=31738
2009-07-16 13:05:46 -07:00
Rob Pike
e76a335ada
make the low-level encoder and decoder private and have them access byte.Buffers rather
...
than io.Readers and io.Writers.
change the Encoder/Decoder protocol so that each message is preceded by its length in bytes.
R=rsc
DELTA=468 (119 added, 23 deleted, 326 changed)
OCL=31700
CL=31702
2009-07-15 16:10:17 -07:00
Rob Pike
b07af158a4
improve rpc code. more robust. more tests.
...
R=rsc
DELTA=186 (133 added, 20 deleted, 33 changed)
OCL=31611
CL=31616
2009-07-14 13:23:14 -07:00
Rob Pike
b2a66adc59
the name of the type was being sent twice. drop the outer instance.
...
R=rsc
DELTA=10 (5 added, 1 deleted, 4 changed)
OCL=31523
CL=31526
2009-07-13 11:41:02 -07:00
Rob Pike
62011cfcdf
first cut at gob decoder.
...
R=rsc
DELTA=184 (181 added, 1 deleted, 2 changed)
OCL=31474
CL=31486
2009-07-11 15:45:54 -07:00
Rob Pike
8a9e395f5f
one more piece of testing: 2nd send should not send type info.
...
R=rsc
DELTA=25 (25 added, 0 deleted, 0 changed)
OCL=31460
CL=31460
2009-07-10 13:50:44 -07:00
Rob Pike
f0a9840d04
a better encoder test, with a couple of fixes for bugs it uncovered.
...
R=rsc
DELTA=84 (65 added, 9 deleted, 10 changed)
OCL=31458
CL=31458
2009-07-10 13:44:37 -07:00
Rob Pike
ec23467e65
store ids rather than Types in the structs so they can be encoded.
...
change Type to gobType.
fix some bugs around recursive structures.
lots of cleanup.
add the first cut at a type encoder.
R=rsc
DELTA=400 (287 added, 11 deleted, 102 changed)
OCL=31401
CL=31406
2009-07-09 14:33:43 -07:00
Rob Pike
0ae7882b5c
bug fix: encOpFor etc. need to indirect
...
R=rsc
DELTA=28 (7 added, 7 deleted, 14 changed)
OCL=31312
CL=31322
2009-07-07 21:05:24 -07:00
Russ Cox
877839333e
gob: use new reflect
...
R=r
DELTA=242 (68 added, 69 deleted, 105 changed)
OCL=31239
CL=31289
2009-07-07 11:04:42 -07:00
Rob Pike
d3a2925bb2
catch corruption - avoid crash
...
R=rsc
DELTA=4 (4 added, 0 deleted, 0 changed)
OCL=31192
CL=31198
2009-07-06 10:58:55 -07:00
Rob Pike
3dab3e65d8
put gob into the standard build
...
R=rsc
DELTA=77 (76 added, 0 deleted, 1 changed)
OCL=31147
CL=31147
2009-07-03 12:54:59 -07:00
Rob Pike
265674fa57
slices
...
R=rsc
DELTA=59 (44 added, 13 deleted, 2 changed)
OCL=31105
CL=31105
2009-07-02 18:02:42 -07:00
Rob Pike
c1fc4c8f37
indirection on array elements.
...
R=rsc
DELTA=57 (34 added, 10 deleted, 13 changed)
OCL=31098
CL=31101
2009-07-02 17:21:48 -07:00