2424 #include < steamdatagram_gamecoordinator.h>
2525#endif
2626
27- #include < picojson .h>
27+ #include < vjson .h>
2828
2929// Really?
3030#ifdef _WIN32
@@ -101,7 +101,7 @@ int s_nExpiryDays = k_nDefaultExpiryDays;
101101bool s_bOutputJSON;
102102bool s_bOutputValveSrcds;
103103bool s_bOutputTrimWhitespace;
104- picojson::object s_jsonOutput;
104+ vjson::Object s_jsonOutput;
105105
106106#ifdef CERTTOOL_ENABLE_SDR
107107 SteamDatagramRelayAuthTicket s_hostedServerTicketProperties;
@@ -263,8 +263,8 @@ static void AddPublicKeyInfoToJSON()
263263 std::string sKeyID = PublicKeyIDAsString ();
264264 std::string sComment = " ID" +sKeyID ;
265265
266- s_jsonOutput[ " public_key_id" ] = picojson::value ( PublicKeyIDAsString () );
267- s_jsonOutput[ " public_key" ] = picojson::value ( PublicKeyAsAuthorizedKeys () );
266+ s_jsonOutput[ " public_key_id" ] = PublicKeyIDAsString ();
267+ s_jsonOutput[ " public_key" ] = PublicKeyAsAuthorizedKeys ();
268268}
269269
270270void GenKeyPair ()
@@ -319,7 +319,7 @@ void GenKeyPair()
319319 else
320320 Printf ( " %s\n " , text );
321321
322- s_jsonOutput[ " private_key" ] = picojson::value ( text ) ;
322+ s_jsonOutput[ " private_key" ] = text;
323323
324324 // Round trip sanity check
325325 {
@@ -332,7 +332,7 @@ void GenKeyPair()
332332static const char k_szSDRCertPEMHeader[] = " -----BEGIN STEAMDATAGRAM CERT-----" ;
333333static const char k_szSDRCertPEMFooter[] = " -----END STEAMDATAGRAM CERT-----" ;
334334
335- void PrintCertInfo ( const CMsgSteamDatagramCertificateSigned &msgSigned, picojson::object &outJSON )
335+ void PrintCertInfo ( const CMsgSteamDatagramCertificateSigned &msgSigned, vjson::Object &outJSON )
336336{
337337 char szTemp[ 256 ];
338338
@@ -356,47 +356,47 @@ void PrintCertInfo( const CMsgSteamDatagramCertificateSigned &msgSigned, picojso
356356
357357 std::string sPOPIDs ;
358358 {
359- picojson::array pop_ids;
359+ vjson::Array pop_ids;
360360 for ( SteamNetworkingPOPID id: msgCert.gameserver_datacenter_ids () )
361361 {
362362 GetSteamNetworkingLocationPOPStringFromID ( id, szTemp );
363363
364364 if ( !sPOPIDs .empty () )
365365 sPOPIDs += ' ' ;
366366 sPOPIDs += szTemp;
367- pop_ids.push_back ( picojson::value ( szTemp ) );
367+ pop_ids.push_back ( szTemp );
368368 }
369369 if ( !pop_ids.empty () )
370370 {
371- outJSON[ " pop_ids" ] = picojson::value ( pop_ids ) ;
371+ outJSON[ " pop_ids" ] = pop_ids;
372372 }
373373 }
374374
375375 std::string sAppIDs ;
376376 {
377- picojson::array app_ids;
377+ vjson::Array app_ids;
378378 for ( AppId_t id: msgCert.app_ids () )
379379 {
380380 V_sprintf_safe ( szTemp, " %u" , id );
381381
382382 if ( !sAppIDs .empty () )
383383 sAppIDs += ' ' ;
384384 sAppIDs += szTemp;
385- app_ids.push_back ( picojson::value ( ( double )id ) );
385+ app_ids.push_back ( ( double )id );
386386 }
387387 if ( !app_ids.empty () )
388388 {
389- outJSON[ " app_ids" ] = picojson::value ( app_ids ) ;
389+ outJSON[ " app_ids" ] = app_ids;
390390 }
391391 }
392392
393393 uint64 key_id = CalculatePublicKeyID ( pubKey );
394394
395- outJSON[ " time_created" ] = picojson::value ( ( double )timeCreated ) ;
396- outJSON[ " time_created_string" ] = picojson::value ( szTimeCreated ) ;
397- outJSON[ " time_expiry" ] = picojson::value ( ( double )timeExpiry ) ;
398- outJSON[ " time_expiry_string" ] = picojson::value ( szTimeExpiry ) ;
399- outJSON[ " ca_key_id" ] = picojson::value ( KeyIDAsString ( msgSigned.ca_key_id () ) );
395+ outJSON[ " time_created" ] = ( double )timeCreated;
396+ outJSON[ " time_created_string" ] = szTimeCreated;
397+ outJSON[ " time_expiry" ] = ( double )timeExpiry;
398+ outJSON[ " time_expiry_string" ] = szTimeExpiry;
399+ outJSON[ " ca_key_id" ] = KeyIDAsString ( msgSigned.ca_key_id () );
400400
401401 Printf ( " #Public key . . . : %s ID%s\n " , PublicKeyAsAuthorizedKeys ( pubKey ).c_str (), KeyIDAsString ( key_id ).c_str () );
402402 Printf ( " #Created. . . . . : %s (%llu)\n " , szTimeCreated, (unsigned long long )timeCreated );
@@ -458,7 +458,7 @@ void CreateCert()
458458 Printf ( " %s" , pem.c_str () );
459459
460460 std::string pem_json = Base64EncodeProtobuf ( msgSigned, " " );
461- s_jsonOutput[ " cert" ] = picojson::value ( pem_json ) ;
461+ s_jsonOutput[ " cert" ] = pem_json;
462462
463463 PrintCertInfo ( msgSigned, s_jsonOutput );
464464}
@@ -478,7 +478,7 @@ void PrintDHKey( const TCryptoKey &key, const char *pszPlainTextHeader, const ch
478478 DbgVerify ( CCrypto::HexEncode ( bufTemp.Base (), cbRaw, pszHex, cbText ) );
479479
480480 Printf ( " %s: %s\n " , pszPlainTextHeader, pszHex );
481- s_jsonOutput[ pszJSON ] = picojson::value ( pszHex ) ;
481+ s_jsonOutput[ pszJSON ] = pszHex;
482482
483483 // !TEST! Round-trip to make sure we are working
484484 TCryptoKey keyCheck;
@@ -541,7 +541,7 @@ void CreateHostedServerTicket()
541541
542542 std::string ticket_base64 = Base64EncodeProtobuf ( msgSignedTicket, " " );
543543 Printf ( " SDR_DEVTICKET=%s\n " , ticket_base64.c_str () );
544- s_jsonOutput[ " ticket" ] = picojson::value ( ticket_base64 ) ;
544+ s_jsonOutput[ " ticket" ] = ticket_base64;
545545}
546546
547547#endif
@@ -774,7 +774,7 @@ int main( int argc, char **argv )
774774
775775 if ( s_bOutputJSON )
776776 {
777- puts ( picojson::value ( s_jsonOutput ). serialize ( true ).c_str () );
777+ puts ( s_jsonOutput. PrintJSON ( ).c_str () );
778778 }
779779
780780 return 0 ;
0 commit comments