Fixing bug #1480977: Defining _GNU_SOURCE before including any headers,
then checking if __USE_GNU was set, in which case strcasestr() is almost definitely available, otherwise we define it in tuxpaint.c For non-GNU systems which DO have strcasestr() defined, HAVE_STRCASESTR can be set to prevent redefinition within tuxpaint.c.
This commit is contained in:
parent
c36a202e0f
commit
9fae1a8a25
3 changed files with 50 additions and 6 deletions
2
Makefile
2
Makefile
|
|
@ -1028,7 +1028,7 @@ obj/tuxpaint.o: src/tuxpaint.c \
|
||||||
$(ARCH_HEADERS)
|
$(ARCH_HEADERS)
|
||||||
@echo
|
@echo
|
||||||
@echo "...Compiling Tux Paint from source..."
|
@echo "...Compiling Tux Paint from source..."
|
||||||
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(MOUSE_CFLAGS) $(DEFS) \
|
$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(MOUSE_CFLAGS) $(DEFS) \
|
||||||
-c src/tuxpaint.c -o obj/tuxpaint.o
|
-c src/tuxpaint.c -o obj/tuxpaint.o
|
||||||
|
|
||||||
obj/i18n.o: src/i18n.c src/i18n.h src/debug.h
|
obj/i18n.o: src/i18n.c src/i18n.h src/debug.h
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ http://www.newbreedsoftware.com/tuxpaint/
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
|
||||||
2006.May.14 (0.9.16)
|
2006.June.02 (0.9.16)
|
||||||
* Interface improvements:
|
* Interface improvements:
|
||||||
-----------------------
|
-----------------------
|
||||||
* Modified "Text" tool so that it correctly handles the 16-bit unicode
|
* Modified "Text" tool so that it correctly handles the 16-bit unicode
|
||||||
|
|
@ -155,6 +155,8 @@ $Id$
|
||||||
|
|
||||||
* Silencing any errors when running kde- or gnome-config during install.
|
* Silencing any errors when running kde- or gnome-config during install.
|
||||||
|
|
||||||
|
* Implemented strcasestr() for systems which don't have it.
|
||||||
|
|
||||||
* Bug Fixes:
|
* Bug Fixes:
|
||||||
----------
|
----------
|
||||||
* Tux Paint's scalable icon (tuxpaint-icon.svg) caused Gnome panel to
|
* Tux Paint's scalable icon (tuxpaint-icon.svg) caused Gnome panel to
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - April 2, 2006
|
June 14, 2002 - June 2, 2006
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -168,13 +168,47 @@ static scaleparams scaletable[] = {
|
||||||
#define REPEAT_SPEED 300 /* Initial repeat speed for scrollbars */
|
#define REPEAT_SPEED 300 /* Initial repeat speed for scrollbars */
|
||||||
#define CURSOR_BLINK_SPEED 500 /* Initial repeat speed for cursor */
|
#define CURSOR_BLINK_SPEED 500 /* Initial repeat speed for cursor */
|
||||||
|
|
||||||
|
|
||||||
|
#define _GNU_SOURCE /* for strcasestr() */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define __USE_GNU /* for strcasestr() */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Check if features.h did its 'magic', in which case strcasestr() is
|
||||||
|
likely available; if not using GNU, you can set HAVE_STRCASESTR to
|
||||||
|
avoid trying to redefine it -bjk 2006.06.02 */
|
||||||
|
|
||||||
|
#if !defined(__USE_GNU) && !defined(HAVE_STRCASESTR)
|
||||||
|
#warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR"
|
||||||
|
|
||||||
|
char * strcasestr(const char *haystack, const char *needle)
|
||||||
|
{
|
||||||
|
char * uphaystack, * upneedle, * result;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
uphaystack = strdup(haystack);
|
||||||
|
upneedle = strdup(needle);
|
||||||
|
|
||||||
|
if (uphaystack == NULL || upneedle == NULL)
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
|
for (i = 0; i < strlen(uphaystack); i++)
|
||||||
|
uphaystack[i] = toupper(uphaystack[i]);
|
||||||
|
|
||||||
|
for (i = 0; i < strlen(upneedle); i++)
|
||||||
|
upneedle[i] = toupper(upneedle[i]);
|
||||||
|
|
||||||
|
result = strstr(uphaystack, upneedle);
|
||||||
|
|
||||||
|
return(result - uphaystack + (char *) haystack);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* kluge; 2006.01.15 */
|
/* kluge; 2006.01.15 */
|
||||||
//#define __APPLE_10_2_8__
|
//#define __APPLE_10_2_8__
|
||||||
|
|
||||||
|
|
@ -1152,6 +1186,11 @@ static void do_wait(int counter)
|
||||||
// This lets us exit quickly; perhaps the system is swapping to death
|
// This lets us exit quickly; perhaps the system is swapping to death
|
||||||
// or the user started Tux Paint by accident. It also lets the user
|
// or the user started Tux Paint by accident. It also lets the user
|
||||||
// more easily bypass the splash screen wait.
|
// more easily bypass the splash screen wait.
|
||||||
|
|
||||||
|
/* Was used in progressbar.c, but is currently commented out!
|
||||||
|
-bjk 2006.06.02 */
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void eat_sdl_events(void)
|
static void eat_sdl_events(void)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
@ -1191,6 +1230,7 @@ static void eat_sdl_events(void)
|
||||||
bypass_splash_wait = 1;
|
bypass_splash_wait = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* --- MAIN --- */
|
/* --- MAIN --- */
|
||||||
|
|
@ -3665,7 +3705,7 @@ static void tint_surface(SDL_Surface * tmp_surf, SDL_Surface * surf_ptr)
|
||||||
key_color_ptr = find_most_saturated(initial_hue, work,
|
key_color_ptr = find_most_saturated(initial_hue, work,
|
||||||
width * height, &hue_range);
|
width * height, &hue_range);
|
||||||
|
|
||||||
printf("key_color_ptr = %d\n", key_color_ptr);
|
printf("key_color_ptr = %d\n", (int) key_color_ptr);
|
||||||
|
|
||||||
|
|
||||||
if (key_color_ptr)
|
if (key_color_ptr)
|
||||||
|
|
@ -5308,11 +5348,13 @@ static void load_stamps(SDL_Surface * screen)
|
||||||
free(homedirdir);
|
free(homedirdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef FORKED_FONTS
|
||||||
static int load_user_fonts_stub(void *vp)
|
static int load_user_fonts_stub(void *vp)
|
||||||
{
|
{
|
||||||
return load_user_fonts(screen, vp);
|
return load_user_fonts(screen, vp);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/* Setup: */
|
/* Setup: */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue