Skip to content

Commit

Permalink
Change RapidJSON from UTF8 to UTF16
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaulgilman committed Oct 21, 2024
1 parent dadaba4 commit be85f13
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,18 +249,18 @@ bool wxOnlineRegistration::CheckInWithServer(int *usage_count) {
wxLogStatus("\tresponse: " + raw);
}

rapidjson::Document reader;
rapidjson::GenericDocument < rapidjson::UTF16<> > reader;
reader.Parse(raw.c_str());

if (!reader.HasParseError()) {
int code = reader["status"].GetInt();
int code = reader[L"status"].GetInt();
if (gs_enDebug) {
wxLogStatus("\tcode: %d", code);
}

if (code == 200) {
gs_regData->WriteSetting("count-since-last-verify-" + GetVersionAndPlatform(), wxString::Format("%d", 0));
if (usage_count) *usage_count = reader["result"]["usage_count"].GetInt();
if (usage_count) *usage_count = reader[L"result"][L"usage_count"].GetInt();
return true;
}
}
Expand Down Expand Up @@ -421,7 +421,7 @@ void wxOnlineRegistration::OnRegister(wxCommandEvent &) {

m_output->SetForegroundColour(wxMetroTheme::Colour(wxMT_TEXT));

rapidjson::Document reader;
rapidjson::GenericDocument < rapidjson::UTF16<> > reader;

if (m_register->GetLabel() == "Resend key") {
// https://developer.nrel.gov/api/sam/v1/tracker/resend_key?api_key=SAMAPIKEY&[email protected]
Expand All @@ -434,7 +434,7 @@ void wxOnlineRegistration::OnRegister(wxCommandEvent &) {

reader.Parse(raw.c_str());
if (!reader.HasParseError())
code = reader["status"].GetInt();
code = reader[L"status"].GetInt();

if (gs_enDebug) {
wxLogStatus("wxOnlineRegistration::OnRegister (Resend key)");
Expand Down Expand Up @@ -463,7 +463,7 @@ void wxOnlineRegistration::OnRegister(wxCommandEvent &) {
reader.Parse(raw.c_str());

if (!reader.HasParseError())
code = reader["status"].GetInt();
code = reader[L"status"].GetInt();

if (gs_enDebug) {
wxLogStatus("wxOnlineRegistration::OnRegister (Resend key)");
Expand Down

0 comments on commit be85f13

Please sign in to comment.