From fd576619c16de1d7c26b95640a4eff9ce4c07708 Mon Sep 17 00:00:00 2001 From: Vincent Tavernier <vincent.tavernier@inria.fr> Date: Wed, 4 Oct 2017 17:42:11 +0200 Subject: [PATCH] Fix example code --- examples/50-shadertoy/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/50-shadertoy/main.cpp b/examples/50-shadertoy/main.cpp index 39a2f81..76ddb23 100644 --- a/examples/50-shadertoy/main.cpp +++ b/examples/50-shadertoy/main.cpp @@ -94,13 +94,14 @@ Json::Value json_get(CURL *curl, const string &url) return result; } -int parseOptions(string &shaderId, string &shaderApiKey, bool dump, int argc, char *argv[]) +int parseOptions(string &shaderId, string &shaderApiKey, bool &dump, int argc, char *argv[]) { // Read and parse options + bool help; po::options_description desc("libshadertoy 50-shadertoy example"); desc.add_options() - ("h,help", po::bool_switch(&dump)->default_value(false), "show a help message") - ("dump,d", "Dump binary formats of the loaded programs") + ("help,h", po::bool_switch(&help)->default_value(false), "show a help message") + ("dump,d", po::bool_switch(&dump)->default_value(false), "Dump binary formats of the loaded programs") ("id,i", po::value<string>(&shaderId)->required(), "ID of the ShaderToy to render") ("api,a", po::value<string>(&shaderApiKey)->required(), "API key for ShaderToy query"); @@ -117,7 +118,7 @@ int parseOptions(string &shaderId, string &shaderApiKey, bool dump, int argc, ch return 2; } - if (vm.find("help") != vm.end()) + if (help) { cout << desc << endl; return 1; @@ -461,7 +462,7 @@ int main(int argc, char *argv[]) // Options string shaderId, shaderApiKey; - bool dumpShaders = false; + bool dumpShaders; // Parse options from ARGV code = parseOptions(shaderId, shaderApiKey, dumpShaders, argc, argv); -- GitLab