Skip to content

Commit

Permalink
A couple of g++ warning fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 28, 2017
1 parent c744ece commit d1d2dbf
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 30 deletions.
8 changes: 4 additions & 4 deletions radiant/brush/FaceInstance.cpp
Expand Up @@ -29,18 +29,18 @@ FaceInstanceSet FaceInstance::_selectedFaceInstances;

FaceInstance::FaceInstance(Face& face, const SelectionChangedSlot& observer) :
m_face(&face),
m_selectionChanged(observer),
m_selectable(std::bind(&FaceInstance::selectedChanged, this, std::placeholders::_1)),
m_selectableVertices(observer),
m_selectableEdges(observer),
m_selectionChanged(observer)
m_selectableEdges(observer)
{}

FaceInstance::FaceInstance(const FaceInstance& other) :
m_face(other.m_face),
m_selectionChanged(other.m_selectionChanged),
m_selectable(std::bind(&FaceInstance::selectedChanged, this, std::placeholders::_1)),
m_selectableVertices(other.m_selectableVertices),
m_selectableEdges(other.m_selectableEdges),
m_selectionChanged(other.m_selectionChanged)
m_selectableEdges(other.m_selectableEdges)
{}

FaceInstance& FaceInstance::operator=(const FaceInstance& other) {
Expand Down
2 changes: 1 addition & 1 deletion radiant/layers/LayerUsageBreakdown.cpp
Expand Up @@ -71,7 +71,7 @@ void LayerUsageBreakdown::InitialiseVector(LayerUsageBreakdown& bd)

GlobalLayerSystem().foreachLayer([&](int layerId, const std::string& layerName)
{
if (layerId >= bd.size())
if (layerId >= static_cast<int>(bd.size()))
{
bd.resize(layerId+1, 0);
}
Expand Down
32 changes: 20 additions & 12 deletions radiant/modulesystem/ApplicationContextImpl.cpp
Expand Up @@ -90,32 +90,40 @@ const char* LINK_NAME =
;

/// brief Returns the filename of the executable belonging to the current process, or 0 if not found.
char* getexename(char *buf, char* argv[]) {
/* Now read the symbolic link */
std::string getexename(char* argv[])
{
char buf[PATH_MAX];

// Now read the symbolic link
int ret = readlink(LINK_NAME, buf, PATH_MAX);

if (ret == -1) {
rMessage() << "getexename: falling back to argv[0]: '" << argv[0] << "'";
if (ret == -1)
{
rMessage() << "getexename: falling back to argv[0]: '" << argv[0] << "'\n";

const char* path = realpath(argv[0], buf);
if (path == NULL) {
/* In case of an error, leave the handling up to the caller */
return "";

if (path == nullptr)
{
// In case of an error, leave the handling up to the caller
return std::string();
}
}

/* Ensure proper NUL termination */
buf[ret] = 0;
buf[ret] = '\0';

/* delete the program name */
*(strrchr(buf, '/')) = '\0';

// NOTE: we build app path with a trailing '/'
// it's a general convention in Radiant to have the slash at the end of directories
if (buf[strlen(buf)-1] != '/') {
if (buf[strlen(buf)-1] != '/')
{
strcat(buf, "/");
}

return buf;
return std::string(buf);
}

void ApplicationContextImpl::initialise(int argc, char* argv[]) {
Expand All @@ -141,8 +149,8 @@ void ApplicationContextImpl::initialise(int argc, char* argv[]) {
_homePath = home;

{
char real[PATH_MAX];
_appPath = getexename(real, argv);
_appPath = getexename(argv);
rConsole() << "App Path is " << _appPath << std::endl;
ASSERT_MESSAGE(!_appPath.empty(), "failed to deduce app path");
}

Expand Down
12 changes: 6 additions & 6 deletions radiant/patch/Patch.cpp
Expand Up @@ -52,16 +52,16 @@ inline bool double_valid(double f) {
// Constructor
Patch::Patch(PatchNode& node) :
_node(node),
_shader(texdef_name_default()),
_undoStateSaver(NULL),
_undoStateSaver(nullptr),
_solidRenderable(_mesh),
_wireframeRenderable(_mesh),
_fixedWireframeRenderable(_mesh),
_renderableNTBVectors(_mesh),
_renderableCtrlPoints(GL_POINTS, _ctrl_vertices),
_renderableLattice(GL_LINES, _latticeIndices, _ctrl_vertices),
_transformChanged(false),
_tesselationChanged(true)
_tesselationChanged(true),
_shader(texdef_name_default())
{
construct();
}
Expand All @@ -73,16 +73,16 @@ Patch::Patch(const Patch& other, PatchNode& node) :
Snappable(other),
IUndoable(other),
_node(node),
_shader(other._shader.getMaterialName()),
_undoStateSaver(NULL),
_undoStateSaver(nullptr),
_solidRenderable(_mesh),
_wireframeRenderable(_mesh),
_fixedWireframeRenderable(_mesh),
_renderableNTBVectors(_mesh),
_renderableCtrlPoints(GL_POINTS, _ctrl_vertices),
_renderableLattice(GL_LINES, _latticeIndices, _ctrl_vertices),
_transformChanged(false),
_tesselationChanged(true)
_tesselationChanged(true),
_shader(other._shader.getMaterialName())
{
// Initalise the default values
construct();
Expand Down
4 changes: 2 additions & 2 deletions radiant/selection/RadiantSelectionSystem.cpp
Expand Up @@ -36,11 +36,11 @@ ShaderPtr RadiantSelectionSystem::_state;
RadiantSelectionSystem::RadiantSelectionSystem() :
_requestSceneGraphChange(false),
_requestWorkZoneRecalculation(true),
_defaultManipulatorType(Manipulator::Drag),
_mode(ePrimitive),
_componentMode(eDefault),
_countPrimitive(0),
_countComponent(0),
_defaultManipulatorType(Manipulator::Drag)
_countComponent(0)
{}

const SelectionInfo& RadiantSelectionSystem::getSelectionInfo() {
Expand Down
6 changes: 3 additions & 3 deletions radiant/ui/einspector/SkinChooser.cpp
Expand Up @@ -29,9 +29,9 @@ namespace
// Constructor
SkinChooser::SkinChooser() :
DialogBase(_(WINDOW_TITLE)),
_lastSkin(""),
_treeStore(NULL),
_treeView(NULL)
_treeStore(nullptr),
_treeView(nullptr),
_lastSkin("")
{
FitToScreen(0.6f, 0.6f);

Expand Down
2 changes: 1 addition & 1 deletion radiant/ui/layers/LayerControlDialog.cpp
Expand Up @@ -182,7 +182,7 @@ void LayerControlDialog::updateLayerUsage()

for (const LayerControlPtr& control : _layerControls)
{
assert(breakDown.size() > control->getLayerId());
assert(static_cast<int>(breakDown.size()) > control->getLayerId());

control->updateUsageStatusWidget(breakDown[control->getLayerId()]);
}
Expand Down
2 changes: 1 addition & 1 deletion radiant/ui/mapinfo/LayerInfoTab.cpp
Expand Up @@ -58,7 +58,7 @@ void LayerInfoTab::populateTab()
// Populate the liststore with the layer-to-nodecount information
GlobalLayerSystem().foreachLayer([&](int layerId, const std::string& layerName)
{
if (layerId >= bd.size()) return;
if (layerId >= static_cast<int>(bd.size())) return;

wxutil::TreeModel::Row row = _listStore->AddItem();

Expand Down

0 comments on commit d1d2dbf

Please sign in to comment.