From 392232246e9ea7539d331299a518ef63bab22483 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Tue, 28 Feb 2012 21:20:09 +0530 Subject: [PATCH] Fixed compilation on Linux with some minor changes. --- builtin_jobs.cpp | 2 +- common.cpp | 8 +++++++- parser.cpp | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/builtin_jobs.cpp b/builtin_jobs.cpp index 86e4b0768..957b54c66 100644 --- a/builtin_jobs.cpp +++ b/builtin_jobs.cpp @@ -43,7 +43,7 @@ enum /** Calculates the cpu usage (in percent) of the specified job. */ -static int cpu_use( job_t *j ) +static int cpu_use( const job_t *j ) { double u=0; process_t *p; diff --git a/common.cpp b/common.cpp index 95de387b4..f0903261f 100644 --- a/common.cpp +++ b/common.cpp @@ -555,7 +555,13 @@ wchar_t *quote_end( const wchar_t *pos ) wcstring wsetlocale(int category, const wchar_t *locale) { - char *lang = locale?wcs2str( locale ):0; + char *lang = NULL; + if (locale && wcscmp(locale,L"")){ + lang = wcs2str( locale ); + } + { + lang = NULL; + } char * res = setlocale(category,lang); free( lang ); diff --git a/parser.cpp b/parser.cpp index 01dbb627b..a92e026cb 100644 --- a/parser.cpp +++ b/parser.cpp @@ -18,6 +18,7 @@ The fish parser. Contains functions for parsing and evaluating code. #include #include #include +#include #include "fallback.h" #include "util.h" @@ -1244,7 +1245,7 @@ bool parser_t::job_remove( job_t *j ) void parser_t::job_promote(job_t *job) { - job_list_t::iterator loc = find(my_job_list.begin(), my_job_list.end(), job); + job_list_t::iterator loc = std::find(my_job_list.begin(), my_job_list.end(), job); assert(loc != my_job_list.end()); /* Move the job to the beginning */ @@ -2308,7 +2309,7 @@ void parser_t::eval_job( tokenizer *tok ) if( job_start_pos < tok_get_pos( tok ) ) { int stop_pos = tok_get_pos( tok ); - wchar_t *newline = wcschr( tok_string(tok)+start_pos, + const wchar_t *newline = wcschr( tok_string(tok)+start_pos, L'\n' ); if( newline ) stop_pos = mini( stop_pos, newline - tok_string(tok) );