Skip to content

Commit

Permalink
Merge code cleanup fixes from ntfshard
Browse files Browse the repository at this point in the history
  • Loading branch information
barche committed Sep 18, 2016
2 parents 57157d1 + 9701039 commit b2caf31
Show file tree
Hide file tree
Showing 20 changed files with 67 additions and 76 deletions.
20 changes: 10 additions & 10 deletions k3dsdk/measurement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool parse(std::istream& Stream, double&Value, std::string& Units)
return parse(buffer, Value, Units);
}

bool parse(const std::string Buffer, double& Value, std::string& Units)
bool parse(const std::string& Buffer, double& Value, std::string& Units)
{
std::stack<double> stack;
std::string units;
Expand All @@ -59,7 +59,7 @@ bool parse(const std::string Buffer, double& Value, std::string& Units)
return true;
}

bool parse(const std::string Buffer, double&Value, const std::type_info* const Units)
bool parse(const std::string& Buffer, double&Value, const std::type_info* const Units)
{
// Parse the input expression into value and unit-of-measure (it can do mathematical expressions, too, for fun)
double value;
Expand Down Expand Up @@ -326,7 +326,7 @@ const volume_units_t& volume_units()
return units;
}

const angle& angle_units(const std::string Symbol)
const angle& angle_units(const std::string& Symbol)
{
angle_units_t::const_iterator unit = angle_units().find(Symbol);

Expand All @@ -336,7 +336,7 @@ const angle& angle_units(const std::string Symbol)
return unit->second;
}

const area& area_units(const std::string Symbol)
const area& area_units(const std::string& Symbol)
{
area_units_t::const_iterator unit = area_units().find(Symbol);

Expand All @@ -346,7 +346,7 @@ const area& area_units(const std::string Symbol)
return unit->second;
}

const distance& distance_units(const std::string Symbol)
const distance& distance_units(const std::string& Symbol)
{
distance_units_t::const_iterator unit = distance_units().find(Symbol);

Expand All @@ -356,7 +356,7 @@ const distance& distance_units(const std::string Symbol)
return unit->second;
}

const force& force_units(const std::string Symbol)
const force& force_units(const std::string& Symbol)
{
force_units_t::const_iterator unit = force_units().find(Symbol);

Expand All @@ -366,7 +366,7 @@ const force& force_units(const std::string Symbol)
return unit->second;
}

const mass& mass_units(const std::string Symbol)
const mass& mass_units(const std::string& Symbol)
{
mass_units_t::const_iterator unit = mass_units().find(Symbol);

Expand All @@ -376,7 +376,7 @@ const mass& mass_units(const std::string Symbol)
return unit->second;
}

const pressure& pressure_units(const std::string Symbol)
const pressure& pressure_units(const std::string& Symbol)
{
pressure_units_t::const_iterator unit = pressure_units().find(Symbol);

Expand All @@ -386,7 +386,7 @@ const pressure& pressure_units(const std::string Symbol)
return unit->second;
}

const time& time_units(const std::string Symbol)
const time& time_units(const std::string& Symbol)
{
time_units_t::const_iterator unit = time_units().find(Symbol);

Expand All @@ -396,7 +396,7 @@ const time& time_units(const std::string Symbol)
return unit->second;
}

const volume& volume_units(const std::string Symbol)
const volume& volume_units(const std::string& Symbol)
{
volume_units_t::const_iterator unit = volume_units().find(Symbol);

Expand Down
20 changes: 10 additions & 10 deletions k3dsdk/measurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ bool parse(std::istream& Stream, double&Value, std::string& Units);
\return true, iff the input expression is completely parsed, false otherwise
*/
bool parse(const std::string Buffer, double&Value, std::string& Units);
bool parse(const std::string& Buffer, double&Value, std::string& Units);

/**
Expand All @@ -333,7 +333,7 @@ bool parse(const std::string Buffer, double&Value, std::string& Units);
\return true, iff the input expression is completely parsed, false otherwise
*/
bool parse(const std::string Buffer, double&Value, const std::type_info* const Units);
bool parse(const std::string& Buffer, double&Value, const std::type_info* const Units);

/// Defines a collection of units of angular measure, keyed by string (typically name or symbol)
typedef std::map<std::string, angle> angle_units_t;
Expand Down Expand Up @@ -370,21 +370,21 @@ const time_units_t& time_units();
const volume_units_t& volume_units();

/// Returns a reference to a common unit of angular measure keyed by symbol. Throws std::exception if the symbol is unknown.
const angle& angle_units(const std::string Symbol);
const angle& angle_units(const std::string& Symbol);
/// Returns a reference to a common unit of area keyed by symbol. Throws std::exception if the symbol is unknown.
const area& area_units(const std::string Symbol);
const area& area_units(const std::string& Symbol);
/// Returns a reference to a common unit of distance keyed by symbol. Throws std::exception if the symbol is unknown.
const distance& distance_units(const std::string Symbol);
const distance& distance_units(const std::string& Symbol);
/// Returns a reference to a common unit of force keyed by symbol. Throws std::exception if the symbol is unknown.
const force& force_units(const std::string Symbol);
const force& force_units(const std::string& Symbol);
/// Returns a reference to a common unit of mass keyed by symbol. Throws std::exception if the symbol is unknown.
const mass& mass_units(const std::string Symbol);
const mass& mass_units(const std::string& Symbol);
/// Returns a reference to a common unit of pressure keyed by symbol. Throws std::exception if the symbol is unknown.
const pressure& pressure_units(const std::string Symbol);
const pressure& pressure_units(const std::string& Symbol);
/// Returns a reference to a common unit of time keyed by symbol. Throws std::exception if the symbol is unknown.
const time& time_units(const std::string Symbol);
const time& time_units(const std::string& Symbol);
/// Returns a reference to a common unit of volume keyed by symbol. Throws std::exception if the symbol is unknown.
const volume& volume_units(const std::string Symbol);
const volume& volume_units(const std::string& Symbol);

} // namespace measurement

Expand Down
1 change: 0 additions & 1 deletion k3dsdk/ngui/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ class state::implementation
return_if_fail(conversion);
k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection);
break;
break;
}
case POINT:
{
Expand Down
2 changes: 1 addition & 1 deletion k3dsdk/nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ inode* find_node(inode_collection& Nodes, iproperty& Property)
const std::string unique_name(inode_collection& Nodes, const std::string& Name)
{
// For each node in the collection ...
for(k3d::inode_collection::nodes_t::const_iterator handle = Nodes.collection().begin(); handle != Nodes.collection().end(); handle++)
for(k3d::inode_collection::nodes_t::const_iterator handle = Nodes.collection().begin(); handle != Nodes.collection().end(); ++handle)
{
inode* const node = *handle;

Expand Down
1 change: 0 additions & 1 deletion k3dsdk/qtui/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ class state::implementation
return_if_fail(conversion);
k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection);
break;
break;
}
case POINT:
{
Expand Down
2 changes: 1 addition & 1 deletion k3dsdk/sl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void parse_stream(std::istream& Stream, token_collection_t& Output)

token_t token;

for(token_t::iterator c = buffer.begin(); c != buffer.end(); c++)
for(token_t::iterator c = buffer.begin(); c != buffer.end(); ++c)
{
if(stringliteral)
{
Expand Down
6 changes: 3 additions & 3 deletions modules/cloth/d_Vec3f.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ namespace d_Math
return p[i];
}

d_Vec3f operator + (const d_Vec3f v) const
d_Vec3f operator + (const d_Vec3f& v) const
{
d_Vec3f res(p[0]+v[0], p[1]+v[1], p[2]+v[2]);
return res;
}

d_Vec3f operator - (const d_Vec3f v) const
d_Vec3f operator - (const d_Vec3f& v) const
{
d_Vec3f res(p[0]-v[0], p[1]-v[1], p[2]-v[2]);
return res;
Expand All @@ -71,7 +71,7 @@ namespace d_Math

};

float len(const d_Vec3f a)
float len(const d_Vec3f& a)
{
return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
}
Expand Down
4 changes: 0 additions & 4 deletions modules/collada_io/int_elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ namespace io
}

domSource *source_vertex;
domSource *source_normal;
domSource *source_texcoord=NULL;
daeURI *elementURI;

Expand All @@ -117,7 +116,6 @@ namespace io
}

domFloat_array *floatArray_vertex;
domFloat_array *floatArray_normal;
domFloat_array *floatArray_texcoord;

if(source_vertex)
Expand Down Expand Up @@ -236,7 +234,6 @@ namespace io
}

domSource *source_vertex;
domSource *source_normal;
domSource *source_texcoord=NULL;
daeURI *elementURI;

Expand All @@ -253,7 +250,6 @@ namespace io
}

domFloat_array *floatArray_vertex;
domFloat_array *floatArray_normal;
domFloat_array *floatArray_texcoord;

if(source_vertex)
Expand Down
2 changes: 1 addition & 1 deletion modules/inotify/inotify-cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void Inotify::RemoveAll()
pW->m_wd = -1;
}
pW->m_pInotify = NULL;
it++;
++it;
}

m_watches.clear();
Expand Down
4 changes: 2 additions & 2 deletions modules/lsystem/l_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ void L_mutate()

unsigned long random = (unsigned long)(Rnd() * 12.0);

if(random < 0 || random > 11)
if(random > 11)
return;

if(rules[i][j] == mutations[random][0])
Expand Down Expand Up @@ -833,7 +833,7 @@ void L_mutate()

unsigned long random = (unsigned long)(Rnd() * 6.0);

if(random < 0 || random > 5)
if(random > 5)
return;

if(rules[i][j] == mutations[random][0])
Expand Down
2 changes: 1 addition & 1 deletion modules/ngui_material_manager_panel/ContentPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class ContentPanel
std::list<PreviewObj*>::iterator geo_iter
= m_used_geometry.begin();

for(; geo_iter != m_used_geometry.end(); geo_iter++)
for(; geo_iter != m_used_geometry.end(); ++geo_iter)
delete (*geo_iter);
}

Expand Down
Loading

0 comments on commit b2caf31

Please sign in to comment.