void-packages/srcpkgs/mozc/patches/unsigned-int.patch
Đoàn Trần Công Danh 765e304c4b srcpkgs/m*: 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

210 lines
8.7 KiB
Diff

Index: mozc/src/gui/word_register_dialog/word_register_dialog.cc
===================================================================
--- a/mozc/src/gui/word_register_dialog/word_register_dialog.cc
+++ b/mozc/src/gui/word_register_dialog/word_register_dialog.cc
@@ -94,7 +94,7 @@ QString GetEnv(const char *envname) {
return QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.get()));
} else {
// This is a fallback just in case.
- return QString::fromUcs4(reinterpret_cast<const uint *>(buffer.get()));
+ return QString::fromUcs4(reinterpret_cast<const unsigned *>(buffer.get()));
}
}
return QLatin1String("");
Index: mozc/src/unix/fcitx/surrounding_text_util.cc
===================================================================
--- a/mozc/src/unix/fcitx/surrounding_text_util.cc
+++ b/mozc/src/unix/fcitx/surrounding_text_util.cc
@@ -41,10 +41,10 @@
namespace mozc {
namespace fcitx {
-bool SurroundingTextUtil::GetSafeDelta(uint from, uint to, int32 *delta) {
+bool SurroundingTextUtil::GetSafeDelta(unsigned from, unsigned to, int32 *delta) {
DCHECK(delta);
- static_assert(sizeof(int64) >= sizeof(uint),
+ static_assert(sizeof(int64) >= sizeof(unsigned),
"int64 must be sufficient to store a guint value.");
static_assert(sizeof(int64) == sizeof(llabs(0)),
"|llabs(0)| must returns a 64-bit integer.");
@@ -113,8 +113,8 @@ bool SearchAnchorPosForward(
const std::string &surrounding_text,
const std::string &selected_text,
size_t selected_chars_len,
- uint cursor_pos,
- uint *anchor_pos) {
+ unsigned cursor_pos,
+ unsigned *anchor_pos) {
ConstChar32Iterator iter(surrounding_text);
// Move |iter| to cursor pos.
@@ -137,15 +137,15 @@ bool SearchAnchorPosBackward(
const std::string &surrounding_text,
const std::string &selected_text,
size_t selected_chars_len,
- uint cursor_pos,
- uint *anchor_pos) {
+ unsigned cursor_pos,
+ unsigned *anchor_pos) {
if (cursor_pos < selected_chars_len) {
return false;
}
ConstChar32Iterator iter(surrounding_text);
// Skip |iter| to (potential) anchor pos.
- const uint skip_count = cursor_pos - selected_chars_len;
+ const unsigned skip_count = cursor_pos - selected_chars_len;
DCHECK_LE(skip_count, cursor_pos);
if (!Skip(&iter, skip_count)) {
return false;
@@ -164,8 +164,8 @@ bool SearchAnchorPosBackward(
bool SurroundingTextUtil::GetAnchorPosFromSelection(
const std::string &surrounding_text,
const std::string &selected_text,
- uint cursor_pos,
- uint *anchor_pos) {
+ unsigned cursor_pos,
+ unsigned *anchor_pos) {
DCHECK(anchor_pos);
if (surrounding_text.empty()) {
@@ -196,8 +196,8 @@ bool GetSurroundingText(FcitxInstance* i
return false;
}
- uint cursor_pos = 0;
- uint anchor_pos = 0;
+ unsigned cursor_pos = 0;
+ unsigned anchor_pos = 0;
char* str = NULL;
if (!FcitxInstanceGetSurroundingText(instance, ic, &str, &cursor_pos, &anchor_pos)) {
@@ -211,7 +211,7 @@ bool GetSurroundingText(FcitxInstance* i
const char* primary = NULL;
if ((primary = FcitxClipboardGetPrimarySelection(instance, NULL)) != NULL) {
- uint new_anchor_pos = 0;
+ unsigned new_anchor_pos = 0;
const std::string primary_text(primary);
if (SurroundingTextUtil::GetAnchorPosFromSelection(
surrounding_text, primary_text,
Index: mozc/src/unix/fcitx/surrounding_text_util.h
===================================================================
--- a/mozc/src/unix/fcitx/surrounding_text_util.h
+++ b/mozc/src/unix/fcitx/surrounding_text_util.h
@@ -55,7 +55,7 @@ class SurroundingTextUtil {
// Returns true when neither |abs(delta)| nor |-delta| does not cause
// integer overflow, that is, |delta| is in a safe range.
// Returns false otherwise.
- static bool GetSafeDelta(uint from, uint to, int32 *delta);
+ static bool GetSafeDelta(unsigned from, unsigned to, int32 *delta);
// Returns true if
// 1. |surrounding_text| contains |selected_text|
@@ -71,8 +71,8 @@ class SurroundingTextUtil {
static bool GetAnchorPosFromSelection(
const std::string &surrounding_text,
const std::string &selected_text,
- uint cursor_pos,
- uint *anchor_pos);
+ unsigned cursor_pos,
+ unsigned *anchor_pos);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SurroundingTextUtil);
Index: mozc/src/unix/fcitx5/surrounding_text_util.cc
===================================================================
--- a/mozc/src/unix/fcitx5/surrounding_text_util.cc
+++ b/mozc/src/unix/fcitx5/surrounding_text_util.cc
@@ -43,10 +43,10 @@ namespace fcitx {
using namespace mozc;
-bool SurroundingTextUtil::GetSafeDelta(uint from, uint to, int32 *delta) {
+bool SurroundingTextUtil::GetSafeDelta(unsigned from, unsigned to, int32 *delta) {
DCHECK(delta);
- static_assert(sizeof(int64) >= sizeof(uint),
+ static_assert(sizeof(int64) >= sizeof(unsigned),
"int64 must be sufficient to store a guint value.");
static_assert(sizeof(int64) == sizeof(llabs(0)),
"|llabs(0)| must returns a 64-bit integer.");
@@ -110,8 +110,8 @@ bool StartsWith(ConstChar32Iterator *ite
// Otherwise returns false.
bool SearchAnchorPosForward(const std::string &surrounding_text,
const std::string &selected_text,
- size_t selected_chars_len, uint cursor_pos,
- uint *anchor_pos) {
+ size_t selected_chars_len, unsigned cursor_pos,
+ unsigned *anchor_pos) {
ConstChar32Iterator iter(surrounding_text);
// Move |iter| to cursor pos.
if (!Skip(&iter, cursor_pos)) {
@@ -131,15 +131,15 @@ bool SearchAnchorPosForward(const std::s
// Otherwise returns false.
bool SearchAnchorPosBackward(const std::string &surrounding_text,
const std::string &selected_text,
- size_t selected_chars_len, uint cursor_pos,
- uint *anchor_pos) {
+ size_t selected_chars_len, unsigned cursor_pos,
+ unsigned *anchor_pos) {
if (cursor_pos < selected_chars_len) {
return false;
}
ConstChar32Iterator iter(surrounding_text);
// Skip |iter| to (potential) anchor pos.
- const uint skip_count = cursor_pos - selected_chars_len;
+ const unsigned skip_count = cursor_pos - selected_chars_len;
DCHECK_LE(skip_count, cursor_pos);
if (!Skip(&iter, skip_count)) {
return false;
@@ -157,7 +157,7 @@ bool SearchAnchorPosBackward(const std::
bool SurroundingTextUtil::GetAnchorPosFromSelection(
const std::string &surrounding_text, const std::string &selected_text,
- uint cursor_pos, uint *anchor_pos) {
+ unsigned cursor_pos, unsigned *anchor_pos) {
DCHECK(anchor_pos);
if (surrounding_text.empty()) {
@@ -187,13 +187,13 @@ bool GetSurroundingText(InputContext *ic
}
const auto surrounding_text = ic->surroundingText().text();
- uint cursor_pos = ic->surroundingText().cursor();
- uint anchor_pos = ic->surroundingText().anchor();
+ unsigned cursor_pos = ic->surroundingText().cursor();
+ unsigned anchor_pos = ic->surroundingText().anchor();
if (cursor_pos == anchor_pos && clipboard) {
std::string primary = clipboard->call<IClipboard::primary>(ic);
if (!primary.empty()) {
- uint new_anchor_pos = 0;
+ unsigned new_anchor_pos = 0;
if (SurroundingTextUtil::GetAnchorPosFromSelection(
surrounding_text, primary, cursor_pos, &new_anchor_pos)) {
anchor_pos = new_anchor_pos;
Index: mozc/src/unix/fcitx5/surrounding_text_util.h
===================================================================
--- a/mozc/src/unix/fcitx5/surrounding_text_util.h
+++ b/mozc/src/unix/fcitx5/surrounding_text_util.h
@@ -56,7 +56,7 @@ class SurroundingTextUtil {
// Returns true when neither |abs(delta)| nor |-delta| does not cause
// integer overflow, that is, |delta| is in a safe range.
// Returns false otherwise.
- static bool GetSafeDelta(uint from, uint to, int32 *delta);
+ static bool GetSafeDelta(unsigned from, unsigned to, int32 *delta);
// Returns true if
// 1. |surrounding_text| contains |selected_text|
@@ -71,7 +71,7 @@ class SurroundingTextUtil {
// Otherwise returns false.
static bool GetAnchorPosFromSelection(const std::string &surrounding_text,
const std::string &selected_text,
- uint cursor_pos, uint *anchor_pos);
+ unsigned cursor_pos, unsigned *anchor_pos);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SurroundingTextUtil);