OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return false; | 254 return false; |
255 } | 255 } |
256 | 256 |
257 return true; | 257 return true; |
258 } | 258 } |
259 | 259 |
260 string Subprocess::Win32ErrorMessage(DWORD error_code) { | 260 string Subprocess::Win32ErrorMessage(DWORD error_code) { |
261 char* message; | 261 char* message; |
262 | 262 |
263 // WTF? | 263 // WTF? |
264 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | | 264 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | |
265 FORMAT_MESSAGE_FROM_SYSTEM | | 265 FORMAT_MESSAGE_IGNORE_INSERTS, |
266 FORMAT_MESSAGE_IGNORE_INSERTS, | 266 NULL, error_code, 0, |
267 NULL, error_code, 0, | 267 (LPSTR)&message, // NOT A BUG! |
268 (LPTSTR)&message, // NOT A BUG! | 268 0, NULL); |
269 0, NULL); | |
270 | 269 |
271 string result = message; | 270 string result = message; |
272 LocalFree(message); | 271 LocalFree(message); |
273 return result; | 272 return result; |
274 } | 273 } |
275 | 274 |
276 // =================================================================== | 275 // =================================================================== |
277 | 276 |
278 #else // _WIN32 | 277 #else // _WIN32 |
279 | 278 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 455 } |
457 | 456 |
458 return true; | 457 return true; |
459 } | 458 } |
460 | 459 |
461 #endif // !_WIN32 | 460 #endif // !_WIN32 |
462 | 461 |
463 } // namespace compiler | 462 } // namespace compiler |
464 } // namespace protobuf | 463 } // namespace protobuf |
465 } // namespace google | 464 } // namespace google |
OLD | NEW |