cxong/tinydir — pull request #12 by wjwwood (2014-04-22 07:10:02+00:00)
Title: Fixup osx 10 9

I found a few problems when compiling on OS X 10.9.

The first problem was that clang did not understand `-freg-struct-return`, so I removed that option in the case of `APPLE` in the `CMakeLists.txt` in the samples folder. I'm not sure why this is in the definitions to begin with, any insight on that? It seems to work just fine without it, at least on my machine.

I also added the `build` exclusion in the `.gitignore` file in the samples directory.

Finally, I had a few warnings escalated to errors related to comparing `int`'s to `size_t` types:

```
% make
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/william/devel/tinydir/samples/build
[ 33%] Building C object CMakeFiles/interactive_sample.dir/interactive_sample.c.o
/Users/william/devel/tinydir/samples/interactive_sample.c:17:17: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
for (i = 0; i < dir.n_files; i++)
~ ^ ~~~~~~~~~~~
/Users/william/devel/tinydir/samples/interactive_sample.c:46:30: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (choice >= 0 && choice < dir.n_files)
~~~~~~ ^ ~~~~~~~~~~~
2 errors generated.
make[2]: *** [CMakeFiles/interactive_sample.dir/interactive_sample.c.o] Error 1
make[1]: *** [CMakeFiles/interactive_sample.dir/all] Error 2
make: *** [all] Error 2
```

Then, this:

```
% make
Scanning dependencies of target interactive_sample
[ 33%] Building C object CMakeFiles/interactive_sample.dir/interactive_sample.c.o
Linking C executable interactive_sample
[ 33%] Built target interactive_sample
[ 66%] Building C object CMakeFiles/iterate_sample.dir/iterate_sample.c.o
Linking C executable iterate_sample
[ 66%] Built target iterate_sample
Scanning dependencies of target random_access_sample
[100%] Building C object CMakeFiles/random_access_sample.dir/random_access_sample.c.o
/Users/william/devel/tinydir/samples/random_access_sample.c:14:16: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long')
[-Werror,-Wsign-compare]
for (i = 0; i < dir.n_files; i++)
~ ^ ~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/random_access_sample.dir/random_access_sample.c.o] Error 1
make[1]: *** [CMakeFiles/random_access_sample.dir/all] Error 2
make: *** [all] Error 2
```

I was able to fix up those errors pretty quickly though.

Nice little library, thanks!