Re: [flac-dev] [PATCH] use more windows API in src/share/utf8/utf8.c

2016-02-08 Thread Erik de Castro Lopo
lvqcl wrote:

> src/share/utf8/utf8.c  mentions that "On NT-based windows systems,
> we could use WideCharToMultiByte()/MultiByteToWideChar(CP_UTF8),
> but MS doesn't actually have a consistent API across win32".
> 
> flac/metaflac don't support Win98 since ver. 1.3.0, so it's
> possible to use system routines to convert to/from UTF-8.
> 
> 
> I removed all fprintf(stderr...) code from the win32 code because
> non-windows code in utf8.c doesn't print anything in such cases and
> simply returns an error.

Applied. Thanks.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] remove libFLAC dependency of win_utf8_io

2016-02-08 Thread Erik de Castro Lopo
lvqcl wrote:

> The set of four patches that remove dependency of libFLAC on win_utf8_io.
> 
> Tested only on Windows, with MSVC and MSYS/MinGW (both autotools and 
> makefile.lite)
> 
> Please review, especially makefile patches, I'm not very familiar with them.

Applied. All good. Thanks.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] Fix compilation on OS/2

2016-02-08 Thread Erik de Castro Lopo
Dave Yeo wrote:

> On 01/24/16 12:29 PM, Erik de Castro Lopo wrote:> Dave Yeo wrote:
> > 
> >> After this the build dies with,
> >> util.c: In function 'benchmark_function':
> >> util.c:124:17: error: 'CLOCK_PROCESS_CPUTIME_ID' undeclared (first use
> >> in this function)
> >> clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &start) ;
> >>
> >> Would using gettimeofday() be accurate enough?
> > 
> > AS a fall back yes, but not as replacement on platforms with 
> > clock_gettime().
> > 
> >> Perhaps simpler just to
> >> disable the microbench test on OS/2 as gettimeofday() would require a
> >> configure test and OS/2 is a minor platform?
> > 
> > 
> > I would accept a patch that disables the microsbenchmark on OS/2 I would
> > also accept one that uses gettimeofday() when clock_gettime() is not
> > available.

I'm happy with the first patch (making AVX and AVX2 a configure option) and
I've committed and pushed it to the repo.

The configure stuff in the second seems overly complex. Is something like
this:

 AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
 if test x$have_clock_gettime = xyes; then
 AC_DEFINE(HAVE_CLOCK_GETTIME)
 fi

not sufficient? You can either test this and provide an updated patch or
I can fix it here.

Cheers,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] remove libFLAC dependency of win_utf8_io

2016-02-08 Thread lvqcl
Erik de Castro Lopo wrote:

> lvqcl wrote:
>
>> The set of four patches that remove dependency of libFLAC on win_utf8_io.
>>
>> Tested only on Windows, with MSVC and MSYS/MinGW (both autotools and 
>> makefile.lite)
>>
>> Please review, especially makefile patches, I'm not very familiar with them.
>
> Applied. All good. Thanks.

But the 1st patch ('1_sources.patch' file) was not applied... I suspect
that Windows build is broken now.

Before this set of 4 patches, I posted a patch that tries to prevent unnecessary
inclusion of windows.h -- 'use_winapi_macro.patch' file from
 message.

'1_sources.patch' was made after it, and as a result 'use_winapi_macro.patch'
must be applied before it. If you object to that patch, I can make version of
'1_sources.patch' that is based on the current code.
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] remove libFLAC dependency of win_utf8_io

2016-02-08 Thread Erik de Castro Lopo
lvqcl wrote:

> But the 1st patch ('1_sources.patch' file) was not applied...

When I tried apply that patch, all but one hunk succeeded. I inspected
the rejected part, but that seemed to have already been applied.

> Before this set of 4 patches, I posted a patch that tries to prevent 
> unnecessary
> inclusion of windows.h -- 'use_winapi_macro.patch' file from
>  message.

That is that not this commit?

commit a5c8e8e14de182c4e8c5a8cd0b6be7c75ab6f021
Author: Erik de Castro Lopo 
Date:   Thu Feb 4 13:42:33 2016 +1100

src/share/utf8/utf8.c: Windows API usage fixes

Patch-from: 

> '1_sources.patch' was made after it, and as a result 'use_winapi_macro.patch'
> must be applied before it. If you object to that patch, I can make version of
> '1_sources.patch' that is based on the current code.

Lets just get a patch that fixes what we have now.

Cheers,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] remove libFLAC dependency of win_utf8_io

2016-02-08 Thread lvqcl

Erik de Castro Lopo wrote:


When I tried apply that patch, all but one hunk succeeded. I inspected
the rejected part, but that seemed to have already been applied.


'1_sources.patch' creates windows_unicode_filenames.h and
windows_unicode_filenames.c files that don't exist in the current git.


Lets just get a patch that fixes what we have now.


Here it is: the missing parts of d40a6bc commit are in the
attached fix_d40a6bc_commit.patch




Also an (optional) use_winapi_macro.patch from

was re-made and attached.

fix_d40a6bc_commit.patch
Description: Binary data


use_winapi_macro.patch
Description: Binary data
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] remove libFLAC dependency of win_utf8_io

2016-02-08 Thread Erik de Castro Lopo
lvqcl wrote:

> '1_sources.patch' creates windows_unicode_filenames.h and
> windows_unicode_filenames.c files that don't exist in the current git.

I already had a commit to add those two files and fix the `make distcheck`
target.

> > Lets just get a patch that fixes what we have now.
> 
> Here it is: the missing parts of d40a6bc commit are in the
> attached fix_d40a6bc_commit.patch

Applied, minus the already applied windows_unicode_filename.* bits.

Thanks,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


Re: [flac-dev] [PATCH] Fix compilation on OS/2

2016-02-08 Thread Dave Yeo

On 02/08/16 03:25 AM, Erik de Castro Lopo wrote:

The configure stuff in the second seems overly complex. Is something like
this:

  AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  if test x$have_clock_gettime = xyes; then
  AC_DEFINE(HAVE_CLOCK_GETTIME)
  fi

not sufficient? You can either test this and provide an updated patch or
I can fix it here.


Yes, much simpler and works fine.
Thanks
Dave
From 6fe1a1c2a254e212227a208d241c9328469176c4 Mon Sep 17 00:00:00 2001
From: Dave Yeo 
Date: Tue, 2 Feb 2016 20:19:59 -0800
Subject: [PATCH] Use gettimeofday() for benchmarking

Some operating systems such as OS/2 don't have any of the CLOCK* API implemented

Signed-off-by: Dave Yeo 
---
 configure.ac  |  5 +
 microbench/util.c | 38 +-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 915869b..b577248 100644
--- a/configure.ac
+++ b/configure.ac
@@ -371,6 +371,11 @@ AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
 AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
 fi
 
+AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
+if test x$have_clock_gettime = xyes; then
+AC_DEFINE(HAVE_CLOCK_GETTIME)
+fi
+
 # only matters for x86
 AC_CHECK_PROGS(NASM, nasm)
 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
diff --git a/microbench/util.c b/microbench/util.c
index ff1c3fb..dbd4bc1 100644
--- a/microbench/util.c
+++ b/microbench/util.c
@@ -95,7 +95,7 @@ benchmark_function (void (*testfunc) (void), unsigned count)
 	return counter_diff (&start, &end) / count ;
 } /* benchmark_function */
 
-#else
+#elif defined HAVE_CLOCK_GETTIME
 
 #include 
 #include 
@@ -131,6 +131,42 @@ benchmark_function (void (*testfunc) (void), unsigned count)
 	return timespec_diff (&start, &end) / count ;
 } /* benchmark_function */
 
+#else
+
+#include 
+#include 
+
+static double
+timeval_diff (const struct timeval * start, const struct timeval * end)
+{   struct timeval diff;
+
+if (end->tv_usec - start->tv_usec < 0)
+{   diff.tv_sec = end->tv_sec - start->tv_sec - 1 ;
+diff.tv_usec = 100 + end->tv_usec - start->tv_usec ;
+}
+else
+{   diff.tv_sec = end->tv_sec - start->tv_sec ;
+diff.tv_usec = end->tv_usec-start->tv_usec ;
+} ;
+
+return diff.tv_sec + 1e-6 * diff.tv_usec ;
+}
+
+double
+benchmark_function (void (*testfunc) (void), unsigned count)
+{	struct timeval start, end;
+	unsigned k ;
+
+	gettimeofday(&start, NULL);
+
+	for (k = 0 ; k < count ; k++)
+		testfunc () ;
+
+	gettimeofday(&end, NULL);
+
+	return timeval_diff (&start, &end) / count ;
+} /* benchmark_function */
+
 #endif
 
 static int
-- 
2.0.0

___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev