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

Unified Diff: courgette/courgette_tool.cc

Issue 149597: Code changes to get the code to compile under GCC.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/courgette_minimal_tool.cc ('k') | courgette/difference_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/courgette_tool.cc
===================================================================
--- courgette/courgette_tool.cc (revision 21002)
+++ courgette/courgette_tool.cc (working copy)
@@ -45,7 +45,11 @@
}
std::string ReadOrFail(const std::wstring& file_name, const char* kind) {
+#if defined(OS_WIN)
FilePath file_path(file_name);
+#else
+ FilePath file_path(WideToASCII(file_name));
+#endif
std::string buffer;
if (!file_util::ReadFileToString(file_path, &buffer))
Problem("Can't read %s file.", kind);
@@ -54,14 +58,18 @@
void WriteSinkToFile(const courgette::SinkStream *sink,
const std::wstring& output_file) {
+#if defined(OS_WIN)
FilePath output_path(output_file);
+#else
+ FilePath output_path(WideToASCII(output_file));
+#endif
int count =
file_util::WriteFile(output_path,
reinterpret_cast<const char*>(sink->Buffer()),
sink->Length());
if (count == -1)
- Problem("Cant write output.");
- if (count != sink->Length())
+ Problem("Can't write output.");
+ if (static_cast<size_t>(count) != sink->Length())
Problem("Incomplete write.");
}
@@ -330,6 +338,11 @@
WriteSinkToFile(&new_stream, new_file);
}
+bool WideStringToInt(const std::wstring& str, int *output) {
+ string16 copy(str.begin(), str.end());
+ return StringToInt(copy, output);
+}
+
int main(int argc, const char* argv[]) {
base::AtExitManager at_exit_manager;
CommandLine::Init(argc, argv);
@@ -352,7 +365,7 @@
int repeat_count = 1;
std::wstring repeat_switch = command_line.GetSwitchValue(L"repeat");
if (!repeat_switch.empty())
- if (!StringToInt(repeat_switch, &repeat_count))
+ if (!WideStringToInt(repeat_switch, &repeat_count))
repeat_count = 1;
if (cmd_dis + cmd_asm + cmd_disadj + cmd_make_patch + cmd_apply_patch +
Property changes on: courgette/courgette_tool.cc
___________________________________________________________________
Name: svn:eol-style
+ LF
« no previous file with comments | « courgette/courgette_minimal_tool.cc ('k') | courgette/difference_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698