Archived
1
0

Return the array instead of a pointer to the array for Search and Revisions.

This commit is contained in:
Arnaud Ysmal 2014-03-17 21:36:19 +01:00
parent a573b1dd4f
commit c03c8754dc

View File

@ -574,7 +574,7 @@ func (db *Dropbox) Media(path string) (*Link, error) {
// Search searches the entries matching all the words contained in query in the given path. // Search searches the entries matching all the words contained in query in the given path.
// The maximum number of entries and whether to consider deleted file may be given. // The maximum number of entries and whether to consider deleted file may be given.
func (db *Dropbox) Search(path, query string, fileLimit int, includeDeleted bool) (*[]Entry, error) { func (db *Dropbox) Search(path, query string, fileLimit int, includeDeleted bool) ([]Entry, error) {
var rv []Entry var rv []Entry
var params *url.Values var params *url.Values
@ -588,7 +588,7 @@ func (db *Dropbox) Search(path, query string, fileLimit int, includeDeleted bool
} }
act := strings.Join([]string{"search", db.RootDirectory, path}, "/") act := strings.Join([]string{"search", db.RootDirectory, path}, "/")
err := db.doRequest("GET", act, params, &rv) err := db.doRequest("GET", act, params, &rv)
return &rv, err return rv, err
} }
// Delta gets modifications since the cursor. // Delta gets modifications since the cursor.
@ -716,7 +716,7 @@ func (db *Dropbox) CopyRef(src string) (*CopyRef, error) {
} }
// Revisions gets the list of revisions for a file. // Revisions gets the list of revisions for a file.
func (db *Dropbox) Revisions(src string, revLimit int) (*[]Entry, error) { func (db *Dropbox) Revisions(src string, revLimit int) ([]Entry, error) {
var rv []Entry var rv []Entry
if revLimit <= 0 { if revLimit <= 0 {
revLimit = RevisionsLimitDefault revLimit = RevisionsLimitDefault
@ -726,7 +726,7 @@ func (db *Dropbox) Revisions(src string, revLimit int) (*[]Entry, error) {
act := strings.Join([]string{"revisions", db.RootDirectory, src}, "/") act := strings.Join([]string{"revisions", db.RootDirectory, src}, "/")
err := db.doRequest("GET", act, err := db.doRequest("GET", act,
&url.Values{"rev_limit": {strconv.FormatInt(int64(revLimit), 10)}}, &rv) &url.Values{"rev_limit": {strconv.FormatInt(int64(revLimit), 10)}}, &rv)
return &rv, err return rv, err
} }
// Restore restores a deleted file at the corresponding revision. // Restore restores a deleted file at the corresponding revision.