Fixes for weekly.2012-02-07

Goprotobuf also needed fixes. Goprotobuf builds with the following patch:

diff -r baa3174c862d compiler/descriptor/descriptor.pb.go
--- a/compiler/descriptor/descriptor.pb.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/compiler/descriptor/descriptor.pb.go	Thu Feb 09 20:31:27 2012 +0200
@@ -3,14 +3,13 @@
 
 package google_protobuf
 
-import proto "goprotobuf.googlecode.com/hg/proto"
+import proto "code.google.com/p/goprotobuf/proto"
 import "math"
 
 // Reference proto, math & os imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
 var _ = math.Inf
 
-
 type FieldDescriptorProto_Type int32
 
 const (
diff -r baa3174c862d compiler/generator/generator.go
--- a/compiler/generator/generator.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/compiler/generator/generator.go	Thu Feb 09 20:31:27 2012 +0200
@@ -48,9 +48,9 @@
 	"strconv"
 	"strings"
 
-	descriptor "goprotobuf.googlecode.com/hg/compiler/descriptor"
-	plugin "goprotobuf.googlecode.com/hg/compiler/plugin"
-	"goprotobuf.googlecode.com/hg/proto"
+	descriptor "code.google.com/p/goprotobuf/compiler/descriptor"
+	plugin "code.google.com/p/goprotobuf/compiler/plugin"
+	"code.google.com/p/goprotobuf/proto"
 )
 
 // A Plugin provides functionality to add to the output during Go code generation,
@@ -403,6 +403,7 @@
 
 // For each input file, the unique package name to use, underscored.
 var uniquePackageName = make(map[*descriptor.FileDescriptorProto]string)
+
 // Package names already registered.  Key is the name from the .proto file;
 // value is the name that appears in the generated code.
 var pkgNamesInUse = make(map[string]bool)
diff -r baa3174c862d compiler/main.go
--- a/compiler/main.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/compiler/main.go	Thu Feb 09 20:31:27 2012 +0200
@@ -43,8 +43,8 @@
 	"io/ioutil"
 	"os"
 
-	"goprotobuf.googlecode.com/hg/proto"
-	"goprotobuf.googlecode.com/hg/compiler/generator"
+	"code.google.com/p/goprotobuf/compiler/generator"
+	"code.google.com/p/goprotobuf/proto"
 )
 
 func main() {
diff -r baa3174c862d compiler/plugin/plugin.pb.go
--- a/compiler/plugin/plugin.pb.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/compiler/plugin/plugin.pb.go	Thu Feb 09 20:31:27 2012 +0200
@@ -3,10 +3,10 @@
 
 package google_protobuf_compiler
 
-import proto "goprotobuf.googlecode.com/hg/proto"
+import proto "code.google.com/p/goprotobuf/proto"
 import "math"
 
-import google_protobuf "goprotobuf.googlecode.com/hg/compiler/descriptor"
+import google_protobuf "code.google.com/p/goprotobuf/compiler/descriptor"
 
 // Reference proto, math & os imports to suppress error if they are not otherwise used.
 var _ = proto.GetString
diff -r baa3174c862d proto/all_test.go
--- a/proto/all_test.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/all_test.go	Thu Feb 09 20:31:27 2012 +0200
@@ -29,7 +29,6 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
 package proto_test
 
 import (
@@ -42,7 +41,7 @@
 	"testing"
 
 	. "./testdata/_obj/test_proto"
-	. "goprotobuf.googlecode.com/hg/proto"
+	. "code.google.com/p/goprotobuf/proto"
 )
 
 var globalO *Buffer
diff -r baa3174c862d proto/clone_test.go
--- a/proto/clone_test.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/clone_test.go	Thu Feb 09 20:31:27 2012 +0200
@@ -35,7 +35,7 @@
 	"log"
 	"testing"
 
-	"goprotobuf.googlecode.com/hg/proto"
+	"code.google.com/p/goprotobuf/proto"
 
 	pb "./testdata/_obj/test_proto"
 )
diff -r baa3174c862d proto/decode.go
--- a/proto/decode.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/decode.go	Thu Feb 09 20:31:27 2012 +0200
@@ -313,7 +313,9 @@
 		return err
 	}
 
-	mstat := runtime.MemStats.Mallocs
+	memstats := new(runtime.MemStats)
+	runtime.ReadMemStats(memstats)
+	mstat := memstats.Mallocs
 
 	typ, base, err := getbase(pb)
 	if err != nil {
@@ -322,7 +324,8 @@
 
 	err = p.unmarshalType(typ, false, base)
 
-	mstat = runtime.MemStats.Mallocs - mstat
+	runtime.ReadMemStats(memstats)
+	mstat = memstats.Mallocs - mstat
 	stats.Dmalloc += mstat
 	stats.Decode++
 
diff -r baa3174c862d proto/encode.go
--- a/proto/encode.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/encode.go	Thu Feb 09 20:31:27 2012 +0200
@@ -199,14 +199,17 @@
 		return nil
 	}
 
-	mstat := runtime.MemStats.Mallocs
+	memstats := new(runtime.MemStats)
+	runtime.ReadMemStats(memstats)
+	mstat := memstats.Mallocs
 
 	t, b, err := getbase(pb)
 	if err == nil {
 		err = p.enc_struct(t.Elem(), b)
 	}
 
-	mstat = runtime.MemStats.Mallocs - mstat
+	runtime.ReadMemStats(memstats)
+	mstat = memstats.Mallocs - mstat
 	stats.Emalloc += mstat
 	stats.Encode++
 
diff -r baa3174c862d proto/equal_test.go
--- a/proto/equal_test.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/equal_test.go	Thu Feb 09 20:31:27 2012 +0200
@@ -35,8 +35,8 @@
 	"log"
 	"testing"
 
-	. "goprotobuf.googlecode.com/hg/proto"
 	pb "./testdata/_obj/test_proto"
+	. "code.google.com/p/goprotobuf/proto"
 )
 
 // Four identical base messages.
diff -r baa3174c862d proto/text_parser_test.go
--- a/proto/text_parser_test.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/text_parser_test.go	Thu Feb 09 20:31:27 2012 +0200
@@ -33,7 +33,7 @@
 
 import (
 	. "./testdata/_obj/test_proto"
-	. "goprotobuf.googlecode.com/hg/proto"
+	. "code.google.com/p/goprotobuf/proto"
 	"reflect"
 	"testing"
 )
diff -r baa3174c862d proto/text_test.go
--- a/proto/text_test.go	Thu Dec 08 12:58:23 2011 +1100
+++ b/proto/text_test.go	Thu Feb 09 20:31:27 2012 +0200
@@ -36,7 +36,7 @@
 	"strings"
 	"testing"
 
-	"goprotobuf.googlecode.com/hg/proto"
+	"code.google.com/p/goprotobuf/proto"
 
 	pb "./testdata/_obj/test_proto"
 )