void-packages/srcpkgs/Haru/patches/unitialized-ptr_error.patch
Đoàn Trần Công Danh ec4c2d75fa srcpkgs/[A-Z]*: 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

55 lines
1.9 KiB
Diff

From d2fd3a47686fe8f1c1263d5d8190b2ceb2f4327e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Viktor=20Szak=C3=A1ts?= <vszakats@users.noreply.github.com>
Date: Sat, 5 Oct 2013 00:51:03 +0200
Subject: [PATCH 1/4] fixed potentially uninitialized ptr error
also deleted two line ending spaces
---
src/hpdf_image_png.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git src/hpdf_image_png.c src/hpdf_image_png.c
index 3a35f5c..3f20a77 100644
--- a/src/hpdf_image_png.c
+++ b/src/hpdf_image_png.c
@@ -280,8 +280,8 @@ ReadTransparentPngData (HPDF_Dict image,
case PNG_COLOR_TYPE_RGB_ALPHA:
row_len = 3 * width * sizeof(png_byte);
for (j = 0; j < height; j++) {
+ row = row_ptr[j];
for (i = 0; i < width; i++) {
- row = row_ptr[j];
memmove(row + (3 * i), row + (4*i), 3);
smask_data[width * j + i] = row[4 * i + 3];
}
@@ -295,8 +295,8 @@ ReadTransparentPngData (HPDF_Dict image,
case PNG_COLOR_TYPE_GRAY_ALPHA:
row_len = width * sizeof(png_byte);
for (j = 0; j < height; j++) {
+ row = row_ptr[j];
for (i = 0; i < width; i++) {
- row = row_ptr[j];
row[i] = row[2 * i];
smask_data[width * j + i] = row[2 * i + 1];
}
@@ -474,7 +474,7 @@ LoadPngData (HPDF_Dict image,
HPDF_Dict smask;
png_bytep smask_data;
- if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
+ if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
!png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) {
goto no_transparent_color_in_palette;
}
@@ -534,7 +534,7 @@ LoadPngData (HPDF_Dict image,
no_transparent_color_in_palette:
- /* read images with alpha channel right away
+ /* read images with alpha channel right away
we have to do this because image transparent mask must be added to the Xref */
if (xref && PNG_COLOR_MASK_ALPHA & color_type) {
HPDF_Dict smask;
--
2.24.0