Re: Mod_brotli, C89 & NetWare - finale
G?M There is a downside to fibbing! :-) CC D:\Projects\srcs\brotli-master/enc/static_dict.c ### mwccnlm Compiler: # In: D:\Projects\srcs\brotli-master\include\brotli\types.h #From: D:\Projects\srcs\brotli-master\enc\static_dict.c # - # 18: typedef __int8 int8_t; # Error:^^ # ';' expected But having got a new bone I'll dig further. Norm On 29/11/2016 3:53 AM, Gregg Smith wrote: Hi Norm, Actually, log2 is not needed. It's cmake that forces it on us. Look at fast_log.h line 131 #if (defined(_MSC_VER) && _MSC_VER <= 1700) || \ (defined(__ANDROID_API__) && __ANDROID_API__ < 18) /* Visual Studio 2012 and Android API levels < 18 do not have the log2() * function defined, so we use log() and a multiplication instead. */ return log((double)v) * LOG_2_INV; #else return log2((double)v); #endif You may define _MSC_VER=1 at the command line when compiling and it should work for you. In CMakeList.txt I just remove the check for log2(), lines 96-113, before using. Cheers, G On 11/27/2016 3:38 AM, NormW wrote: G/E, After some head scratching/bashing and research: Brotli.lib has several places that use log2(), which was not defined in C89 (AFAIK), although the function could be kludged easily enough as it uses C89 functions in its own routine. Although NetWare was derived using a C89 compiler, its math.h shows signs of its early development, in that a number of MATHs macro's resolve not to values but to LibC functions, which means they can't be used in 'const' assignments... hence const = INFINITY fails to compile. (It was on the ToDo list it seems but the ship sank before it made the top of the list.) Tweaking math.h while possible, doesn't make for much sense, but mod_brotli does at least compile without issue; well almost. The only C89 issue (AFAICT) is the following patch, which should allow any other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of others. Index: modules/filters/mod_brotli.c === --- modules/filters/mod_brotli.c(revision 1771539) +++ modules/filters/mod_brotli.c(working copy) @@ -240,7 +240,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_transient_create(output, output_len, +b = apr_bucket_transient_create((const char *)output, output_len, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); @@ -289,7 +289,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_heap_create(output, output_len, NULL, +b = apr_bucket_heap_create((const char *)output, output_len, NULL, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); } Norm
Re: Mod_brotli, C89 & NetWare - finale
G/M (mid-morning here) Thanks Evgeny! HIH Norm On 29/11/2016 5:42 AM, Evgeny Kotkov wrote: NormWwrites: The only C89 issue (AFAICT) is the following patch, which should allow any other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of others. Thanks, I committed the patch in https://svn.apache.org/r1771791 Regards, Evgeny Kotkov
Re: Mod_brotli, C89 & NetWare - finale
;-( So much time spent on making a 'workable' log2... Thanks Gregg for the heads up. When I tried a 'fudge' to get past the previously mentioned compiler errors, the linker reported a number of files that required log2, but never looked further into it, assuming it was a requirement. Being a newbie at this stuff the fruit salad in the code below in old days (which I mostly recall) would have had: :-) #ifdef HAVE_LOG2 return log2((double)v); #else return log((double)v) * LOG_2_INV; #endif Can this be done as a macro in a header somewhere and just use LOG2(v) in the code? Thanks again for the info and the much simpler replacement - will have to fire up the CW again! But I doubt there will be an 'encore'. :-) Norm On 29/11/2016 3:53 AM, Gregg Smith wrote: Hi Norm, Actually, log2 is not needed. It's cmake that forces it on us. Look at fast_log.h line 131 #if (defined(_MSC_VER) && _MSC_VER <= 1700) || \ (defined(__ANDROID_API__) && __ANDROID_API__ < 18) /* Visual Studio 2012 and Android API levels < 18 do not have the log2() * function defined, so we use log() and a multiplication instead. */ return log((double)v) * LOG_2_INV; #else return log2((double)v); #endif You may define _MSC_VER=1 at the command line when compiling and it should work for you. In CMakeList.txt I just remove the check for log2(), lines 96-113, before using. Cheers, G On 11/27/2016 3:38 AM, NormW wrote: G/E, After some head scratching/bashing and research: Brotli.lib has several places that use log2(), which was not defined in C89 (AFAIK), although the function could be kludged easily enough as it uses C89 functions in its own routine. Although NetWare was derived using a C89 compiler, its math.h shows signs of its early development, in that a number of MATHs macro's resolve not to values but to LibC functions, which means they can't be used in 'const' assignments... hence const = INFINITY fails to compile. (It was on the ToDo list it seems but the ship sank before it made the top of the list.) Tweaking math.h while possible, doesn't make for much sense, but mod_brotli does at least compile without issue; well almost. The only C89 issue (AFAICT) is the following patch, which should allow any other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of others. Index: modules/filters/mod_brotli.c === --- modules/filters/mod_brotli.c(revision 1771539) +++ modules/filters/mod_brotli.c(working copy) @@ -240,7 +240,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_transient_create(output, output_len, +b = apr_bucket_transient_create((const char *)output, output_len, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); @@ -289,7 +289,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_heap_create(output, output_len, NULL, +b = apr_bucket_heap_create((const char *)output, output_len, NULL, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); } Norm
Re: Mod_brotli, C89 & NetWare - finale
NormWwrites: > The only C89 issue (AFAICT) is the following patch, which should allow any > other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW > can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of > others. Thanks, I committed the patch in https://svn.apache.org/r1771791 Regards, Evgeny Kotkov
Re: Mod_brotli, C89 & NetWare - finale
Hi Norm, Actually, log2 is not needed. It's cmake that forces it on us. Look at fast_log.h line 131 #if (defined(_MSC_VER) && _MSC_VER <= 1700) || \ (defined(__ANDROID_API__) && __ANDROID_API__ < 18) /* Visual Studio 2012 and Android API levels < 18 do not have the log2() * function defined, so we use log() and a multiplication instead. */ return log((double)v) * LOG_2_INV; #else return log2((double)v); #endif You may define _MSC_VER=1 at the command line when compiling and it should work for you. In CMakeList.txt I just remove the check for log2(), lines 96-113, before using. Cheers, G On 11/27/2016 3:38 AM, NormW wrote: G/E, After some head scratching/bashing and research: Brotli.lib has several places that use log2(), which was not defined in C89 (AFAIK), although the function could be kludged easily enough as it uses C89 functions in its own routine. Although NetWare was derived using a C89 compiler, its math.h shows signs of its early development, in that a number of MATHs macro's resolve not to values but to LibC functions, which means they can't be used in 'const' assignments... hence const = INFINITY fails to compile. (It was on the ToDo list it seems but the ship sank before it made the top of the list.) Tweaking math.h while possible, doesn't make for much sense, but mod_brotli does at least compile without issue; well almost. The only C89 issue (AFAICT) is the following patch, which should allow any other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of others. Index: modules/filters/mod_brotli.c === --- modules/filters/mod_brotli.c(revision 1771539) +++ modules/filters/mod_brotli.c(working copy) @@ -240,7 +240,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_transient_create(output, output_len, +b = apr_bucket_transient_create((const char *)output, output_len, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); @@ -289,7 +289,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_heap_create(output, output_len, NULL, +b = apr_bucket_heap_create((const char *)output, output_len, NULL, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); } Norm
Mod_brotli, C89 & NetWare - finale
G/E, After some head scratching/bashing and research: Brotli.lib has several places that use log2(), which was not defined in C89 (AFAIK), although the function could be kludged easily enough as it uses C89 functions in its own routine. Although NetWare was derived using a C89 compiler, its math.h shows signs of its early development, in that a number of MATHs macro's resolve not to values but to LibC functions, which means they can't be used in 'const' assignments... hence const = INFINITY fails to compile. (It was on the ToDo list it seems but the ship sank before it made the top of the list.) Tweaking math.h while possible, doesn't make for much sense, but mod_brotli does at least compile without issue; well almost. The only C89 issue (AFAICT) is the following patch, which should allow any other C89 (with a more up to date OS ;-( ) to compile it, which NetWare's CW can do for the likes of Apache2, Lua, Zlib, NGHTTP2, OSSL and a bunch of others. Index: modules/filters/mod_brotli.c === --- modules/filters/mod_brotli.c(revision 1771539) +++ modules/filters/mod_brotli.c(working copy) @@ -240,7 +240,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_transient_create(output, output_len, +b = apr_bucket_transient_create((const char *)output, output_len, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); @@ -289,7 +289,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_heap_create(output, output_len, NULL, +b = apr_bucket_heap_create((const char *)output, output_len, NULL, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); } Norm Index: modules/filters/mod_brotli.c === --- modules/filters/mod_brotli.c (revision 1771539) +++ modules/filters/mod_brotli.c (working copy) @@ -240,7 +240,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_transient_create(output, output_len, +b = apr_bucket_transient_create((const char *)output, output_len, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); @@ -289,7 +289,7 @@ output = BrotliEncoderTakeOutput(ctx->state, _len); ctx->total_out += output_len; -b = apr_bucket_heap_create(output, output_len, NULL, +b = apr_bucket_heap_create((const char *)output, output_len, NULL, ctx->bb->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->bb, b); }