当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 1 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 给wine打补丁后编译出错,谁看看是什么原因,是wine0.9.53,在7.04上面
帖子发表于 : 2008-01-22 13:38 

注册: 2005-09-12 22:17
帖子: 170
送出感谢: 0 次
接收感谢: 0 次
dib.c: In function `X11DRV_SetDIBitsToDevice':
dib.c:3820: error: `dibpitch' undeclared (first use in this function)
dib.c:3820: error: (Each undeclared identifier is reported only once
dib.c:3820: error: for each function it appears in.)
dib.c:3822: error: `nrsrcbytes' undeclared (first use in this function)
make[3]: *** [dib.o] 错误 1
make[3]: Leaving directory `/home/liuyunfei/wine-0.9.53~winehq0~ubuntu~7.04/dlls/winex11.drv'
make[2]: *** [winex11.drv] 错误 2
make[2]: Leaving directory `/home/liuyunfei/wine-0.9.53~winehq0~ubuntu~7.04/dlls'
make[1]: *** [dlls] 错误 2
make[1]: Leaving directory `/home/liuyunfei/wine-0.9.53~winehq0~ubuntu~7.04'
make: *** [build-stamp] 错误 2


补丁是
--- wine-20050111/dlls/gdi/freetype.c 2005-01-06 01:12:07.000000000 +0800
+++ wine-20050111.gbhack/dlls/gdi/freetype.c 2005-01-15 18:30:32.481788272 +0800
@@ -1677,7 +1677,22 @@
if(!strcmpiW(lf.lfFaceName, SymbolW))
lf.lfCharSet = SYMBOL_CHARSET;

- if(!TranslateCharsetInfo((DWORD*)(INT)lf.lfCharSet, &csi, TCI_SRCCHARSET)) {
+ if( lf.lfCharSet == DEFAULT_CHARSET || lf.lfCharSet == ANSI_CHARSET)
+ {
+ int codepage = 936; /* I'm Chinese. Let me do something selfish. */
+ char *env_wdc = getenv("WINE_DEFAULT_CODEPAGE");
+ if (env_wdc != NULL)
+ {
+ codepage = atoi(env_wdc);
+ }
+ FIXME("Dirty hack. Default and ansi charset is translated to getenv(\"WINE_DEFAULT_CODEPAGE\")\n");
+ if(!TranslateCharsetInfo((DWORD*)(INT)codepage, &csi, TCI_SRCCODEPAGE)) {
+ FIXME("OMG. Even this dirty hack doesn't work. Let's PRAY.\n");
+ csi.fs.fsCsb[0] = 0;
+ }
+ lf.lfCharSet = csi.ciCharset;
+ }
+ else if(!TranslateCharsetInfo((DWORD*)(INT)lf.lfCharSet, &csi, TCI_SRCCHARSET)) {
switch(lf.lfCharSet) {
case DEFAULT_CHARSET:
csi.fs.fsCsb[0] = 0;
@@ -1861,6 +1876,10 @@
width = face->size.x_ppem >> 6;
height = face->size.y_ppem >> 6;
}
+
+ if (0 <= height && height <12) height =12;
+ else if ( 0 > height && height > -12) height = -12;
+
ret->ft_face = OpenFontFile(ret, face->file, face->face_index, width, height);

if (!ret->ft_face)



-------------- next part --------------
--- wine/dlls/x11drv/dib.c 2006-03-03 15:48:11.000000000 +0100
+++ mywine/dlls/x11drv/dib.c 2006-04-12 10:14:05.000000000 +0200
@@ -3817,6 +3817,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDE
LONG width, height;
BOOL top_down;
POINT pt;
+ int nrsrcbytes, dibpitch;

if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
&descr.infoBpp, &descr.compression ) == -1)
@@ -3864,6 +3865,16 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDE
if (xSrc + cx >= width) cx = width - xSrc;
if (!cx || !cy) return lines;

+ /* pointer check */
+ dibpitch = ((width * descr.infoBpp + 31) &~31) / 8;
+ if( descr.compression)
+ nrsrcbytes = 1;
+ else {
+ nrsrcbytes = lines * dibpitch;
+ if( nrsrcbytes < 0) nrsrcbytes = - nrsrcbytes;
+ }
+ if( IsBadReadPtr( bits, nrsrcbytes)) return 0;
+
/* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);

@@ -3916,7 +3927,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDE
descr.width = cx;
descr.height = cy;
descr.useShm = FALSE;
- descr.dibpitch = ((width * descr.infoBpp + 31) &~31) / 8;
+ descr.dibpitch = dibpitch;

result = X11DRV_DIB_SetImageBits( &descr );

@@ -3940,6 +3951,7 @@ INT X11DRV_SetDIBits( X11DRV_PDEVICE *ph
BITMAP bitmap;
LONG width, height, tmpheight;
INT result;
+ int nrsrcbytes, dibpitch;

descr.physDev = physDev;

@@ -3958,6 +3970,16 @@ INT X11DRV_SetDIBits( X11DRV_PDEVICE *ph

if (startscan + lines > height) lines = height - startscan;

+ /* pointer check */
+ dibpitch = ((width * descr.infoBpp + 31) &~31) / 8;
+ if( descr.compression)
+ nrsrcbytes = 1;
+ else {
+ nrsrcbytes = lines * dibpitch;
+ if( nrsrcbytes < 0) nrsrcbytes = - nrsrcbytes;
+ }
+ if( IsBadReadPtr( bits, nrsrcbytes)) return 0;
+
switch (descr.infoBpp)
{
case 1:
@@ -4004,7 +4026,7 @@ INT X11DRV_SetDIBits( X11DRV_PDEVICE *ph
descr.width = bitmap.bmWidth;
descr.height = lines;
descr.useShm = FALSE;
- descr.dibpitch = ((descr.infoWidth * descr.infoBpp + 31) &~31) / 8;
+ descr.dibpitch = dibpitch;
X11DRV_DIB_Lock( physBitmap, DIB_Status_GdiMod, FALSE );
result = X11DRV_DIB_SetImageBits( &descr );
X11DRV_DIB_Unlock( physBitmap, TRUE );
--- wine/dlls/gdi/tests/bitmap.c 2006-04-12 09:43:23.000000000 +0200
+++ mywine/dlls/gdi/tests/bitmap.c 2006-04-12 10:14:05.000000000 +0200
@@ -1001,6 +1001,58 @@ static void test_bitmap(void)
DeleteDC(hdc);
}

+static void test_badbits()
+{
+ char bmibuf[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
+ BITMAPINFO *pbmi = (BITMAPINFO *)bmibuf;
+ HDC hdc0, hdc;
+ int ret;
+ void *bits;
+ DWORD oldprotect;
+ SYSTEM_INFO si;
+
+ memset(pbmi, 0, sizeof(bmibuf));
+ pbmi->bmiHeader.biSize = sizeof(pbmi->bmiHeader);
+ pbmi->bmiHeader.biHeight = 100;
+ pbmi->bmiHeader.biWidth = 100;
+ pbmi->bmiHeader.biBitCount = 24;
+ pbmi->bmiHeader.biPlanes = 1;
+ pbmi->bmiHeader.biCompression = BI_RGB;
+ hdc0 = GetDC(0);
+ hdc = CreateCompatibleDC( hdc0);
+
+ GetSystemInfo( &si);
+ bits = VirtualAlloc( NULL, 40000, MEM_COMMIT, PAGE_READONLY);
+ ok( (int)bits, "VirtualAlloc failed\n");
+ /* source bits can be read, StretchDIBits succeeds */
+ ret = StretchDIBits( hdc, 0, 0, 100, 100, 0, 0, 100, 100, bits,
+ pbmi, 0, SRCCOPY);
+ ok( ret, "StretchDIBits failed\n");
+ ret = VirtualProtect( (char*)bits + si.dwPageSize, si.dwPageSize,
+ PAGE_NOACCESS, &oldprotect);
+ ok( ret, "VirtualProtect failed\n");
+ /* source bits cannot all be read, StretchDIBits fails */
+ /* and should not crash */
+ ret = StretchDIBits( hdc, 0, 0, 100, 100, 0, 0, 100, 100, bits,
+ pbmi, 0, SRCCOPY);
+ todo_wine {
+ ok( !ret, "StretchDIBits should have failed\n");
+ }
+ /* same tests for SetDIBitsToDevice */
+ ret = SetDIBitsToDevice( hdc, 0, 0, 100, 100, 0, 0, 0, 100, bits,
+ pbmi, DIB_RGB_COLORS);
+ ok( !ret, "SetDIBitsToDevice should have failed\n");
+ ret = VirtualProtect( (char*)bits + si.dwPageSize, si.dwPageSize,
+ PAGE_READONLY, &oldprotect);
+ ok( ret, "VirtualProtect failed\n");
+ ret = SetDIBitsToDevice( hdc, 0, 0, 100, 100, 0, 0, 0, 100, bits,
+ pbmi, DIB_RGB_COLORS);
+ ok( ret, "SetDIBitsToDevice should have succeeded\n");
+
+ DeleteDC( hdc);
+ ReleaseDC(0, hdc0);
+}
+
START_TEST(bitmap)
{
is_win9x = GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC) == 0;
@@ -1009,4 +1061,5 @@ START_TEST(bitmap)
test_dibsections();
test_mono_dibsection();
test_bitmap();
+ test_badbits();
}


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 1 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译