[Bf-committers] Compile warnings

Mika Saari mika.saari at wipsl.com
Fri Sep 16 13:26:19 CEST 2005


Hello !

	I hope I am using the proper protocol to answer, but I hope so. I do
not have CVS rights so I will make a patch to patch tracker about strlen
fix.

> - Font stuff:
> If a wchar_t is an unsigned short, then this line cannot work:
> 
> scr/editfont.c, line 1123
> 	cu->len= strlen(textbuf);

	This is true, my fault. It should look like

	// Copy the oldstr to textbuf temporary global variable
        wcscpy(textbuf, oldstr);

        // Set the object length and position
        cu= G.obedit->data;
        cu->len= wcslen(textbuf);
        if(cu->pos>cu->len) cu->pos= cu->len;

	// Update the string to UTF-8
        update_string(cu);


> Then it looks like new code uses spaces instead of tabs. (interface.c,  
> editfont.c). Should really be fixed! And follow code style of existing  
> code.

	Went through all of the files related to my font code short summary
here:

	Spaces converted to tabs:
		font.c, BLI_vfontdata.h, freetypefont.c, butspace.h,
buttons_editing.c, editfont.c, interface.c, interface_draw.c,
usiblender.c

	No changes:
		BKE_font.h, BKE_global.h, blender.c, psfont.c, writefile.c,
BIG_editfont.h, BIG_interface.h	

> The ui_do_but_CHARTAB() in interface.c is not a nice way to do it...  
> this could be solved using existing button callbacks. Having editmode  
> text code inside the core interface is not nice. Same goes for the  
> drawing version of the button. Buttons should really serve more generic  
> purposes. :)
> I might check on that or help with it later.

	When we ( I and Ton ) talked about this few months ago, there were few
different ways of doing it and I tested those, but I simply couldn't get
those to work (my thin knowledge of UI coding is the reason, sorry about
that). So I ended up to this solution. If the code needs to be changed,
then I really would need huge amount of help and time :(

> Then there's six new globals, like G.selfont... is that really needed?

	In editing_panel_font_type this same font selection is handled with
code: 

	uiDefButS(block, MENU, B_SETFONT, strp, 550,188,220,20, &G.buts->texnr,
0, 0, 0, 0, "Change font for object");

	Couldn't get "&G.buts->texnr" idea to work with my font selection.

	I need to go through other globals, but intrr has been suggesting one
idea which should decrease the globals as well.

> This could have used a good code review before added, and poking people  
> who like to design button panels. Seems like much wanted functionality  
> yes, but worth checking on a good integration to make it future proof.  
> :)

	I fully agree, and I am really sorry about my thin knowledge of blender
code and behaviour in blender society. I am learning it. I hope this
code won't bring more burden to the code base than it is giving as a
feature.

	-Mika



More information about the Bf-committers mailing list