[tlbuild] build failure: texk/dvisvgm/dvisvgm-0.8.7/src/FontEngine.cpp has some type mismatches when calling freetype API

Vladimir Volovich vvv at vsu.ru
Tue Jun 1 00:09:21 CEST 2010


"KB" == Karl Berry writes:

 KB>     "../../../texk/dvisvgm/dvisvgm-0.8.7/src/FontEngine.cpp", line
 KB> 115.59: 1540-0256 (S) A parameter of type "unsigned int *" cannot
 KB> be initialized with an expression of type "int *".

 KB>     "../../../texk/dvisvgm/dvisvgm-0.8.7/src/FontEngine.cpp", line
 KB> 115.59: 1540-1205 (I) The error occurred while converting to
 KB> parameter 2 of "FT_Get_First_Char(FT_Face, FT_UInt *)".

 KB> It seems crazy for the compiler to consider such pointers
 KB> incompatible.

seems that G++ is as crazy in this respect as AIX's xlC:

$ cat test.cpp 
void func(unsigned int *v1) {
  int *v2;
  v2 = v1;
}
$ g++ -c test.cpp 
test.cpp: In function ‘void func(unsigned int*)’:
test.cpp:3: error: invalid conversion from ‘unsigned int*’ to ‘int*’

 KB> Anyway, the code in FontEngine.cpp is just this:

 KB>     114 UInt32 glyphIndex; 115 UInt32 charcode =
 KB> FT_Get_First_Char(_currentFace, &glyphIndex);

 KB> And UInt32 is defined in dvisvgm's src/types.h file: typedef
 KB> int_t<4, false>::T UInt32;

 KB> cf. its companion signed-integer definition: typedef int_t<4,
 KB> true>::T Int32;

 KB> I don't know enough about C++ to know whether the compiler or the
 KB> source code is wrong.

my guess of what's happening is that freetype's functions have C linkage
(extern "C"), and when variable references such as &glyphIndex when
passed to them have the pointer type, which is "int *" in xlC.
(i could be wrong though)

Best,
v.



More information about the tlbuild mailing list