mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Portability - Solaris
- Added include of auto.h to allow #ifdef SOLARIS to work. - Put #ifdef around glob arguments that aren't supported on Solaris. - Fixed uninitialized variable that only gcc on Solaris spotted.
This commit is contained in:
parent
75666c56cc
commit
9b80017323
3 changed files with 8 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Directory.h"
|
#include "Directory.h"
|
||||||
|
#include "../auto.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Directory::Directory ()
|
Directory::Directory ()
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "Path.h"
|
#include "Path.h"
|
||||||
|
#include "../auto.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Path::Path ()
|
Path::Path ()
|
||||||
|
@ -201,7 +202,11 @@ std::vector <std::string> Path::glob (const std::string& pattern)
|
||||||
std::vector <std::string> results;
|
std::vector <std::string> results;
|
||||||
|
|
||||||
glob_t g;
|
glob_t g;
|
||||||
|
#ifdef SOLARIS
|
||||||
|
if (!::glob (pattern.c_str (), GLOB_ERR, NULL, &g))
|
||||||
|
#else
|
||||||
if (!::glob (pattern.c_str (), GLOB_ERR | GLOB_BRACE | GLOB_TILDE, NULL, &g))
|
if (!::glob (pattern.c_str (), GLOB_ERR | GLOB_BRACE | GLOB_TILDE, NULL, &g))
|
||||||
|
#endif
|
||||||
for (int i = 0; i < (int) g.gl_pathc; ++i)
|
for (int i = 0; i < (int) g.gl_pathc; ++i)
|
||||||
results.push_back (g.gl_pathv[i]);
|
results.push_back (g.gl_pathv[i]);
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ std::string::size_type find (
|
||||||
|
|
||||||
for (; t <= end - len; ++t)
|
for (; t <= end - len; ++t)
|
||||||
{
|
{
|
||||||
int diff;
|
int diff = 0;
|
||||||
for (size_t i = 0; i < len; ++i)
|
for (size_t i = 0; i < len; ++i)
|
||||||
if ((diff = tolower (t[i]) - tolower (p[i])))
|
if ((diff = tolower (t[i]) - tolower (p[i])))
|
||||||
break;
|
break;
|
||||||
|
@ -546,7 +546,7 @@ std::string::size_type find (
|
||||||
|
|
||||||
for (; t <= end - len; ++t)
|
for (; t <= end - len; ++t)
|
||||||
{
|
{
|
||||||
int diff;
|
int diff = 0;
|
||||||
for (size_t i = 0; i < len; ++i)
|
for (size_t i = 0; i < len; ++i)
|
||||||
if ((diff = tolower (t[i]) - tolower (p[i])))
|
if ((diff = tolower (t[i]) - tolower (p[i])))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue