Skip to content

Commit

Permalink
CPL_DEBUG ninjainit
Browse files Browse the repository at this point in the history
  • Loading branch information
RuiZhang-kwf8 authored Jul 5, 2024
1 parent ac4ad35 commit 8aa43b0
Showing 1 changed file with 16 additions and 53 deletions.
69 changes: 16 additions & 53 deletions src/ninja/ninja_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,40 +130,37 @@ int NinjaInitialize(const char *pszGdalData, const char *pszWindNinjaData)
GDALAllRegister();
OGRRegisterAll();


time_t now = time(0);

std::cout << "Logging message to console." << std::endl;
// convert now to tm struct for UTC
tm *gmtm = gmtime(&now);
char* dt = asctime(gmtm);
std::string cpp_string(dt);


time_t now = time(0);
std::string url = "https://ninjastorm.firelab.org/sqlitetest/?time=";
cpp_string.erase(std::remove_if(cpp_string.begin(), cpp_string.end(), ::isspace),cpp_string.end());

// convert now to tm struct for UTC
tm *gmtm = gmtime(&now);
char* dt = asctime(gmtm);
std::string cpp_string(dt);

std::string full = url + cpp_string;

std::string url = "https://ninjastorm.firelab.org/sqlitetest/?time=";
cpp_string.erase(std::remove_if(cpp_string.begin(), cpp_string.end(), ::isspace),
cpp_string.end());


std::string full = url + cpp_string;


const char *charStr = full.data();
const char *charStr = full.data();

CPLHTTPResult *poResult;
std::cout << charStr << std::endl;
CPLDebug("WINDNINJA", strcat("Sending Req to PhoneHome Server: ", charStr));
CPLSetConfigOption("GDAL_HTTP_UNSAFESSL", "YES");

poResult = CPLHTTPFetch(charStr, NULL);

if (poResult) {
CPLHTTPDestroyResult(poResult);
} else {
std::cerr << "Fetch data." << std::endl;
}

} else {
CPLDebug("WINDNINJA", "Fetch Request to Phone Home Server Failed");
}


if(!CPLCheckForFile(CPLStrdup(CPLFormFilename(CPLStrdup(pszGdalData), "gdalicon.png", NULL)), NULL))
{
CPLDebug("WINDNINJA", "Invalid path for GDAL_DATA: %s", pszGdalData);
Expand Down Expand Up @@ -209,40 +206,6 @@ int NinjaInitialize()
*/
CPLSetConfigOption( "GDAL_HTTP_UNSAFESSL", "YES");

std::cout << "Logging message to console." << std::endl;


time_t now = time(0);

// convert now to tm struct for UTC
tm *gmtm = gmtime(&now);
char* dt = asctime(gmtm);
std::string cpp_string(dt);


std::string url = "https://ninjastorm.firelab.org/sqlitetest/?time=";
cpp_string.erase(std::remove_if(cpp_string.begin(), cpp_string.end(), ::isspace),
cpp_string.end());


std::string full = url + cpp_string;


const char *charStr = full.data();

CPLHTTPResult *poResult;
std::cout << charStr << std::endl;
CPLSetConfigOption("GDAL_HTTP_UNSAFESSL", "YES");

poResult = CPLHTTPFetch(charStr, NULL);

if (poResult) {
CPLHTTPDestroyResult(poResult);
} else {
std::cerr << "Fetch data." << std::endl;
}


#ifdef WIN32
CPLDebug( "WINDNINJA", "Setting GDAL_DATA..." );
std::string osGdalData;
Expand Down

0 comments on commit 8aa43b0

Please sign in to comment.