Bladeren bron

minor changes to comment format

David Rose 22 jaren geleden
bovenliggende
commit
aa2182d806
1 gewijzigde bestanden met toevoegingen van 10 en 4 verwijderingen
  1. 10 4
      panda/src/express/windowsRegistry.cxx

+ 10 - 4
panda/src/express/windowsRegistry.cxx

@@ -54,7 +54,8 @@ set_string_value(const string &key, const string &name, const string &value) {
                         NULL, NULL);
                         NULL, NULL);
   if (mb_result_len == 0) {
   if (mb_result_len == 0) {
     express_cat.error()
     express_cat.error()
-      << "Unable to convert " << value << " from Unicode to MultiByte form.\n";
+      << "Unable to convert '" << value
+      << "' from Unicode to MultiByte form.\n";
     return false;
     return false;
   }
   }
 
 
@@ -139,17 +140,22 @@ get_string_value(const string &key, const string &name,
 
 
   // Now we have to decode the MultiByte string to Unicode, and re-encode
   // Now we have to decode the MultiByte string to Unicode, and re-encode
   // it according to our own encoding.
   // it according to our own encoding.
-  
+
+  if (data.empty()) {
+    return data;
+  }
+
   int wide_result_len =
   int wide_result_len =
     MultiByteToWideChar(CP_ACP, 0,
     MultiByteToWideChar(CP_ACP, 0,
                         data.data(), data.length(),
                         data.data(), data.length(),
                         NULL, 0);
                         NULL, 0);
   if (wide_result_len == 0) {
   if (wide_result_len == 0) {
     express_cat.error()
     express_cat.error()
-      << "Unable to convert " << data << " from MultiByte to Unicode form.\n";
+      << "Unable to convert '" << data 
+      << "' from MultiByte to Unicode form.\n";
     return data;
     return data;
   }
   }
-
+    
   wchar_t *wide_result = (wchar_t *)alloca(wide_result_len * sizeof(wchar_t));
   wchar_t *wide_result = (wchar_t *)alloca(wide_result_len * sizeof(wchar_t));
   MultiByteToWideChar(CP_ACP, 0,
   MultiByteToWideChar(CP_ACP, 0,
                       data.data(), data.length(),
                       data.data(), data.length(),