diff options
author | 2012-08-04 11:07:42 -0700 | |
---|---|---|
committer | 2012-08-04 11:34:45 -0700 | |
commit | b904aa78e854b55414a5f6ea0a995fe9a852ee99 (patch) | |
tree | 9c0a2c408ef2c0fccd56ffd3a7bc0cbd01d48d29 /expand.cpp | |
parent | 8185bee4b83ce94f098cd07a360a0d78ad781c78 (diff) |
Additional warning cleanup and switching from int to size_t where appropriate
Diffstat (limited to 'expand.cpp')
-rw-r--r-- | expand.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -266,7 +266,7 @@ static int iswnumeric( const wchar_t *n ) static bool match_pid( const wcstring &cmd, const wchar_t *proc, int flags, - int *offset) + size_t *offset) { /* Test for a direct match. If the proc string is empty (e.g. the user tries to complete against %), then return an offset pointing at the base command. That ensures that you don't see a bunch of dumb paths when completing against all processes. */ if( proc[0] != L'\0' && wcsncmp( cmd.c_str(), proc, wcslen( proc ) ) == 0 ) @@ -489,7 +489,7 @@ bool process_iterator_t::next_process(wcstring *out_str, pid_t *out_pid) continue; /* remember the pid */ - pid = (long)wcstol(name.c_str(), NULL, 10); + pid = fish_wcstoi(name.c_str(), NULL, 10); /* the 'cmdline' file exists, it should contain the commandline */ FILE *cmdfile; @@ -604,7 +604,7 @@ static int find_process( const wchar_t *proc, wchar_t *end; errno = 0; - jid = wcstol( proc, &end, 10 ); + jid = fish_wcstoi( proc, &end, 10 ); if( jid > 0 && !errno && !*end ) { j = job_get( jid ); @@ -624,11 +624,11 @@ static int find_process( const wchar_t *proc, job_iterator_t jobs; while ((j = jobs.next())) { - int offset; if( j->command_is_empty() ) continue; - + + size_t offset; if( match_pid( j->command(), proc, flags, &offset ) ) { if( flags & ACCEPT_INCOMPLETE ) @@ -659,11 +659,10 @@ static int find_process( const wchar_t *proc, continue; for( p=j->first_process; p; p=p->next ) { - int offset; - if( p->actual_cmd.empty() ) continue; - + + size_t offset; if( match_pid( p->actual_cmd, proc, flags, &offset ) ) { if( flags & ACCEPT_INCOMPLETE ) @@ -696,8 +695,7 @@ static int find_process( const wchar_t *proc, process_iterator_t iterator; while (iterator.next_process(&process_name, &process_pid)) { - int offset; - + size_t offset; if( match_pid( process_name, proc, flags, &offset ) ) { if( flags & ACCEPT_INCOMPLETE ) |