aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/encoding
AgeCommit message (Collapse)Author
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
2014-08-25encoding/json: make ,string work when encoding pointer fieldsBrad Fitzpatrick
It was respected by unmarshal, but not marshal, so they didn't round-trip. Fixes #8582 LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/132960043
2014-08-08encoding/gob: fix data races in benchmarksDmitriy Vyukov
All goroutines decode into the same value. LGTM=r R=r, abursavich CC=golang-codereviews https://golang.org/cl/123930043
2014-08-08encoding/json: document coercion of invalid UTF-8 charactersAndrew Gerrand
Fixes #8342. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/122180043
2014-08-07encoding/gob: make benchmarks parallelDmitriy Vyukov
There are lots of internal synchronization in gob, so it makes sense to have parallel benchmarks. Also add a benchmark with slices and interfaces. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/115960043
2014-08-06encoding/xml: add InputOffset method to DecoderRuss Cox
Among other things, this allows users to match the decoded pieces with the original XML, which can be necessary for implementing standards like XML signatures. Fixes #8484. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/122960043
2014-08-03encoding/gob: save a call to userTypeRob Pike
Avoid some pressure on the global mutex by lifting the call to userType out of the closure. TOTH to Matt Harden. LGTM=crawshaw, ruiu R=golang-codereviews, crawshaw, ruiu CC=golang-codereviews https://golang.org/cl/117520043
2014-07-28encoding/asn1: only omit optional elements matching default value.Adam Langley
ASN.1 elements can be optional, and can have a default value. Traditionally, Go has omitted elements that are optional and that have the zero value. I believe that's a bug (see [1]). This change causes an optional element with a default value to only be omitted when it has that default value. The previous behaviour of omitting optional, zero elements with no default is retained because it's used quite a lot and will break things if changed. [1] https://groups.google.com/d/msg/Golang-nuts/9Ss6o9CW-Yo/KL_V7hFlyOAJ Fixes #7780. R=bradfitz LGTM=bradfitz R=golang-codereviews, bradfitz, rsc CC=golang-codereviews, r https://golang.org/cl/86960045
2014-07-18encoding/gob: remove unnecessary receiversDmitriy Vyukov
Encoder compilation must be enc-independent, because the resulting program is reused across different encoders. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/115860043
2014-07-01encoding/gob: fewer decAlloc callsRuss Cox
Move decAlloc calls a bit higher in the call tree. Cleans code marginally, improves speed marginally. The benchmarks are noisy but the median time from 20 consective 1-second runs improves by about 2%. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/105530043
2014-06-30encoding/gob: simplify allocation in decode.Rob Pike
The old code's structure needed to track indirections because of the use of unsafe. That is no longer necessary, so we can remove all that tracking. The code cleans up considerably but is a little slower. We may be able to recover that performance drop. I believe the code quality improvement is worthwhile regardless. BenchmarkEndToEndPipe 5610 5780 +3.03% BenchmarkEndToEndByteBuffer 3156 3222 +2.09% LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/103700043
2014-06-30encoding/gob: remove unsafe, use reflection.Rob Pike
This removes a major unsafe thorn in our side, a perennial obstacle to clean garbage collection. Not coincidentally: In cleaning this up, several bugs were found, including code that reached inside by-value interfaces to create pointers for pointer-receiver methods. Unsafe code is just as advertised. Performance of course suffers, but not too badly. The Pipe number is more indicative, since it's doing I/O that simulates a network connection. Plus these are end-to-end, so each end suffers only half of this pain. The edit is pretty much a line-by-line conversion, with a few simplifications and a couple of new tests. There may be more performance to gain. BenchmarkEndToEndByteBuffer 2493 3033 +21.66% BenchmarkEndToEndPipe 4953 5597 +13.00% Fixes #5159. LGTM=rsc R=rsc CC=golang-codereviews, khr https://golang.org/cl/102680045
2014-06-19encoding/base64, encoding/base32: speed up EncodeRui Ueyama
Avoid unnecessary bitwise-OR operations. benchmark old MB/s new MB/s speedup BenchmarkEncodeToStringBase64 179.02 205.74 1.15x BenchmarkEncodeToStringBase32 155.86 167.82 1.08x LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/109090043
2014-06-18encoding/base64, encoding/base32: make Encode fasterRui Ueyama
Storing temporary values to a slice is slower than storing them to local variables of type byte. benchmark old MB/s new MB/s speedup BenchmarkEncodeToStringBase32 102.21 156.66 1.53x BenchmarkEncodeToStringBase64 124.25 177.91 1.43x LGTM=crawshaw R=golang-codereviews, crawshaw, bradfitz, dave CC=golang-codereviews https://golang.org/cl/109820045
2014-06-12encoding/json: remove unused field from Encoder structBrad Fitzpatrick
It should've been removed in https://golang.org/cl/9365044 Thanks to Jacek Masiulaniec for noticing. LGTM=ruiu R=ruiu CC=golang-codereviews https://golang.org/cl/109880043
2014-06-11encoding/ascii85: remove unused fieldRui Ueyama
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/105890044
2014-06-11encoding/base64, encoding/base32: make DecodeString fasterRui Ueyama
Previously, an input string was stripped of newline characters at the beginning of DecodeString and then passed to Decode. Decode again tried to strip newline characters. That's waste of time. benchmark old MB/s new MB/s speedup BenchmarkDecodeString 38.37 65.20 1.70x LGTM=dave, bradfitz R=golang-codereviews, dave, bradfitz CC=golang-codereviews https://golang.org/cl/91770051
2014-05-16encoding/xml: fix format in test messageRob Pike
Found by go vet. LGTM=crawshaw R=golang-codereviews, crawshaw CC=golang-codereviews https://golang.org/cl/100510044
2014-05-12encoding/json: document what unmarshal of `null` into non-reference type doesRuss Cox
Originally it was an error, which made perfect sense, but in issue 2540 I got talked out of this sensible behavior. I'm not thrilled with the "new" behavior but it's been there since Go 1.1 so we're stuck with it now. Fixes #6724. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/100430043
2014-05-12encoding/xml: fix to allow xml declaration with EncodeTokenJason Del Ponte
This changes allows the first token encoded to be a xml declaration. A ProcInst with target of xml. Any other ProcInst after that with a target of xml will fail Fixes #7380. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/72410043
2014-05-09encoding/binary: document that Read requires exported struct fieldsIan Lance Taylor
Add a test for the current behaviour. Fixes #7482. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://golang.org/cl/95160043
2014-05-08encoding/json: add example for Indent, clarify the docs.Stephen McQuay
There was confusion in the behavior of json.Indent; This change attempts to clarify the behavior by providing a bit more verbiage to the documentation as well as provide an example function. Fixes #7821. LGTM=robert.hencke, adg R=golang-codereviews, minux.ma, bradfitz, aram, robert.hencke, r, adg CC=golang-codereviews https://golang.org/cl/97840044
2014-04-26encoding/ascii85: handle non-data bytes correctlyRui Ueyama
Previously Read wouldn't return once its internal input buffer is filled with non-data bytes. Fixes #7875. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/90820043
2014-04-26src: fix issues found by go vet stdRobert Hencke
LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/96850043
2014-04-26 encoding/gob: handle interface types in isZero() by returning true for ↵Jonathan Allie
nil interfaces. Fixes #7741. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/96830044
2014-04-16encoding/json: document Encoder will terminate each JSON value with '\n'Shenghou Ma
Fixes #7767. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/87420043
2014-04-16encoding/xml: document NewDecoder bufferingBrad Fitzpatrick
Fixes #7225 LGTM=r R=golang-codereviews, r CC=golang-codereviews, rsc https://golang.org/cl/88710043
2014-04-16all: fix typosRui Ueyama
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/88670043
2014-04-16encoding/base64: don't lose a byte of output when encountering trailing garbageBrad Fitzpatrick
Fixes #7733 LGTM=minux.ma R=golang-codereviews, minux.ma CC=golang-codereviews, nigeltao, r, rsc https://golang.org/cl/88330044
2014-04-08encoding/xml: unmarshal into interfacesJosh Bleecher Snyder
Fixes #6836. LGTM=rsc R=golang-codereviews, rsc, r, mike CC=golang-codereviews https://golang.org/cl/33140043
2014-04-08encoding/xml: Makes XML Marshaler take into account XMLName field from ↵Alexander Zhavnerchik
anonymous field Fixes #7614. LGTM=rsc R=golang-codereviews, r, rsc, dan.kortschak, applezinc CC=golang-codereviews https://golang.org/cl/79210044
2014-03-21encoding/asn1: use GeneralizedTime for times outside the range of UTCTime.Adam Langley
Fixes issue #6976. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/72080044
2014-03-20base64: fix bug that decoder fails to detect corruptionRui Ueyama
Encoding.Decode() failed to detect trailing garbages if input contains "==" followed by garbage smaller than 3 bytes (for example, it failed to detect "x" in "AA==x"). This patch fixes the bug and adds a few tests. LGTM=nigeltao R=golang-codereviews, bradfitz, nigeltao CC=golang-codereviews https://golang.org/cl/75340044
2014-03-20base32: remove unnecessary "if" conditionRui Ueyama
This is a patch to apply the same change as CL 76610045. LGTM=nigeltao R=nigeltao CC=golang-codereviews https://golang.org/cl/77460044
2014-03-18base64: refactor encoder.WriteRui Ueyama
"nn" can never be zero for any input "p", so no check is needed. This change should improve readability a bit. LGTM=nigeltao R=golang-codereviews, bradfitz, nigeltao CC=golang-codereviews https://golang.org/cl/76610045
2014-03-17encoding/hex: add error check for write error.Rui Ueyama
I believe the original author of this code just forgot to check for error here. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/76760043
2014-03-07encoding/gob: document that Decode returns EOF at EOFRob Pike
Just commentary describing existing behavior, no code changes. Fixes #7033. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/71860043
2014-03-06encoding/gob: improve interface assignment error messageKelsey Hightower
During the glob decoding process interface values are set to concrete values after a test for assignability. If the assignability test fails a slightly vague error message is produced. While technically accurate the error message does not clearly describe the problem. Rewrite the error message to include the usage of the word assignable, which makes it clear the concrete value type is not assignable to the interface value type. Fixes #6467. LGTM=r R=golang-codereviews, rsc, r CC=golang-codereviews https://golang.org/cl/71590043
2014-03-05encoding/xml: add test for EncodeTokenShawn Smith
LGTM=rsc R=golang-codereviews, josharian, dave, iant, bradfitz, rsc CC=golang-codereviews https://golang.org/cl/47870043
2014-02-13crypto/x509: Add certificate signature request (CSR) support.Kyle Isom
This change adds support for parsing and serialisation of PKCS #10, certificate signature requests. LGTM=agl R=golang-codereviews, agl CC=agl, golang-codereviews, nick https://golang.org/cl/49830048
2014-02-12encoding/json: fix test failureDmitriy Vyukov
$ go test -cpu=1,1,1,1,1,1,1,1,1 encoding/json --- FAIL: TestIndentBig (0.00 seconds) scanner_test.go:131: Indent(jsonBig) did not get bigger On 4-th run initBig generates an empty array. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/49930051
2014-02-05encoding/json: mention escaping of '&'Shenghou Ma
Fixes #7034. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/57140043
2014-01-30encoding/gob: fix two crashes on corrupted data.Rémy Oudompheng
Fixes #6323. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/56870043
2014-01-28encoding/asn1: support set tag when unmarshaling.Adam Langley
This change also addresses some places where the comments were lacking. Fixes #7087. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/56700043
2014-01-27all: use {bytes,strings}.NewReader instead of bytes.BuffersBrad Fitzpatrick
Use the smaller read-only bytes.NewReader/strings.NewReader instead of a bytes.Buffer when possible. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/54660045
2014-01-07encoding/csv: test that carriage return is handled in WriteShawn Smith
R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/46310043
2014-01-03encoding/json: Fix missing error when trying to unmarshal null string into ↵Emil Hessman
int, for successive ,string option Fixes #7046. R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/47260043
2014-01-02encoding/hex: add Decode error test caseShawn Smith
R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/46880043
2014-01-02encoding/json: add tests for InvalidUnmarshalErrorDave Cheney
R=golang-codereviews, shawn.p.smith CC=golang-codereviews https://golang.org/cl/41960047
2014-01-01encoding/json: improve omitempty test coverageShawn Smith
R=golang-codereviews, dave, bradfitz CC=golang-codereviews https://golang.org/cl/46250043