From 28c81e92ccb79920f059b040989f0b03c622c03c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 23 Jul 2012 17:40:07 -0400 Subject: Fix LLMachineID::getUniqueID() LL_DEBUGS log output. getUniqueID() was logging six somewhat random bytes as garbage characters. Change to produce a hex string instead. --- indra/newview/llmachineid.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmachineid.cpp') diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp index 778693876e..82e412d845 100644 --- a/indra/newview/llmachineid.cpp +++ b/indra/newview/llmachineid.cpp @@ -252,7 +252,18 @@ S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) if (has_static_unique_id) { memcpy ( unique_id, &static_unique_id, len); - LL_DEBUGS("AppInit") << "UniqueID: " << unique_id[0] << unique_id[1]<< unique_id[2] << unique_id[3] << unique_id[4] << unique_id [5] << LL_ENDL; + LL_DEBUGS("AppInit") << "UniqueID: 0x"; + // Code between here and LL_ENDL is not executed unless the LL_DEBUGS + // actually produces output + for (size_t i = 0; i < len; ++i) + { + // Copy each char to unsigned int to hexify. Sending an unsigned + // char to a std::ostream tries to represent it as a char, not + // what we want here. + unsigned byte = unique_id[i]; + LL_CONT << std::hex << std::setw(2) << std::setfill('0') << byte; + } + LL_ENDL; return 1; } return 0; -- cgit v1.2.3 From fc8d6384b744805631ae1183c52908f49e2a4765 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 24 Jul 2012 07:55:45 -0400 Subject: In getUniqueID(), don't forget to reset formatting on log stream. Otherwise later log fields start showing up with zero fill, etc. --- indra/newview/llmachineid.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/newview/llmachineid.cpp') diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp index 82e412d845..cd6473921d 100644 --- a/indra/newview/llmachineid.cpp +++ b/indra/newview/llmachineid.cpp @@ -263,12 +263,9 @@ S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) unsigned byte = unique_id[i]; LL_CONT << std::hex << std::setw(2) << std::setfill('0') << byte; } - LL_ENDL; + // Reset default output formatting to avoid nasty surprises! + LL_CONT << std::dec << std::setw(0) << std::setfill(' ') << LL_ENDL; return 1; } return 0; } - - - - -- cgit v1.2.3