Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/platform-win32.cc

Issue 177413006: Fix VPrintHelper used on Windows. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) != FILE_TYPE_UNKNOWN) 655 GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) != FILE_TYPE_UNKNOWN)
656 output_mode = CONSOLE; 656 output_mode = CONSOLE;
657 else 657 else
658 output_mode = ODS; 658 output_mode = ODS;
659 } 659 }
660 return output_mode == CONSOLE; 660 return output_mode == CONSOLE;
661 } 661 }
662 662
663 663
664 static void VPrintHelper(FILE* stream, const char* format, va_list args) { 664 static void VPrintHelper(FILE* stream, const char* format, va_list args) {
665 if (HasConsole()) { 665 if ((stream == stdout || stream == stderr) && !HasConsole()) {
666 vfprintf(stream, format, args);
667 } else {
668 // It is important to use safe print here in order to avoid 666 // It is important to use safe print here in order to avoid
669 // overflowing the buffer. We might truncate the output, but this 667 // overflowing the buffer. We might truncate the output, but this
670 // does not crash. 668 // does not crash.
671 EmbeddedVector<char, 4096> buffer; 669 EmbeddedVector<char, 4096> buffer;
672 OS::VSNPrintF(buffer, format, args); 670 OS::VSNPrintF(buffer, format, args);
673 OutputDebugStringA(buffer.start()); 671 OutputDebugStringA(buffer.start());
672 } else {
673 vfprintf(stream, format, args);
674 } 674 }
675 } 675 }
676 676
677 677
678 FILE* OS::FOpen(const char* path, const char* mode) { 678 FILE* OS::FOpen(const char* path, const char* mode) {
679 FILE* result; 679 FILE* result;
680 if (fopen_s(&result, path, mode) == 0) { 680 if (fopen_s(&result, path, mode) == 0) {
681 return result; 681 return result;
682 } else { 682 } else {
683 return NULL; 683 return NULL;
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 ASSERT(result); 1505 ASSERT(result);
1506 } 1506 }
1507 1507
1508 1508
1509 1509
1510 void Thread::YieldCPU() { 1510 void Thread::YieldCPU() {
1511 Sleep(0); 1511 Sleep(0);
1512 } 1512 }
1513 1513
1514 } } // namespace v8::internal 1514 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698