Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

Commit

Permalink
fix vs compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Apr 28, 2015
1 parent a6e81e3 commit 47dfd76
Show file tree
Hide file tree
Showing 13 changed files with 1,176 additions and 714 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ tests/*.err
tests/big/*.err
tests/big/big_file.txt
the_silver_searcher.spec
vs-premake
!*.vcxproj
!*.sln
dbg/
rel/
*pyc
*.user
*.sdf
*suo
obj/
4 changes: 2 additions & 2 deletions src/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ size_t get_lang_count() {

char *make_lang_regex(char *ext_array, size_t num_exts) {
int regex_capacity = 100;
char *regex = ag_malloc(regex_capacity);
char *regex = (char *)ag_malloc(regex_capacity);
int regex_length = 3;
int subsequent = 0;
char *extension;
Expand All @@ -106,7 +106,7 @@ char *make_lang_regex(char *ext_array, size_t num_exts) {
int extension_length = strlen(extension);
while (regex_length + extension_length + 3 + subsequent > regex_capacity) {
regex_capacity *= 2;
regex = ag_realloc(regex, regex_capacity);
regex = (char *)ag_realloc(regex, regex_capacity);
}
if (subsequent) {
regex[regex_length++] = '|';
Expand Down
6 changes: 3 additions & 3 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void search_buf(const char *buf, const size_t buf_len,
if (opts.search_stream) {
binary = 0;
} else if (!opts.search_binary_files) {
binary = is_binary((const void *)buf, buf_len);
binary = is_binary(buf, buf_len);
if (binary) {
log_debug("File %s is binary. Skipping...", dir_full_path);
return;
Expand Down Expand Up @@ -119,7 +119,7 @@ void search_buf(const char *buf, const size_t buf_len,
/* TODO: copy-pasted from above. FIXME */
if (matches_len + matches_spare >= matches_size) {
matches_size = matches ? matches_size * 2 : 100;
matches = ag_realloc(matches, matches_size * sizeof(match_t));
matches = (match_t*)ag_realloc(matches, matches_size * sizeof(match_t));
log_debug("Too many matches in %s. Reallocating matches to %zu.", dir_full_path, matches_size);
matches = (match_t *)ag_realloc(matches, matches_size * sizeof(match_t));
}
Expand Down Expand Up @@ -149,7 +149,7 @@ void search_buf(const char *buf, const size_t buf_len,

if (matches_len > 0) {
if (binary == -1 && !opts.print_filename_only) {
binary = is_binary((const void *)buf, buf_len);
binary = is_binary(buf, buf_len);
}
pthread_mutex_lock(&print_mtx);
if (opts.print_filename_only) {
Expand Down
2 changes: 1 addition & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void compile_study(pcre **re, pcre_extra **re_extra, char *q, const int pcre_opt
void *decompress(const ag_compression_type zip_type, const void *buf, const int buf_len, const char *dir_full_path, int *new_buf_len);
ag_compression_type is_zipped(const void *buf, const int buf_len);

int is_binary(const void *buf, const size_t buf_len);
int is_binary(const char *buf, const size_t buf_len);
int is_regex(const char *query);
int is_fnmatch(const char *filename);
int binary_search(const char *needle, char **haystack, int start, int end);
Expand Down
104 changes: 52 additions & 52 deletions vs-premake/ag.sln
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ag", "ag.vcxproj", "{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}"
ProjectSection(ProjectDependencies) = postProject
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C} = {5A56CF56-988C-AD4A-9298-B1E7AC90F18C}
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815} = {D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E} = {0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcre", "pcre.vcxproj", "{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread-win32", "pthread-win32.vcxproj", "{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseKjk|Win32 = ReleaseKjk|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}.Debug|Win32.ActiveCfg = Debug|Win32
{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}.Debug|Win32.Build.0 = Debug|Win32
{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}.Release|Win32.ActiveCfg = Release|Win32
{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}.Release|Win32.Build.0 = Release|Win32
{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{AD76505B-9A59-DF4C-9E02-114DAB21FE3D}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}.Debug|Win32.ActiveCfg = Debug|Win32
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}.Debug|Win32.Build.0 = Debug|Win32
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}.Release|Win32.ActiveCfg = Release|Win32
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}.Release|Win32.Build.0 = Release|Win32
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{0A9E14ED-04E5-CF46-9FE7-00CFC89BB49E}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}.Debug|Win32.ActiveCfg = Debug|Win32
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}.Debug|Win32.Build.0 = Debug|Win32
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}.Release|Win32.ActiveCfg = Release|Win32
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}.Release|Win32.Build.0 = Release|Win32
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{5A56CF56-988C-AD4A-9298-B1E7AC90F18C}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}.Debug|Win32.ActiveCfg = Debug|Win32
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}.Debug|Win32.Build.0 = Debug|Win32
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}.Release|Win32.ActiveCfg = Release|Win32
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}.Release|Win32.Build.0 = Release|Win32
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{D341CB55-2EEE-9B41-8CD8-E7C4F3E28815}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ag", "ag.vcxproj", "{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}"
ProjectSection(ProjectDependencies) = postProject
{2E5CDF48-C3C6-7549-8470-75B14362F40F} = {2E5CDF48-C3C6-7549-8470-75B14362F40F}
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD} = {F9D0F471-B5DE-584B-A15D-7BDA985A92AD}
{A0D52E1F-F511-544B-BC39-F8D592E7C924} = {A0D52E1F-F511-544B-BC39-F8D592E7C924}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcre", "pcre.vcxproj", "{A0D52E1F-F511-544B-BC39-F8D592E7C924}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{2E5CDF48-C3C6-7549-8470-75B14362F40F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread-win32", "pthread-win32.vcxproj", "{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseKjk|Win32 = ReleaseKjk|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}.Debug|Win32.ActiveCfg = Debug|Win32
{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}.Debug|Win32.Build.0 = Debug|Win32
{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}.Release|Win32.ActiveCfg = Release|Win32
{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}.Release|Win32.Build.0 = Release|Win32
{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{D05D932F-8C7F-1F44-BFDB-F5985243D8A9}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
{A0D52E1F-F511-544B-BC39-F8D592E7C924}.Debug|Win32.ActiveCfg = Debug|Win32
{A0D52E1F-F511-544B-BC39-F8D592E7C924}.Debug|Win32.Build.0 = Debug|Win32
{A0D52E1F-F511-544B-BC39-F8D592E7C924}.Release|Win32.ActiveCfg = Release|Win32
{A0D52E1F-F511-544B-BC39-F8D592E7C924}.Release|Win32.Build.0 = Release|Win32
{A0D52E1F-F511-544B-BC39-F8D592E7C924}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{A0D52E1F-F511-544B-BC39-F8D592E7C924}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
{2E5CDF48-C3C6-7549-8470-75B14362F40F}.Debug|Win32.ActiveCfg = Debug|Win32
{2E5CDF48-C3C6-7549-8470-75B14362F40F}.Debug|Win32.Build.0 = Debug|Win32
{2E5CDF48-C3C6-7549-8470-75B14362F40F}.Release|Win32.ActiveCfg = Release|Win32
{2E5CDF48-C3C6-7549-8470-75B14362F40F}.Release|Win32.Build.0 = Release|Win32
{2E5CDF48-C3C6-7549-8470-75B14362F40F}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{2E5CDF48-C3C6-7549-8470-75B14362F40F}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}.Debug|Win32.ActiveCfg = Debug|Win32
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}.Debug|Win32.Build.0 = Debug|Win32
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}.Release|Win32.ActiveCfg = Release|Win32
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}.Release|Win32.Build.0 = Release|Win32
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}.ReleaseKjk|Win32.ActiveCfg = ReleaseKjk|Win32
{F9D0F471-B5DE-584B-A15D-7BDA985A92AD}.ReleaseKjk|Win32.Build.0 = ReleaseKjk|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit 47dfd76

Please sign in to comment.