void-packages/srcpkgs/libuninum/patches/fix-unicode.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```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

37 lines
1.3 KiB
Diff

--- a/uninum.c
+++ b/uninum.c
@@ -35,11 +35,11 @@
*/
-#define ucslen(x) wcslen((signed long *) x)
-#define ucscpy(x,y) (UTF32 *)wcscpy((signed long *)x,(signed long *)y)
-#define ucscat(x,y) (UTF32 *)wcscat((signed long *)x,(signed long *)y)
-#define ucschr(x,y) (UTF32 *)wcschr((signed long *)x,(signed long)y)
-#define ucsrchr(x,y) (UTF32 *)wcsrchr((signed long *)x,(signed long)y)
+#define ucslen(x) wcslen((wchar_t *) x)
+#define ucscpy(x,y) (UTF32 *)wcscpy((wchar_t *)x,(wchar_t *)y)
+#define ucscat(x,y) (UTF32 *)wcscat((wchar_t *)x,(wchar_t *)y)
+#define ucschr(x,y) (UTF32 *)wcschr((wchar_t *)x,(wchar_t)y)
+#define ucsrchr(x,y) (UTF32 *)wcsrchr((wchar_t *)x,(wchar_t)y)
#define UNINUM
--- a/unicode.h
+++ b/unicode.h
@@ -1,8 +1,10 @@
-typedef unsigned long UTF32; /* at least 32 bits */
-typedef unsigned short UTF16; /* at least 16 bits */
-typedef unsigned short UCS2; /* at least 16 bits */
-typedef unsigned char UTF8; /* 8 bits */
-typedef unsigned char Boolean; /* 0 or 1 */
+#include <stdint.h>
+
+typedef uint32_t UTF32; /* 32 bits */
+typedef uint16_t UTF16; /* 16 bits */
+typedef uint16_t UCS2; /* 16 bits */
+typedef uint8_t UTF8; /* 8 bits */
+typedef uint8_t Boolean; /* 0 or 1 */
#define UNI_MAX_ASCII (UTF32)0x0000007F
#define UNI_MAX_BMP (UTF32)0x0000FFFF