1
0
mirror of https://github.com/golang/go synced 2024-10-04 17:11:21 -06:00
Commit Graph

104 Commits

Author SHA1 Message Date
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
Rob Pike
0c33d4353e arrays, not slices, and only with non-pointer elements.
(actually slices encode but do not decode yet)

R=rsc
DELTA=221  (82 added, 65 deleted, 74 changed)
OCL=31095
CL=31095
2009-07-02 16:43:46 -07:00
Rob Pike
77baac11e1 encode and decode for nested structures.
fix a bug in delta encoding: only update the delta-base if something is marshaled.

R=rsc
DELTA=154  (94 added, 56 deleted, 4 changed)
OCL=31069
CL=31071
2009-07-02 13:43:47 -07:00
Rob Pike
1ca1e1befa encoders and decoders for string, []uint8
R=rsc
DELTA=165  (145 added, 6 deleted, 14 changed)
OCL=31051
CL=31056
2009-07-02 11:21:01 -07:00
Rob Pike
22b93dfb5c now that we have a separate indirection test, simplify the scalar tests.
R=rsc
DELTA=562  (8 added, 424 deleted, 130 changed)
OCL=31039
CL=31045
2009-07-02 09:22:38 -07:00
Rob Pike
671f807e2e simplify decoders. error checking is done higher up.
if there is an error, we will write one more value into the struct but in return
we do fewer tests in the decode.

R=rsc
DELTA=56  (0 added, 42 deleted, 14 changed)
OCL=31041
CL=31044
2009-07-02 09:22:30 -07:00
Rob Pike
c0271c4bc2 fix bug in decoders: got indirection wrong when allocation not required.
write indirection test.

next step: cut down scalar tests since indirection is centralized.

R=rsc
DELTA=114  (83 added, 3 deleted, 28 changed)
OCL=31020
CL=31037
2009-07-02 08:21:42 -07:00
Rob Pike
b1e64585b6 move dereference code out of the ops and into the interpreter loops.
R=rsc
DELTA=574  (40 added, 149 deleted, 385 changed)
OCL=31017
CL=31019
2009-07-01 23:04:27 -07:00
Rob Pike
c701af8c80 Encode and decode engines for gobs.
R=rsc
DELTA=468  (292 added, 18 deleted, 158 changed)
OCL=31008
CL=31012
2009-07-01 18:25:13 -07:00
Rob Pike
b968943332 scalar decoders
R=rsc
DELTA=897  (728 added, 14 deleted, 155 changed)
OCL=30955
CL=30955
2009-06-30 17:59:41 -07:00
Rob Pike
79b2cf92d9 pass the state to the encoders and decoders so error handling can be centralized.
R=rsc
DELTA=172  (40 added, 6 deleted, 126 changed)
OCL=30941
CL=30944
2009-06-30 16:20:31 -07:00
Rob Pike
f6f825141a encoders for booleans and numbers.
R=rsc
DELTA=610  (597 added, 5 deleted, 8 changed)
OCL=30934
CL=30939
2009-06-30 15:37:46 -07:00
Russ Cox
d3a412a5ab io.StringBytes -> strings.Bytes
io.ByteBuffer -> bytes.Buffer

left io.ByteBuffer stub around for now,
for protocol compiler.

R=r
OCL=30861
CL=30872
2009-06-29 15:24:23 -07:00
Rob Pike
b948c437a1 integer encode/decode
R=rsc
DELTA=185  (175 added, 10 deleted, 0 changed)
OCL=30863
CL=30871
2009-06-29 15:15:07 -07:00
Rob Pike
2b08372710 add []byte as a special case: it will have a special, efficient encoding.
R=rsc
DELTA=16  (9 added, 1 deleted, 6 changed)
OCL=30846
CL=30846
2009-06-29 11:29:47 -07:00
Rob Pike
ac7f2152eb the first time a structure type appears when printing, identify it by name:
type Foo struct { a int; next *Foo }
produces
	"Foo = struct { a int; next Foo }"

R=rsc
OCL=30797
CL=30820
2009-06-26 20:28:06 -07:00
Rob Pike
7986de6e51 gobs part 1: types.
not ready to be part of the standard build yet; this is just a checkpoint.

R=rsc
DELTA=361  (361 added, 0 deleted, 0 changed)
OCL=30782
CL=30785
2009-06-25 22:08:51 -07:00