Robert Griesemer [Thu, 17 Dec 2009 00:53:56 +0000 (16:53 -0800)]
- Parse expressions as opposed to statements for gofmt rewrite patterns.
Allows stand-alone types (e.g. []int as patterns) and doesn't require
a semicolon at the end (which are now mandatory terminators).
Nigel Tao [Wed, 16 Dec 2009 23:32:17 +0000 (10:32 +1100)]
Basic image/jpeg decoder.
This is not a complete JPEG implementation (e.g. it does not handle
progressive JPEGs or restart markers), but I was able to take a photo
with my phone, and view the resultant JPEG in pure Go.
The decoder is simple, but slow. The Huffman decoder in particular
should be easily improvable, but optimization is left to future
changelists. Being able to inline functions in the inner loop should
also help performance.
The output is not pixel-for-pixel identical to libjpeg, although
identical behavior isn't necessarily a goal, since JPEG is a lossy
codec. There are at least two reasons for the discrepancy.
First, the inverse DCT algorithm used is the same as Plan9's
src/cmd/jpg, which has different rounding errors from libjpeg's
default IDCT implementation. Note that libjpeg actually has three
different IDCT implementations: one floating point, and two fixed
point. Out of those four, Plan9's seemed the simplest to understand,
partly because it has no #ifdef's or C macros.
Second, for 4:2:2 or 4:2:0 chroma sampling, this implementation does
nearest neighbor upsampling, compared to libjpeg's triangle filter
(e.g. see h2v1_fancy_upsample in jdsample.c).
The difference from the first reason is typically zero, but sometimes
1 (out of 256) in YCbCr space, or double that in RGB space. The
difference from the second reason can be as large as 8/256 in YCbCr
space, in regions of steep chroma gradients. Informal eyeballing
suggests that the net difference is typically imperceptible, though.
Moriyoshi Koizumi [Wed, 16 Dec 2009 05:24:17 +0000 (21:24 -0800)]
This patch enables cgo utility to correctly convert enums in the C source
into consts in the resulting Go source. Previously known as issue 161047,
which I deleted accidentally. Fixes issue 207.
Russ Cox [Wed, 16 Dec 2009 00:22:04 +0000 (16:22 -0800)]
gc: bug fixes.
* better error for lookup of unexported field
* do not assign "ideal string" type to typed string literal
* do not confuse methods and fields during interface check
Robert Griesemer [Tue, 15 Dec 2009 23:41:46 +0000 (15:41 -0800)]
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
Robert Griesemer [Tue, 15 Dec 2009 23:40:16 +0000 (15:40 -0800)]
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
Robert Griesemer [Tue, 15 Dec 2009 23:35:38 +0000 (15:35 -0800)]
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
Robert Griesemer [Tue, 15 Dec 2009 23:33:31 +0000 (15:33 -0800)]
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
4) gofmt -w src misc test/bench
1st set of files.
R=rsc
CC=agl, golang-dev, iant, ken2, r
https://golang.org/cl/180047
Robert Griesemer [Tue, 15 Dec 2009 23:27:16 +0000 (15:27 -0800)]
1) Change default gofmt default settings for
parsing and printing to new syntax.
Use -oldparser to parse the old syntax,
use -oldprinter to print the old syntax.
2) Change default gofmt formatting settings
to use tabs for indentation only and to use
spaces for alignment. This will make the code
alignment insensitive to an editor's tabwidth.
Use -spaces=false to use tabs for alignment.
3) Manually changed src/exp/parser/parser_test.go
so that it doesn't try to parse the parser's
source files using the old syntax (they have
new syntax now).
Robert Griesemer [Tue, 15 Dec 2009 16:41:50 +0000 (08:41 -0800)]
fix TODO: insert semicolons before any sequence of comments
that introduce the newline (important for correct placement
of comments with gofmt when parsing new syntax)
Christopher Wedgwood [Mon, 14 Dec 2009 19:35:02 +0000 (11:35 -0800)]
archive/tar: bug fixes.
1. If all data is exhausted using Read then a following Next will
fail as if it saw EOF. (Test case added.)
2. Seeking isn't always possible (i.e. sockets and pipes). Fallback
to read. (Test case added.)
3. Fix to readHeader (cleaner fix pointed out by rsc).
(TestReader modified.)
4. When Read has consumed all the data, don't try to read 0 bytes from reader.
In cases where tr.nb is zero we attempt to read zero bytes and thus
never see an EOF (this is most easily seen when the 'tar source' is
something like bytes.Buffer{} as opposed to os.File).
5. If write is used to the point of ErrWriteTooLong, allow additional file entries.
6. Make close work as expected. That is any further Write or
WriteHeader attempts will result in ErrWriteAfterClose.
Fixes #419.
Robert Griesemer [Sat, 12 Dec 2009 00:42:14 +0000 (16:42 -0800)]
Various cleanups:
- no need to replace comments for stand-alone blocks
- always print string concatenations with interspersed "+"
(remove option)
- minor cleanups
Devon H. O'Dell [Fri, 11 Dec 2009 23:14:09 +0000 (15:14 -0800)]
Remove GOBIN in PATH dependency; don't assume cwd is $GOROOT/src
This change removes the necessity to have GOBIN in $PATH,
and also doesn't assume that the build is being run from
$GOROOT/src. This is a minimal set of necessary changes
to get Go to build happily from the FreeBSD ports
collection.
Robert Griesemer [Thu, 10 Dec 2009 00:55:03 +0000 (16:55 -0800)]
- gofmt these files
- remove use of implicit string concatenation
- these appear to be the only files correctly compiling under test
that used implicit string concatenation
Charles L. Dorian [Wed, 9 Dec 2009 19:56:45 +0000 (11:56 -0800)]
Continuation of issue 221 fix. When 8g or 6g or 5g are called with a
UTF-8 string, Yconv() converts it into an octal sequence. If the
string converted to more than 30 bytes, the str buffer would
overflow. For example, 4 Greek runes became 32 bytes, 3 Hiragana
runes became 36 bytes, and 2 Gothic runes became 32 bytes. In
8l, 6l and 5l the function is Sconv(). For some reason, only 5l uses
the constant STRINGSZ (defined as 200) for the buffer size.
Adrian O'Grady [Wed, 9 Dec 2009 08:06:20 +0000 (00:06 -0800)]
Added XTEA block cipher package to src/pkg/crypto
This is an adaption of the code from http://en.wikipedia.org/wiki/XTEA. The package also implements the block.Cipher
interface so that it can be used with the various block modes.