fix: rename

fix: new jsoncpp version
This commit is contained in:
Tobias Reisinger 2019-07-29 12:10:45 +02:00
parent 8d4ad2f631
commit d1d1de221f
2 changed files with 13 additions and 4 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.2)
Project(emgauwa-core)
Project(core)
link_directories(/usr/local/lib)
link_libraries(drogon trantor pthread dl)
@ -104,4 +104,4 @@ foreach(cspFile ${SCP_LIST})
endforeach()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(emgauwa-core ${SRC_DIR} ${CTL_SRC} ${FILTER_SRC} ${VIEWSRC} ${PLUGIN_SRC} ${MODEL_SRC} ${HELPER_SRC})
add_executable(core ${SRC_DIR} ${CTL_SRC} ${FILTER_SRC} ${VIEWSRC} ${PLUGIN_SRC} ${MODEL_SRC} ${HELPER_SRC})

View file

@ -4,6 +4,7 @@
#include <helpers.h>
#include <cmath>
#include <models/controller_dbo.h>
#include <fstream>
#include "api_v1_controllers.h"
using namespace api::v1;
@ -93,11 +94,19 @@ void controllers::post_discover(const HttpRequestPtr &req, std::function<void(co
}
answer_payload[payload_length] = '\0';
std::ifstream answer_payload_stream(answer_payload);
Json::Reader json_reader;
Json::CharReaderBuilder json_reader;
std::string errs;
Json::Value client_info;
json_reader.parse(answer_payload, &answer_payload[payload_length], client_info, false);
if (!Json::parseFromStream(json_reader, answer_payload_stream, &client_info, &errs))
{
// report to the user the failure and their locations in the document.
std::cout << "Failed to parse configuration\n"
<< errs;
return;
}
free(answer_payload);