Remove compiler warnings on Clang/GCC (#3546)

This commit is contained in:
Alexander Bock
2025-02-28 23:29:38 +01:00
committed by GitHub
parent 1260ebf309
commit cd8924ed22
45 changed files with 140 additions and 138 deletions

View File

@@ -45,8 +45,6 @@
using namespace openspace;
namespace {
constexpr std::string_view _loggerCat = "LauncherWindow";
constexpr int ScreenWidth = 480;
constexpr int ScreenHeight = 640;
@@ -598,7 +596,7 @@ void LauncherWindow::openProfileEditor(const std::string& profile, bool isUserPr
connect(
&editor,
&ProfileEdit::raiseExitWindow,
[this, &editor, &savePath, &p, &profile]() {
[&editor, &savePath, &p, &profile]() {
const std::string origPath = std::format("{}{}.profile", savePath, profile);
// If this is a new profile we want to prompt the user
if (!std::filesystem::exists(origPath)) {

View File

@@ -108,7 +108,7 @@ namespace {
[quality](const std::pair<int, std::string>& p) { return p.first == quality; }
);
ghoul_assert(it != Quality.cend(), "Combobox has too many values");
return std::distance(Quality.cbegin(), it);
return static_cast<int>(std::distance(Quality.cbegin(), it));
}
} // namespace

View File

@@ -244,7 +244,7 @@ private:
void cleanUpTimelinesAndKeyframes();
void checkIfScriptUsesScenegraphNode(std::string_view s) const;
void checkIfScriptUsesScenegraphNode(std::string_view script) const;
properties::BoolProperty _renderPlaybackInformation;

View File

@@ -61,7 +61,7 @@ public:
*/
void setLuaValue(lua_State* state) override;
ghoul::lua::LuaTypes typeLua() const;
ghoul::lua::LuaTypes typeLua() const override;
/**
* Triggers this TriggerProperty.

View File

@@ -389,6 +389,8 @@ constexpr std::array<KeyInfo, 120> KeyInfos = {
struct KeyWithModifier {
Key key = Key::Unknown;
KeyModifier modifier = KeyModifier::None;
auto operator<=>(const KeyWithModifier&) const = default;
};
constexpr inline bool isKeypadKey(Key key) noexcept {
@@ -403,22 +405,6 @@ constexpr inline bool isKeypadKey(Key key) noexcept {
KeyWithModifier stringToKey(const std::string& str);
std::string keyToString(KeyWithModifier keyWithModifier);
// @TODO (abock, 2021-08-12) This function should die
constexpr bool operator<(const KeyWithModifier& lhs, const KeyWithModifier& rhs) noexcept
{
if (lhs.modifier == rhs.modifier) {
return lhs.key < rhs.key;
}
else {
return lhs.modifier < rhs.modifier;
}
}
constexpr bool operator==(const KeyWithModifier& lhs, const KeyWithModifier& rhs) noexcept
{
return (lhs.key == rhs.key) && (lhs.modifier == rhs.modifier);
}
} // namespace openspace
namespace ghoul {

View File

@@ -49,7 +49,7 @@ if (WIN32)
elseif (UNIX)
set(SOLOUD_BACKEND_ALSA ON CACHE BOOL "")
endif ()
add_subdirectory(ext/soloud/contrib)
add_subdirectory(ext/soloud/contrib SYSTEM)
# Unfortunately, the soloud cmake tarket doesn't set the include directories correctly
target_include_directories(openspace-module-audio SYSTEM PRIVATE ext/soloud/include)

View File

@@ -55,8 +55,6 @@ void DashboardItemParallelConnection::update() {
const size_t nConnections = global::parallelPeer->nConnections();
const std::string& hostName = global::parallelPeer->hostName();
int nLines = 1;
int nClients = static_cast<int>(nConnections);
if (status == ParallelConnection::Status::Host) {
nClients--;
@@ -92,8 +90,6 @@ void DashboardItemParallelConnection::update() {
else if (nClients == 1) {
_buffer += "You are the only client";
}
nLines = 2;
}
}

View File

@@ -54,7 +54,7 @@ namespace {
.synchronized = scripting::ScriptEngine::Script::ShouldBeSynchronized::No,
.sendToRemote = scripting::ScriptEngine::Script::ShouldSendToRemote::No
});
};
}
constexpr openspace::properties::Property::PropertyInfo InterpolationValueInfo = {
"Value",

View File

@@ -253,11 +253,11 @@ documentation::Documentation RenderableLabel::Documentation() {
RenderableLabel::RenderableLabel(const ghoul::Dictionary& dictionary)
: Renderable(dictionary, { .automaticallyUpdateRenderBin = false })
, _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _text(TextInfo, "")
, _color(ColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
, _fontSize(FontSizeInfo, 50.f, 1.f, 100.f)
, _size(SizeInfo, 8.f, 0.5f, 30.f)
, _minMaxSize(MinMaxSizeInfo, glm::ivec2(8, 20), glm::ivec2(0), glm::ivec2(100))
, _text(TextInfo, "")
, _enableFadingEffect(EnableFadingEffectInfo, false)
, _fadeWidths(FadeWidthsInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(100.f))
, _fadeDistances(FadeDistancesInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(100.f))

View File

@@ -38,7 +38,6 @@
#include <optional>
namespace {
constexpr std::string_view KeyLazyLoading = "LazyLoading";
constexpr std::string_view _loggerCat = "RenderablePlaneTimeVaryingImage";
constexpr openspace::properties::Property::PropertyInfo SourceFolderInfo = {

View File

@@ -1201,7 +1201,7 @@ void RenderableFieldlinesSequence::updateVertexPositionBuffer() {
);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
unbindGL();
}
@@ -1226,7 +1226,7 @@ void RenderableFieldlinesSequence::updateVertexColorBuffer() {
);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
unbindGL();
}
@@ -1252,7 +1252,7 @@ void RenderableFieldlinesSequence::updateVertexMaskingBuffer() {
);
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
unbindGL();
}

View File

@@ -38,8 +38,6 @@
#include <optional>
namespace {
constexpr std::string_view KeyFilterColumnNames = "FilterColumnNames";
constexpr std::string_view _loggerCat = "ReadFitsTask";
struct [[codegen::Dictionary(ReadFitsTask)]] Parameters {

View File

@@ -93,7 +93,9 @@ void MilkywayPointsConversionTask::perform(const Task::ProgressCallback& progres
documentation::Documentation MilkywayPointsConversionTask::Documentation() {
return {
"MilkywayPointsConversionTask",
"galaxy_milkywaypointsconversiontask"
"galaxy_milkywaypointsconversiontask",
"",
{}
};
}

View File

@@ -51,12 +51,11 @@ private:
void internalDeinitialize() override final;
std::array<std::unique_ptr<ghoul::opengl::Texture>, 2> tileTexture;
std::array<GLuint, 2> fbo = { 0, 0 };
std::array<Tile, 2> tiles;
#ifdef OPENSPACE_HAS_SPOUT
std::array<GLuint, 2> fbo = { 0, 0 };
std::unique_ptr<spout::SpoutReceiverPropertyProxy> spoutReceiver;
#endif
#endif // OPENSPACE_HAS_SPOUT
bool spoutUpdate = false;
};

View File

@@ -66,7 +66,6 @@ TileProviderByDate::TileProviderByDate(const ghoul::Dictionary& dictionary) {
if (dictionary.hasValue<std::string>("GlobeName")) {
prov.second.setValue("GlobeName", dictionary.value<std::string>("GlobeName"));
}
layers::Layer::ID typeID = layers::Layer::ID::DefaultTileProvider;
std::unique_ptr<TileProvider> tp = createFromDictionary(prov.second);
const std::string provId = prov.second.value<std::string>("Identifier");

View File

@@ -67,9 +67,9 @@ void GuiMemoryComponent::render() {
_isCollapsed = ImGui::IsWindowCollapsed();
uint64_t ram = global::openSpaceEngine->ramInUse();
ImGui::Text("RAM: %u (%f MiB)", ram, ram / (1024.f * 1024.f));
ImGui::Text("RAM: %lu (%f MiB)", ram, ram / (1024.f * 1024.f));
uint64_t vram = global::openSpaceEngine->vramInUse();
ImGui::Text("VRAM: %u (%f MiB)", vram, vram / (1024.f * 1024.f));
ImGui::Text("VRAM: %lu (%f MiB)", vram, vram / (1024.f * 1024.f));
ImGui::Spacing();

View File

@@ -60,7 +60,7 @@ IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
, _enabled(EnabledInfo, true)
, _alpha(AlphaInfo, 0.9f, 0.f, 1.f)
, _delete(DeleteInfo)
, _type(std::move(type))
, _iswaType(std::move(type))
{
addProperty(_enabled);
addProperty(_alpha);
@@ -72,7 +72,7 @@ IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
IswaBaseGroup::~IswaBaseGroup() {}
bool IswaBaseGroup::isType(const std::string& type) const {
return (_type == type);
return (_iswaType == type);
}
void IswaBaseGroup::updateGroup() {

View File

@@ -61,7 +61,8 @@ protected:
std::shared_ptr<DataProcessor> _dataProcessor;
bool _registered = false;
std::string _type;
private:
std::string _iswaType;
};
} //namespace openspace

View File

@@ -101,9 +101,9 @@ IswaManager::IswaManager()
: properties::PropertyOwner({ "IswaManager", "Iswa Manager" })
, _baseUrl("https://iswa-demo-server.herokuapp.com/")
{
_type[CygnetType::Texture] = "Texture";
_type[CygnetType::Data] = "Data";
_type[CygnetType::Kameleon] = "Kameleon";
_cygnetType[CygnetType::Texture] = "Texture";
_cygnetType[CygnetType::Data] = "Data";
_cygnetType[CygnetType::Kameleon] = "Kameleon";
_geom[CygnetGeometry::Plane] = "Plane";
_geom[CygnetGeometry::Sphere] = "Sphere";
@@ -124,7 +124,6 @@ IswaManager::~IswaManager() {
_cygnetInformation.clear();
}
void IswaManager::initialize() {
ghoul_assert(!isInitialized(), "IswaManager is already initialized");
_instance = new IswaManager;
@@ -156,10 +155,10 @@ void IswaManager::addIswaCygnet(int id, const std::string& type, std::string gro
metaFuture.group = std::move(group);
// Assign type of cygnet Texture/Data
if (type == _type[CygnetType::Texture]) {
if (type == _cygnetType[CygnetType::Texture]) {
metaFuture.type = CygnetType::Texture;
}
else if (type == _type[CygnetType::Data]) {
else if (type == _cygnetType[CygnetType::Data]) {
metaFuture.type = CygnetType::Data;
}
else {
@@ -389,7 +388,7 @@ std::string IswaManager::jsonPlaneToLuaTable(MetadataFuture& data) {
"Name = '" + data.name +"' , "
"Parent = '" + parent + "', "
"Renderable = {"
"Type = '" + _type[data.type] + _geom[data.geom] + "', "
"Type = '" + _cygnetType[data.type] + _geom[data.geom] + "', "
"Id = " + ghoul::to_string(data.id) + ", "
"Frame = '" + frame + "' , "
"GridMin = " + ghoul::to_string(min) + ", "
@@ -496,7 +495,7 @@ std::string IswaManager::jsonSphereToLuaTable(MetadataFuture& data) {
"Name = '" + data.name +"' , "
"Parent = '" + parent + "', "
"Renderable = {"
"Type = '" + _type[data.type] + _geom[data.geom] + "', "
"Type = '" + _cygnetType[data.type] + _geom[data.geom] + "', "
"Id = " + std::to_string(data.id) + ", "
"Frame = '" + frame + "' , "
"GridMin = " + ghoul::to_string(min) + ", "
@@ -513,7 +512,9 @@ std::string IswaManager::jsonSphereToLuaTable(MetadataFuture& data) {
void IswaManager::createPlane(MetadataFuture& data) {
// check if this plane already exist
std::string name = _type[data.type] + _geom[data.geom] + std::to_string(data.id);
std::string name = std::format(
"{}{}{}", _cygnetType[data.type], _geom[data.geom], data.id
);
if (!data.group.empty()) {
std::string type;
@@ -551,7 +552,9 @@ void IswaManager::createPlane(MetadataFuture& data) {
void IswaManager::createSphere(MetadataFuture& data) {
// check if this sphere already exist
std::string name = _type[data.type] + _geom[data.geom] + std::to_string(data.id);
std::string name = std::format(
"{}{}{}", _cygnetType[data.type], _geom[data.geom], data.id
);
if (!data.group.empty()) {
std::string type = typeid(DataSphere).name();

View File

@@ -116,7 +116,7 @@ private:
void fillCygnetInfo(std::string jsonString);
void registerGroup(std::string groupName, std::string type);
std::map<int, std::string> _type;
std::map<int, std::string> _cygnetType;
std::map<int, std::string> _geom;
std::shared_ptr<ccmc::Kameleon> _kameleon;

View File

@@ -54,8 +54,6 @@
#endif // WIN32
namespace {
constexpr std::string_view _loggerCat = "KameleonVolumeReader";
template <typename T>
T globalAttribute(ccmc::Model&, const std::string&) {
static_assert(sizeof(T) == 0);

View File

@@ -162,21 +162,21 @@ bool BrickManager::buildBrickList(BUFFER_INDEX bufferIndex,
{
// Keep track of number bricks used and number of bricks cached
// (for benchmarking)
int numBricks = 0;
int numCached = 0;
//int numBricks = 0;
//int numCached = 0;
// For every non-zero entry in the request list, assign a texture atlas
// coordinate. For zero entries, signal "no brick" using -1.
for (unsigned int i = 0; i < brickRequest.size(); i++) {
if (brickRequest[i] > 0) {
numBricks++;
//numBricks++;
//INFO("Checking brick " << i);
// If the brick is already in the atlas, keep the coordinate
if (_bricksInPBO[bufferIndex][i] != -1) {
numCached++;
//numCached++;
// Get the corresponding coordinates from index
int x, y, z;

View File

@@ -31,8 +31,8 @@ namespace openspace {
class BrickSelector {
public:
virtual ~BrickSelector() {};
virtual bool initialize() { return true; };
virtual ~BrickSelector() {}
virtual bool initialize() { return true; }
virtual void selectBricks(int timestep, std::vector<int>& bricks) = 0;
};

View File

@@ -96,7 +96,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
int bstNode = bstOffset;
bool bstRightOnly = true;
unsigned int bstLevel = 0;
//unsigned int bstLevel = 0;
do {
glm::vec3 leafOffset(0.f); // Leaf offset in leaf sized voxels
@@ -173,7 +173,7 @@ bool ErrorHistogramManager::buildFromLeaf(unsigned int bstOffset,
bstRightOnly &= (bstNode % 2 == 0);
bstNode = parentOffset(bstNode, 2);
bstLevel++;
//bstLevel++;
} while (bstNode != -1);
return true;

View File

@@ -152,7 +152,7 @@ bool MultiresVolumeRaycaster::isCameraInside(const RenderData& data,
float divisor = 1.0;
for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) {
if (abs(modelTransform[i][j]) > divisor) {
if (std::abs(modelTransform[i][j]) > divisor) {
divisor = modelTransform[i][j];
}
}

View File

@@ -67,20 +67,20 @@ bool TSP::load() {
return false;
}
if (false) {
if (!calculateSpatialError()) {
LERROR("Could not calculate spatial error");
return false;
}
if (!calculateTemporalError()) {
LERROR("Could not calculate temporal error");
return false;
}
if (!writeCache()) {
LERROR("Could not write cache");
return false;
}
#if 0
if (!calculateSpatialError()) {
LERROR("Could not calculate spatial error");
return false;
}
if (!calculateTemporalError()) {
LERROR("Could not calculate temporal error");
return false;
}
if (!writeCache()) {
LERROR("Could not write cache");
return false;
}
#endif
}
initalizeSSO();

View File

@@ -95,7 +95,7 @@ HorizonsTranslation::HorizonsTranslation(const ghoul::Dictionary& dictionary)
files.cbegin(),
files.cend(),
std::back_inserter(f),
[](const std::filesystem::path& p) { return p.string(); }
[](const std::filesystem::path& path) { return path.string(); }
);
_horizonsFiles = f;
}

View File

@@ -323,13 +323,13 @@ TouchInteraction::TouchInteraction()
glm::vec4(0.2f)
)
, _constTimeDecay_secs(ConstantTimeDecaySecsInfo, 1.75f, 0.1f, 4.f)
, _pinchInputs({ TouchInput(0, 0, 0.f, 0.f, 0.0), TouchInput(0, 0, 0.f, 0.f, 0.0) })
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
, _sensitivity{ glm::dvec2(0.08, 0.045), 12.0, 2.75, glm::dvec2(0.08, 0.045) }
// Calculated with two vectors with known diff in length, then
// projDiffLength/diffLength.
, _enableDirectManipulation(EnableDirectManipulationInfo, true)
, _directTouchDistanceThreshold(DirectManipulationThresholdInfo, 5.f, 0.f, 10.f)
, _pinchInputs({ TouchInput(0, 0, 0.f, 0.f, 0.0), TouchInput(0, 0, 0.f, 0.f, 0.0) })
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
, _sensitivity{ glm::dvec2(0.08, 0.045), 12.0, 2.75, glm::dvec2(0.08, 0.045) }
{
addProperty(_disableZoom);
addProperty(_disableRoll);
@@ -796,17 +796,17 @@ void TouchInteraction::computeVelocities(const std::vector<TouchInputHolder>& li
list.begin(),
list.end(),
0.0,
[this, &lastProcessed](double diff, const TouchInputHolder& inputHolder) {
[this, &lastProcessed](double diff, const TouchInputHolder& holder) {
TouchInput point = *std::find_if(
lastProcessed.begin(),
lastProcessed.end(),
[&inputHolder](const TouchInput& input) {
return inputHolder.holdsInput(input);
[&holder](const TouchInput& input) {
return holder.holdsInput(input);
}
);
double res = diff;
float lastAngle = point.angleToPos(_centroid.x, _centroid.y);
float currentAngle = inputHolder.latestInput().angleToPos(
float currentAngle = holder.latestInput().angleToPos(
_centroid.x,
_centroid.y
);
@@ -1210,7 +1210,11 @@ double FrameTimeAverage::averageFrameTime() const {
return 1.0 / 60.0;
}
else {
return std::accumulate(_samples, _samples + _nSamples, 0.0) / (double)(_nSamples);
return std::accumulate(
_samples,
_samples + _nSamples,
0.0
) / static_cast<double>(_nSamples);
}
}

View File

@@ -33,8 +33,6 @@
#include <ghoul/logging/logmanager.h>
namespace {
constexpr std::string_view _loggerCat = "RenderableToyVolume";
constexpr openspace::properties::Property::PropertyInfo SizeInfo = {
"Size",
"Size",

View File

@@ -405,7 +405,9 @@ void VideoPlayer::initializeMpv() {
LINFO("mpv init failed");
}
mpv_opengl_init_params gl_init_params { getOpenGLProcAddress, nullptr };
mpv_opengl_init_params glInitParams;
glInitParams.get_proc_address = getOpenGLProcAddress;
glInitParams.get_proc_address_ctx = nullptr;
int adv = 1; // Use libmpv advanced mode since we will use the update callback
// Decouple mpv from waiting to get the correct fps. Use with flag video-timing-offset
// set to 0
@@ -413,7 +415,7 @@ void VideoPlayer::initializeMpv() {
mpv_render_param params[] = {
{ MPV_RENDER_PARAM_API_TYPE, const_cast<char*>(MPV_RENDER_API_TYPE_OPENGL) },
{ MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &gl_init_params },
{ MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &glInitParams },
{ MPV_RENDER_PARAM_ADVANCED_CONTROL, &adv },
{ MPV_RENDER_PARAM_BLOCK_FOR_TARGET_TIME, &blockTime },
{ MPV_RENDER_PARAM_INVALID, nullptr }

View File

@@ -144,7 +144,6 @@ void GenerateRawVolumeFromFileTask::perform(const ProgressCallback& progressCall
progressCallback(0.5f);
// Write data into volume data structure
int k = 0;
for (const dataloader::Dataset::Entry& entry : data.entries) {
// Get the closest i, j , k voxel that should contain this data
glm::vec3 normalizedPos = (entry.position - _lowerDomainBound) /
@@ -163,7 +162,6 @@ void GenerateRawVolumeFromFileTask::perform(const ProgressCallback& progressCall
size_t index = rawVolume.coordsToIndex(cell);
rawVolume.set(index, value);
k++;
}
progressCallback(0.75f);

View File

@@ -28,14 +28,29 @@
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4100)
#endif // _MSC_VER
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wshadow-field"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include <include/cef_app.h>
#include <include/wrapper/cef_helpers.h>
#ifdef _MSC_VER
#pragma warning (pop)
#endif // _MSC_VER
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
namespace openspace {

View File

@@ -26,9 +26,27 @@
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wshadow-field"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include "include/cef_app.h"
#include "include/webbrowserapp.h"
#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
// Entry point function for all processes.
int main(int argc, char* argv[]) {
// Provide CEF with command-line arguments.

View File

@@ -30,10 +30,6 @@
#include "keyframerecordinghandler_lua.inl"
namespace {
constexpr std::string_view _loggerCat = "KeyframeRecording";
} // namespace
namespace openspace::interaction {
KeyframeRecordingHandler::KeyframeRecordingHandler()

View File

@@ -72,7 +72,6 @@ namespace {
constexpr std::string_view FrameTypeCameraAscii = "camera";
constexpr std::string_view FrameTypeScriptAscii = "script";
constexpr std::string_view FrameTypeCommentAscii = "#";
constexpr char FrameTypeCameraBinary = 'c';
constexpr char FrameTypeScriptBinary = 's';
@@ -180,6 +179,7 @@ namespace {
template <DataMode mode>
std::optional<FrameType> readFrameType(std::istream&, int) {
static_assert(sizeof(int) == 0, "Unimplemented overload");
return std::nullopt;
}
template <>

View File

@@ -78,9 +78,6 @@ namespace {
openspace::properties::Property::Visibility::Developer
};
const std::string FileExtensionBinary = ".osrec";
const std::string FileExtensionAscii = ".osrectxt";
constexpr std::string_view ScriptReturnPrefix = "return ";
} // namespace
@@ -111,7 +108,7 @@ void SessionRecordingHandler::preSynchronization(double dt) {
if (_state != _lastState) {
using K = CallbackHandle;
using V = StateChangeCallback;
for (const std::pair<const K, V>& it : _stateChangeCallbacks) {
for (const std::pair<K, V>& it : _stateChangeCallbacks) {
it.second();
}
_lastState = _state;
@@ -450,8 +447,8 @@ void SessionRecordingHandler::seek(double recordingTime) {
_timeline.entries.begin(),
_timeline.entries.end(),
recordingTime,
[](double recordingTime, const SessionRecording::Entry& e) {
return recordingTime < e.timestamp;
[](double rt, const SessionRecording::Entry& e) {
return rt < e.timestamp;
}
);
_playback.elapsedTime = recordingTime;
@@ -633,7 +630,9 @@ double SessionRecordingHandler::currentApplicationInterpolationTime() const {
return _playback.saveScreenshots.currentApplicationTime;
}
void SessionRecordingHandler::checkIfScriptUsesScenegraphNode(std::string_view s) const {
void SessionRecordingHandler::checkIfScriptUsesScenegraphNode(
std::string_view script) const
{
auto isolateTermFromQuotes = [](std::string_view s) -> std::string_view {
// Remove any leading spaces
s.remove_prefix(s.find_first_not_of(" "));
@@ -660,26 +659,31 @@ void SessionRecordingHandler::checkIfScriptUsesScenegraphNode(std::string_view s
"NavigationHandler.OrbitalNavigator.Aim"
};
for (std::string_view script : NavScriptsUsingNodes) {
if (navTerm.find(script) != std::string::npos) {
for (std::string_view s : NavScriptsUsingNodes) {
if (navTerm.find(s) != std::string::npos) {
return true;
}
}
return false;
};
if (s.starts_with(ScriptReturnPrefix)) {
s.remove_prefix(ScriptReturnPrefix.length());
if (script.starts_with(ScriptReturnPrefix)) {
script.remove_prefix(ScriptReturnPrefix.length());
}
// This works for both setPropertyValue and setPropertyValueSingle
if (!s.starts_with("openspace.setPropertyValue") || s.find('(') == std::string::npos)
if (!script.starts_with("openspace.setPropertyValue") ||
script.find('(') == std::string::npos)
{
return;
}
std::string_view subjectOfSetProp = isolateTermFromQuotes(s.substr(s.find('(') + 1));
std::string_view subjectOfSetProp = isolateTermFromQuotes(
script.substr(script.find('(') + 1)
);
if (checkForScenegraphNodeAccessNav(subjectOfSetProp)) {
std::string_view navNode = isolateTermFromQuotes(s.substr(s.find(',') + 1));
std::string_view navNode = isolateTermFromQuotes(
script.substr(script.find(',') + 1)
);
if (navNode != "nil") {
auto it = std::find(_loadedNodes.begin(), _loadedNodes.end(), navNode);
if (it == _loadedNodes.end()) {

View File

@@ -37,9 +37,6 @@
namespace {
constexpr std::string_view _loggerCat = "ConvertRecFormatTask";
constexpr std::string_view KeyInFilePath = "InputFilePath";
constexpr std::string_view KeyOutFilePath = "OutputFilePath";
struct [[codegen::Dictionary(ConvertRecFormatTask)]] Parameters {
std::filesystem::path inputFilePath;
std::filesystem::path outputFilePath;

View File

@@ -1044,7 +1044,7 @@ void createCustomProperty<openspace::properties::TriggerProperty>(
TriggerProperty* p = new TriggerProperty(info);
if (onChange.has_value() && !onChange->empty()) {
p->onChange(
[p, script = *onChange]() {
[script = *onChange]() {
using namespace ghoul::lua;
LuaState s;
openspace::global::scriptEngine->initializeLuaState(s);

View File

@@ -146,7 +146,12 @@ function (set_openspace_compile_settings target)
"-Wno-deprecated-enum-enum-conversion"
"-Wno-missing-braces"
"-Wno-sign-compare"
"-Wno-suggest-destructor-override"
"-Wno-unknown-attributes"
# This should be removed as soon as https://github.com/g-truc/glm/issues/1349 is
# addressed
"-Wno-defaulted-function-deleted"
)

View File

@@ -41,13 +41,6 @@
// compiler to agree
// NOLINTBEGIN(modernize-use-emplace)
namespace {
std::ostream& operator<<(std::ostream& os, const openspace::Profile& profile) {
os << profile.serialize();
return os;
}
} // namespace openspace
using namespace openspace;
//

View File

@@ -37,13 +37,6 @@
using namespace openspace;
namespace {
std::string stringify(const std::filesystem::path& filename) {
const std::ifstream myfile = std::ifstream(filename);
std::stringstream buffer;
buffer << myfile.rdbuf();
return buffer.str();
}
void validate(std::string_view cfgString) {
const std::filesystem::path schemaDir = absPath("${TESTDIR}/../config/schema");
const std::filesystem::path schema = schemaDir / "sgcteditor.schema.json";