Commit 710dbe46 authored by Thomas Sänger's avatar Thomas Sänger Committed by Robert Jacob

Use more explicit number types in structs (#3)

* Use uint when value is never negative
* Guarantee 64 bit types where value could be larger than 32 bit
parent a5472dbc
......@@ -40,10 +40,10 @@ type System struct {
MemcacheLocking string `xml:"memcache.locking"`
FilelockingEnabled bool `xml:"filelocking.enabled"`
Debug bool `xml:"debug"`
FreeSpace int `xml:"freespace"`
FreeSpace uint64 `xml:"freespace"`
// <cpuload>
MemoryTotal int `xml:"mem_total"`
MemoryFree int `xml:"mem_free"`
MemoryTotal uint64 `xml:"mem_total"`
MemoryFree uint64 `xml:"mem_free"`
const boolYes = "yes"
......@@ -59,9 +59,9 @@ func (s *System) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
MemcacheLocking string `xml:"memcache.locking"`
FilelockingEnabled string `xml:"filelocking.enabled"`
Debug string `xml:"debug"`
FreeSpace int `xml:"freespace"`
MemoryTotal int `xml:"mem_total"`
MemoryFree int `xml:"mem_free"`
FreeSpace uint64 `xml:"freespace"`
MemoryTotal uint64 `xml:"mem_total"`
MemoryFree uint64 `xml:"mem_free"`
if err := d.DecodeElement(&raw, &start); err != nil {
return err
......@@ -83,23 +83,23 @@ func (s *System) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// Storage contains information about the nextcloud storage system.
type Storage struct {
Users int `xml:"num_users"`
Files int `xml:"num_files"`
Storages int `xml:"num_storages"`
StoragesLocal int `xml:"num_storages_local"`
StoragesHome int `xml:"num_storages_home"`
StoragesOther int `xml:"num_storages_other"`
Users uint `xml:"num_users"`
Files uint `xml:"num_files"`
Storages uint `xml:"num_storages"`
StoragesLocal uint `xml:"num_storages_local"`
StoragesHome uint `xml:"num_storages_home"`
StoragesOther uint `xml:"num_storages_other"`
// Shares contains information about nextcloud shares.
type Shares struct {
SharesTotal int `xml:"num_shares"`
SharesUser int `xml:"num_shares_user"`
SharesGroups int `xml:"num_shares_groups"`
SharesLink int `xml:"num_shares_link"`
SharesLinkNoPassword int `xml:"num_shares_link_no_password"`
FedSent int `xml:"num_fed_shares_sent"`
FedReceived int `xml:"num_fed_shares_received"`
SharesTotal uint `xml:"num_shares"`
SharesUser uint `xml:"num_shares_user"`
SharesGroups uint `xml:"num_shares_groups"`
SharesLink uint `xml:"num_shares_link"`
SharesLinkNoPassword uint `xml:"num_shares_link_no_password"`
FedSent uint `xml:"num_fed_shares_sent"`
FedReceived uint `xml:"num_fed_shares_received"`
// <permissions_0_1>2</permissions_0_1>
// <permissions_3_1>4</permissions_3_1>
// <permissions_0_15>2</permissions_0_15>
......@@ -118,21 +118,21 @@ type Server struct {
// PHP contains information about the PHP installation.
type PHP struct {
Version string `xml:"version"`
MemoryLimit int `xml:"memory_limit"`
MaxExecutionTime int `xml:"max_execution_time"`
UploadMaxFilesize int `xml:"upload_max_filesize"`
MemoryLimit int64 `xml:"memory_limit"`
MaxExecutionTime uint `xml:"max_execution_time"`
UploadMaxFilesize int64 `xml:"upload_max_filesize"`
// Database contains information about the database used by nextcloud.
type Database struct {
Type string `xml:"type"`
Version string `xml:"version"`
Size int `xml:"size"`
Size uint64 `xml:"size"`
// ActiveUsers contains statistics about the active users.
type ActiveUsers struct {
Last5Minutes int `xml:"last5minutes"`
LastHour int `xml:"last1hour"`
LastDay int `xml:"last24hours"`
Last5Minutes uint `xml:"last5minutes"`
LastHour uint `xml:"last1hour"`
LastDay uint `xml:"last24hours"`
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment