aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-06-14 11:27:25 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-06-14 11:27:25 +0200
commit8b3562280dfa5c1df8e3768287fdd9d3a226f4ea (patch)
tree56df1c84b05b1328b6032faaa93a010f437b921b
parent8d93e692ee21fe73be586df912e2e77d20c34c93 (diff)
downloadosc.lv2-8b3562280dfa5c1df8e3768287fdd9d3a226f4ea.tar.xz
ignore missing fnmatch.h on mingw.
-rw-r--r--VERSION2
-rw-r--r--osc.lv2/util.h16
-rw-r--r--test/osc_test.c4
3 files changed, 15 insertions, 7 deletions
diff --git a/VERSION b/VERSION
index 5076ee8..74799d8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.125
+0.1.127
diff --git a/osc.lv2/util.h b/osc.lv2/util.h
index ec4cf00..8c35333 100644
--- a/osc.lv2/util.h
+++ b/osc.lv2/util.h
@@ -73,9 +73,10 @@ static const char valid_format_chars [] = {
static bool
lv2_osc_pattern_match(const char *from, const char *name, size_t len)
{
+#if !defined(_WIN32)
size_t nbrace = 0;
-#if defined(FNM_EXTMATCH)
+# if defined(FNM_EXTMATCH)
// count opening curly braces
for(size_t i = 0; i < len; i++)
{
@@ -84,7 +85,7 @@ lv2_osc_pattern_match(const char *from, const char *name, size_t len)
nbrace++;
}
}
-#endif
+# endif
// allocate temporary pattern buffer
char *pattern = alloca(len + nbrace + 1);
@@ -94,7 +95,7 @@ lv2_osc_pattern_match(const char *from, const char *name, size_t len)
return false;
}
-#if defined(FNM_EXTMATCH)
+# if defined(FNM_EXTMATCH)
// convert {x,y} to @(x|y) for extended fnmatch
if(nbrace)
{
@@ -125,7 +126,7 @@ lv2_osc_pattern_match(const char *from, const char *name, size_t len)
}
}
else
-#endif
+# endif
{
memcpy(pattern, from, len);
}
@@ -133,10 +134,13 @@ lv2_osc_pattern_match(const char *from, const char *name, size_t len)
// terminate pattern string with null terminator
pattern[len + nbrace] = '\0';
-#if defined(FNM_EXTMATCH)
+# if defined(FNM_EXTMATCH)
return fnmatch(pattern, name, FNM_NOESCAPE | FNM_EXTMATCH) == 0 ? true : false;
-#else
+# else
return fnmatch(pattern, name, FNM_NOESCAPE) == 0 ? true : false;
+# endif
+#else
+ return strncmp(from, name, len) == 0 ? true : false;
#endif
}
diff --git a/test/osc_test.c b/test/osc_test.c
index c58b2e7..d633368 100644
--- a/test/osc_test.c
+++ b/test/osc_test.c
@@ -931,6 +931,7 @@ static const pair_t pairs [] = {
};
#endif
+#if !defined(_WIN32)
static void
_one(const char *path, const LV2_Atom_Tuple *arguments __attribute__((unused)),
void *data)
@@ -1211,6 +1212,7 @@ _run_test_hooks()
return 0;
}
+#endif
int
main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
@@ -1222,8 +1224,10 @@ main(int argc __attribute__((unused)), char **argv __attribute__((unused)))
fprintf(stdout, "running main tests:\n");
assert(_run_tests() == 0);
+#if !defined(_WIN32)
fprintf(stdout, "running hook tests:\n");
assert(_run_test_hooks() == 0);
+#endif
#if !defined(_WIN32)
for(const pair_t *pair = pairs; pair->server; pair++)