|
发表于 2004-4-14 10:52:13
|
显示全部楼层
to puzzlebird:
你的这个patch不太规范,在执行diff时没有用-u参数加上修改代码的上下文,再加上你贴到直接贴到论坛里的网页上,许多对齐的空格和tab在html里都消失了,这让我费了不少工夫手工把他们patch到源代码里。我一般用 diff -uNr 来生成代码的patch,下面是我手工patch之后的结果,请 puzzlebird 看看是不是这个效果:
- diff -uNr fcitx-2.0.1/IMdkit/lib/IMConn.c fcitx-2.0.1-osx/IMdkit/lib/IMConn.c
- --- fcitx-2.0.1/IMdkit/lib/IMConn.c 2003-12-29 09:10:25.000000000 +0800
- +++ fcitx-2.0.1-osx/IMdkit/lib/IMConn.c 2004-04-14 10:28:26.000000000 +0800
- @@ -30,7 +30,7 @@
- ******************************************************************/
-
- #include <X11/Xlib.h>
- -#include <malloc.h>
- +#include <sys/malloc.h>
- #include <string.h>
- #include "IMdkit.h"
- #include <stdarg.h>
- diff -uNr fcitx-2.0.1/MyErrorsHandlers.c fcitx-2.0.1-osx/MyErrorsHandlers.c
- --- fcitx-2.0.1/MyErrorsHandlers.c 2004-01-07 11:29:34.000000000 +0800
- +++ fcitx-2.0.1-osx/MyErrorsHandlers.c 2004-04-14 10:33:08.000000000 +0800
- @@ -3,11 +3,13 @@
- #include <stdio.h>
- #include <signal.h>
- #include <stdlib.h>
- -#include <wait.h>
- +#include <sys/wait.h>
-
- #include "wbx.h"
- #include "py.h"
-
- +#define SIGUNUSED 32
- +
- XErrorHandler oldXErrorHandler;
-
- extern BYTE iWBChanged;
- diff -uNr fcitx-2.0.1/py.c fcitx-2.0.1-osx/py.c
- --- fcitx-2.0.1/py.c 2004-01-08 17:45:51.000000000 +0800
- +++ fcitx-2.0.1-osx/py.c 2004-04-14 10:42:57.000000000 +0800
- @@ -89,11 +89,22 @@
- extern int iCurrentLegendCandPage;
- extern Bool bDisablePagingInLegend;
-
- +
- +/* function to reverse byte order for integer
- +this is required for Mac machine */
- +int ReverseInt(unsigned int pc_int)
- +{
- + int mac_int = pc_int;
- + unsigned char * p = (unsigned char*) &pc_int;
- + mac_int = (p[3] << 24) + (p[2] << 16) + (p[1] << 8) + p[0];
- + return mac_int;
- +}
- +
- Bool LoadPYBaseDict (void)
- {
- FILE *fp;
- char strPath[PATH_MAX];
- - int i, j, iLen;
- + unsigned int i, j, iLen;
-
- if (bRunLocal) {
- strcpy (strPath, (char *) getenv ("HOME"));
- @@ -107,6 +118,7 @@
- return False;
-
- fread (&iPYFACount, sizeof (int), 1, fp);
- + iPYFACount = ReverseInt(iPYFACount);
- PYFAList = (PYFA *) malloc (sizeof (PYFA) * iPYFACount);
- if (!PYFAList)
- return False;
- @@ -115,11 +127,13 @@
- fread (PYFAList[i].strMap, sizeof (char) * 2, 1, fp);
- PYFAList[i].strMap[2] = '\0';
- fread (&(PYFAList[i].iBase), sizeof (int), 1, fp);
- + PYFAList[i].iBase = ReverseInt(PYFAList[i].iBase);
- PYFAList[i].pyBase = (PyBase *) malloc (sizeof (PyBase) * PYFAList[i].iBase);
- for (j = 0; j < PYFAList[i].iBase; j++) {
- fread (PYFAList[i].pyBase[j].strHZ, sizeof (char) * 2, 1, fp);
- PYFAList[i].pyBase[j].strHZ[2] = '\0';
- fread (&iLen, sizeof (int), 1, fp);
- + iLen = ReverseInt(iLen);
- PYFAList[i].pyBase[j].iIndex = iLen;
- PYFAList[i].pyBase[j].iHit = 0;
- PYFAList[i].pyBase[j].flag = 0;
- @@ -169,12 +183,13 @@
- while (!feof (fp)) {
- if (!fread (&i, sizeof (int), 1, fp))
- break;
- + i = ReverseInt(i);
- if (!fread (strBase, sizeof (char) * 2, 1, fp))
- break;
- strBase[2] = '\0';
- if (!fread (&k, sizeof (int), 1, fp))
- break;
- -
- + k = ReverseInt(k);
- j = GetBaseIndex (i, strBase);
-
- PYFAList[i].pyBase[j].iPhrase = k;
- diff -uNr fcitx-2.0.1/ui.c fcitx-2.0.1-osx/ui.c
- --- fcitx-2.0.1/ui.c 2004-01-04 15:42:01.000000000 +0800
- +++ fcitx-2.0.1-osx/ui.c 2004-04-14 10:41:21.000000000 +0800
- @@ -5,7 +5,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- -#include <malloc.h>
- +#include <sys/malloc.h>
- #include <iconv.h>
-
- #ifdef _USE_XFT
复制代码
我把它贴出来是因为其中有问题我不太确定:i = ReverseInt(i);和 reverse k 的这两行按照你的patch里的行号似乎就是在这里,但我对他们的位置很迷惑,他们真的是在这里吗? |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|