Fix some config Copy() things we had forgotten

This commit is contained in:
Jakob Borg 2015-10-27 11:53:42 +01:00
parent 724c1e297f
commit 679f0f9363
3 changed files with 14 additions and 0 deletions

View File

@ -47,6 +47,7 @@ func (f FolderConfiguration) Copy() FolderConfiguration {
c := f
c.Devices = make([]FolderDeviceConfiguration, len(f.Devices))
copy(c.Devices, f.Devices)
c.Versioning = f.Versioning.Copy()
return c
}

View File

@ -49,5 +49,9 @@ func (orig OptionsConfiguration) Copy() OptionsConfiguration {
copy(c.ListenAddress, orig.ListenAddress)
c.GlobalAnnServers = make([]string, len(orig.GlobalAnnServers))
copy(c.GlobalAnnServers, orig.GlobalAnnServers)
c.RelayServers = make([]string, len(orig.RelayServers))
copy(c.RelayServers, orig.RelayServers)
c.AlwaysLocalNets = make([]string, len(orig.AlwaysLocalNets))
copy(c.AlwaysLocalNets, orig.AlwaysLocalNets)
return c
}

View File

@ -23,6 +23,15 @@ type InternalParam struct {
Val string `xml:"val,attr"`
}
func (c VersioningConfiguration) Copy() VersioningConfiguration {
cp := c
cp.Params = make(map[string]string, len(c.Params))
for k, v := range c.Params {
cp.Params[k] = v
}
return cp
}
func (c *VersioningConfiguration) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
var tmp InternalVersioningConfiguration
tmp.Type = c.Type