void-packages/srcpkgs/wineasio/patches/wine-unicode_h.patch
Đoàn Trần Công Danh 04b9978a29 srcpkgs/w*: convert patches to -Np1
* wine is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

59 lines
1.9 KiB
Diff

Source: @pullmoll
Upstream: no
Reason: wine/unicode.h does not exist anymore and also strrchrW()
is not available. Replace the code with a simple linear
scan over the application_path array to find the rightmost
backslash (\) and period (.) for creating the application_name.
--- a/wineasio/asio.c 2013-10-28 15:22:00.000000000 +0100
+++ b/wineasio/asio.c 2021-02-07 21:18:46.741180398 +0100
@@ -24,6 +24,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define _UNICODE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -34,7 +35,6 @@
#include "objbase.h"
#include "mmsystem.h"
#include "winreg.h"
-#include "wine/unicode.h"
#include <jack/jack.h>
#include <jack/thread.h>
@@ -1449,7 +1449,7 @@
{
HKEY hkey;
LONG result, value;
- DWORD type, size;
+ DWORD type, size, pos, backslash, period;
WCHAR application_path [MAX_PATH];
WCHAR *application_name;
char environment_variable[MAX_ENVIRONMENT_SIZE];
@@ -1601,10 +1601,20 @@
/* get client name by stripping path and extension */
GetModuleFileNameW(0, application_path, MAX_PATH);
- application_name = strrchrW(application_path, L'.');
- *application_name = 0;
- application_name = strrchrW(application_path, L'\\');
- application_name++;
+ backslash = 0;
+ period = 0;
+ for (pos = 0; pos < MAX_PATH; pos++) {
+ if (L'\\' == application_path[pos])
+ backslash = pos;
+ if (L'.' == application_path[pos])
+ period = pos;
+ if (0 == application_path[pos])
+ break;
+ }
+ if (period > 0) {
+ application_path[period] = 0;
+ }
+ application_name = backslash ? &application_path[backslash + 1] : application_path;
WideCharToMultiByte(CP_ACP, WC_SEPCHARS, application_name, -1, This->jack_client_name, ASIO_MAX_NAME_LENGTH, NULL, NULL);
RegCloseKey(hkey);