summaryrefslogtreecommitdiff
path: root/openjpeg
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2017-02-22 08:11:48 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2017-02-22 08:11:48 -0800
commitf8d299c399312fdd41958843a101db36353ad8e2 (patch)
tree3639a3bd2fe7e7dc7e6c0e32ef4323e50f683e83 /openjpeg
parent8e8831a02f172490d7b175e54c7d15814acacea4 (diff)
downloadghostpdl-f8d299c399312fdd41958843a101db36353ad8e2.tar.gz
Avoid getenv call in openjpeg
getenv is not allowed in certain cases causing linking issues. This fix should be pushed to the openjpeg group. Thanks to Chris for the fix.
Diffstat (limited to 'openjpeg')
-rw-r--r--openjpeg/src/lib/openjp2/j2k.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/openjpeg/src/lib/openjp2/j2k.c b/openjpeg/src/lib/openjp2/j2k.c
index 7c0696838..e689213ce 100644
--- a/openjpeg/src/lib/openjp2/j2k.c
+++ b/openjpeg/src/lib/openjp2/j2k.c
@@ -5983,12 +5983,16 @@ OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads)
static int opj_j2k_get_default_thread_count(void)
{
+#if defined(MUTEX_win32) || defined(MUTEX_pthread)
const char* num_threads = getenv("OPJ_NUM_THREADS");
- if( num_threads == NULL || !opj_has_thread_support() )
+ if (num_threads == NULL || !opj_has_thread_support())
return 0;
- if( strcmp(num_threads, "ALL_CPUS") == 0 )
+ if (strcmp(num_threads, "ALL_CPUS") == 0)
return opj_get_num_cpus();
return atoi(num_threads);
+#else
+ return 0;
+#endif
}
/* ----------------------------------------------------------------------- */