Skip to content

Commit

Permalink
Fixed: Build errors related to non-const references
Browse files Browse the repository at this point in the history
An argument with a non-const reference type cannot be bound to a
temporary lvalue. Non-const references should only be used if it is
expected that the referenced object will be modified inside the method.
  • Loading branch information
skyjake committed Nov 12, 2012
1 parent d1da49c commit 4ef314f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions doomsday/engine/portable/include/pathtree.h
Expand Up @@ -153,7 +153,7 @@ namespace de
* allow for further optimizations elsewhere (in the file system
* for example) -ds
*/
int comparePath(de::Uri& candidatePath, int flags) const;
int comparePath(de::Uri const& candidatePath, int flags) const;

/**
* Composes the URI for this node. 'Composing' the path of a node is to
Expand Down Expand Up @@ -244,7 +244,7 @@ namespace de
* the path @c "c:/somewhere/something" this is the node for the
* path fragment "something".
*/
Node* insert(Uri& path);
Node* insert(Uri const& path);

/**
* Destroy the tree's contents, free'ing all nodes.
Expand All @@ -262,7 +262,7 @@ namespace de
*
* @return Found node.
*/
Node& find(Uri& path, int flags);
Node& find(Uri const& path, int flags);

/**
* Collate all referenced paths in the hierarchy into a list.
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/pathtree.cpp
Expand Up @@ -138,7 +138,7 @@ struct PathTree::Instance
*
* @return The node that identifies the given path.
*/
PathTree::Node* buildDirecNodes(Uri& uri)
PathTree::Node* buildDirecNodes(Uri const& uri)
{
/// @todo This messy logic could be addressed by improving Uri's API.
/// Now that the names of a path can be accessed randomly with no
Expand Down Expand Up @@ -183,7 +183,7 @@ struct PathTree::Instance
}
};

PathTree::Node* PathTree::insert(Uri& path)
PathTree::Node* PathTree::insert(Uri const& path)
{
PathTree::Node* node = d->buildDirecNodes(path);
if(node)
Expand Down Expand Up @@ -228,7 +228,7 @@ void PathTree::clear()
d->clear();
}

PathTree::Node& PathTree::find(Uri& searchPath, int flags)
PathTree::Node& PathTree::find(Uri const& searchPath, int flags)
{
if(!searchPath.isEmpty() && d->size)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/pathtreenode.cpp
Expand Up @@ -157,7 +157,7 @@ static int matchName(char const* string, char const* pattern)
}

/// @todo This logic should be encapsulated in Uri/Uri::PathNode
int PathTree::Node::comparePath(de::Uri& searchPattern, int flags) const
int PathTree::Node::comparePath(de::Uri const& searchPattern, int flags) const
{
if(((flags & PCF_NO_LEAF) && isLeaf()) ||
((flags & PCF_NO_BRANCH) && !isLeaf()))
Expand Down

0 comments on commit 4ef314f

Please sign in to comment.