libxine 的开发者文档有BUG?!

Posted on 2009年12月29日 09:27

有关用C的OOP的 http://www.xine-project.org/hackersguide#id524081

 

my_stack_t *new_my_stack(void) {
     intstack_t *this;
   
     /* alloc memory */
     this = malloc(sizeof(intstack_t));
   
     /* fill in methods */
     this->push = push;
     this->add  = add;
     this->pop  = pop;
   
     /* init data fields */
     this->stack_size = 0;
   
     /* return public part */
     return &this->stack;
   }

this 指针应该无法访问到push函数指针的地址吧?!

 

 

Is2012 ? TimeStampInValidate : ...

Posted on 2009年12月26日 15:28

Is2012 ? TimeStampInValidate : ...

iPhone 3.0 jialbreak dev

Posted on 2009年12月06日 12:19

 

cd ~/Desktop

vi script

#!/bin/bash
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/
dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255
printf "\x8f\x2a\x00\x00" >> working
dd if=iPhoneOS\ Build\ System\ Support of=working bs=1 skip=127504 seek=127504
/bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
/bin/mv working iPhoneOS\ Build\ System\ Support
chmod a+x iPhoneOS\ Build\ System\ Support

 

 

libtool suck

Posted on 2009年12月01日 18:57

 

make
/bin/sh /home/xzhai/Download/php-clearsilver-0.4/libtool --mode=compile cc  -I. -I/home/xzhai/Download/php-clearsilver-0.4 -DPHP_ATOM_INC -I/home/xzhai/Download/php-clearsilver-0.4/include -I/home/xzhai/Download/php-clearsilver-0.4/main -I/home/xzhai/Download/php-clearsilver-0.4 -I/usr/lib/php5/include/php -I/usr/lib/php5/include/php/main -I/usr/lib/php5/include/php/TSRM -I/usr/lib/php5/include/php/Zend -I/usr/lib/php5/include/php/ext -I/usr/lib/php5/include/php/ext/date/lib -I/usr/include/ClearSilver  -DHAVE_CONFIG_H  -g -O2   -c /home/xzhai/Download/php-clearsilver-0.4/clearsilver.c -o clearsilver.lo
/home/xzhai/Download/php-clearsilver-0.4/libtool: line 460: CDPATH: command not found
/home/xzhai/Download/php-clearsilver-0.4/libtool: line 1145: func_opt_split: command not found
libtool: Version mismatch error.  This is libtool 2.2.6, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6
libtool: and run autoconf again.
make: *** [clearsilver.lo] 错误 63

解决办法 rm aclocal.m4;autoreconf

 

 

xgettext --from-code=UTF-8

Posted on 2009年11月30日 19:31

使用 UTF-8 编码进行 msgfmt -o *.mo *.po,总是报错“无效的多字节序列”;

file *.po 发现编码变成 ISO-8859,然后 xgettext --from-code=UTF-8 重新制作*.po 解决。

extern 外部变量可以在动态链接库之间起作用吗?

Posted on 2009年11月05日 19:00

假设有两个动态链接库libA.dylib、libB.dylib(或者*.so、*.dll),有一个公共头文件HelloGlobal.h,里面有一个extern int GlobalInteger变量,而libA的作用是设置变量的值、libB获得值(setter / getter);

HelloGlobal.h

#ifndef __HELLO_GLOBAL_H__
#define __HELLO_GLOBAL_H__

extern int GlobalInteger;

#endif // __HELLO_GLOBAL_H__

libA.h

#ifndef __LIB_A_H__
#define __LIB_A_H__

void SetGlobalInteger();

#endif // __LIB_A_H__

libA.c

#include "LibA.h"
#include "HelloGlobal.h"

int GlobalInteger;

void
SetGlobalInteger()
{
    GlobalInteger = 101;
}

libB.h

#ifndef __LIB_B_H__
#define __LIB_B_H__

void GetGlobalInteger();

#endif // __LIB_B_H__

libB.c

#include <stdio.h>

#include "LibB.h"
#include "HelloGlobal.h"

int GlobalInteger;

void
GetGlobalInteger()
{
    printf("%s, line %d GlobalInteger %d\n", __FILE__, __LINE__, GlobalInteger);
}

HelloGlobal.c

#include <stdio.h>

#include "HelloGlobal.h"
#include "libA.h"
#include "libB.h"
#include "ExternFile.h"

int GlobalInteger;

int
main()
{
    SetGlobalInteger();
   
    GetGlobalInteger();
   
    ExternSetGlobalInteger();
   
    printf("GlobalInteger %d\n", GlobalInteger);
   
    return 0;
}

 

extern变量在libA和libB动态链接库之间不能作用于“外部”,而使用外部源头件ExternFile.h可以使extern变量作用于外部;

动态链接库之间类似进程之间的通讯 ^_^

GtkGlext examples SConstruct

Posted on 2009年9月30日 10:04

CCFLAGS = ' `pkg-config --cflags gtk+-2.0` '
LINKFLAGS = ' `pkg-config --libs gtk+-2.0` '
__CPPPATH=['/usr/lib/gtkglext-1.0/include', '/usr/include/gtkglext-1.0']
__LIBS=['libgtkglext-x11-1.0']

env = Environment(CCFLAGS=CCFLAGS, LINKFLAGS=LINKFLAGS)
env.Program('simple', 'simple.c', CPPPATH=__CPPPATH, LIBS=__LIBS)

wayland 依赖

Posted on 2009年9月24日 08:50

dev-libs/libffi

eagle

libpng

cairo

gdk-pixbuf-2.0

libudev >= 136

libdrm

rm_eo 在 Linux、UNIX下居然不同,不解

Posted on 2009年9月02日 08:51

man regex中有Byte Offsets这样的一段,介绍遍历满足正则表达式条件的所有子串的rm_so(起始位置)和rm_eo(终止位置);

用到了regmatch_t结构:

typedef struct {
    regoff_t rm_so;
    regoff_t rm_eo;
} regmatch_t;
有这样的字符串"xzhai=\"Unix/Linux geek\";legendren=\"GOD\";"

想寻找="xxx";里的xxx内容;

 

while (!regexec(&m_reg, tmp, 1, &m_match, 0)) 
{
    // FIXME: Unix regex`s rm_eo is often 0 test under Mac OS X Leopard;
    // But Linux POSIX regex`s rm_eo is normal test under Gentoo Linux
    printf("%d - %d\n", m_match.rm_so, m_match.rm_eo);
    tmp += m_match.rm_eo;
}

Linux下rm_eo的值是正确的,而UNIX下rm_eo始终为0,不解

 

snow leopard @ android

Posted on 2009年8月27日 21:10