From dfddf5294677407c3a01b3a13c8348f02fe993ee Mon Sep 17 00:00:00 2001 From: Gabriele Contini <gcontini@users.noreply.github.com> Date: ćšć, 19 9æ 2019 20:20:18 +0800 Subject: [PATCH] Feature/mingw cross compile (#51) --- src/tools/license-generator/license-generator.cpp | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tools/license-generator/license-generator.cpp b/src/tools/license-generator/license-generator.cpp index f6efc9c..dcffd7e 100644 --- a/src/tools/license-generator/license-generator.cpp +++ b/src/tools/license-generator/license-generator.cpp @@ -84,7 +84,7 @@ try { end_date = normalize_date(dt_end); char curdate[20]; - time_t curtime = time(NULL); + time_t curtime = time(nullptr); strftime(curdate, 20, "%Y-%m-%d", localtime(&curtime)); begin_date.assign(curdate); } catch (const invalid_argument &e) { @@ -107,7 +107,9 @@ string client_signature = ""; if (vm.count("client_signature")) { client_signature = vm["client_signature"].as<string>(); + cout << "cli sig:" << client_signature; regex e("[A-Za-z0-9\\+/]{4}-[A-Za-z0-9\\+/]{4}-[A-Za-z0-9\\+/]{4}-[A-Za-z0-9\\+/]{4}"); + cout << "\nregex:"; if (!regex_match(client_signature, e)) { cerr << endl << "Client signature not recognized: " << client_signature @@ -143,12 +145,12 @@ void LicenseGenerator::generateAndOutputLicenses(const po::variables_map& vm, ostream& outputFile) { vector<FullLicenseInfo> licenseInfo = parseLicenseInfo(vm); - unique_ptr<CryptoHelper> helper = CryptoHelper::getInstance(); - const char pkey[] = PRIVATE_KEY; - size_t len = sizeof(pkey); + const unique_ptr<CryptoHelper> helper = CryptoHelper::getInstance(); + const unsigned char pkey[] = PRIVATE_KEY; + const size_t len = sizeof(pkey); for (auto it = licenseInfo.begin(); it != licenseInfo.end(); ++it) { const string license = it->printForSign(); - string signature = helper->signString((const void *)pkey,len,license); + const string signature = helper->signString((const void *)pkey,len,license); it->license_signature = signature; it->printAsIni(outputFile); } @@ -178,7 +180,7 @@ if (vm.count("output")) { const std::string fname = vm["output"].as<string>(); - fstream ofstream(fname, std::ios::out | std::ios::trunc); + fstream ofstream(fname, std::ios::out | std::ios::app); if (!ofstream.is_open()) { cerr << "can't open file [" << fname << "] for output." << endl << " error: " << strerror( errno); -- Gitblit v1.9.1