Merge branch 'master' of bitbucket.org:nuttx/apps
This commit is contained in:
commit
c185f8e5c8
@ -308,7 +308,7 @@ static uint8_t wld_read_shortint(INIHANDLE handle,
|
||||
if (value != INT32_MAX)
|
||||
{
|
||||
|
||||
fprintf(stderr, "Error: Integer out of range in INI file:\n");
|
||||
fprintf(stderr, "ERROR: Integer out of range in INI file:\n");
|
||||
fprintf(stderr,
|
||||
" Section=\"%s\" Variable name=\"%s\" value=%ld\n",
|
||||
section_name, variable_name, (long)variable_value);
|
||||
@ -318,7 +318,7 @@ static uint8_t wld_read_shortint(INIHANDLE handle,
|
||||
else
|
||||
{
|
||||
|
||||
fprintf(stderr, "Error: Requird integer not found in INI file:\n");
|
||||
fprintf(stderr, "ERROR: Requird integer not found in INI file:\n");
|
||||
fprintf(stderr, " Section=\"%s\" Variable name=\"%s\"\n",
|
||||
section_name, variable_name);
|
||||
return WORLD_INTEGER_NOT_FOUND;
|
||||
@ -375,7 +375,7 @@ static uint8_t wld_read_filename(INIHANDLE handle,
|
||||
|
||||
*filename = NULL;
|
||||
|
||||
fprintf(stderr, "Error: Required filename not found in INI file:\n");
|
||||
fprintf(stderr, "ERROR: Required filename not found in INI file:\n");
|
||||
fprintf(stderr, " Section=\"%s\" Variable name=\"%s\"\n",
|
||||
section_name, variable_name);
|
||||
return WORLD_FILENAME_NOT_FOUND;
|
||||
@ -388,7 +388,7 @@ static uint8_t wld_read_filename(INIHANDLE handle,
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* Private Functions
|
||||
* Public Functions
|
||||
*************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
@ -407,7 +407,7 @@ uint8_t wld_create_world(char *wldfile)
|
||||
handle = inifile_initialize(wldfile);
|
||||
if (handle == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error: Could not open INI file=\"%s\"\n", wldfile);
|
||||
fprintf(stderr, "ERROR: Could not open INI file=\"%s\"\n", wldfile);
|
||||
return WORLD_FILE_OPEN_ERROR;
|
||||
}
|
||||
|
||||
|
@ -54,18 +54,18 @@
|
||||
* This function opens the input file and loads the world data from it
|
||||
************************************************************************/
|
||||
|
||||
uint8_t wld_load_planefile(const char *wldFile)
|
||||
uint8_t wld_load_planefile(const char *wldfile)
|
||||
{
|
||||
FILE *fp;
|
||||
uint8_t result;
|
||||
|
||||
/* Open the map file which contains the description of the world */
|
||||
|
||||
fp = fopen(wldFile, "rb");
|
||||
fp = fopen(wldfile, "rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Could not open map file=\"%s\": %s\n",
|
||||
wldFile, strerror(errno));
|
||||
wldfile, strerror(errno));
|
||||
return PLANE_READ_OPEN_ERROR;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ static uint8_t wld_load_worldplane(FILE * fp, rect_head_t * list,
|
||||
|
||||
if (fread((char *)&rect->d, SIZEOF_RECTDATATYPE, 1, fp) != 1)
|
||||
{
|
||||
fprintf(stderr, "Error: read of rectangle %d (of %d) failed! ",
|
||||
fprintf(stderr, "ERROR: read of rectangle %d (of %d) failed! ",
|
||||
i, numRects);
|
||||
fprintf(stderr, "feof=%d ferror=%d\n", feof(fp), ferror(fp));
|
||||
return PLANE_DATA_READ_ERROR;
|
||||
|
@ -181,7 +181,7 @@ uint8_t wld_initialize_planes(void);
|
||||
void wld_discard_planes(void);
|
||||
uint8_t wld_load_planefile(const char *wldfile);
|
||||
uint8_t wld_load_planes(FILE *fp);
|
||||
uint8_t wld_save_planes(const char *wldFile);
|
||||
uint8_t wld_save_planes(const char *wldfile);
|
||||
rect_list_t *wld_new_plane(void);
|
||||
void wld_add_plane(rect_list_t *rect,
|
||||
rect_head_t *list);
|
||||
|
@ -71,7 +71,7 @@ static graphic_file_format_t wld_check_format(FILE * fp, char *filename)
|
||||
|
||||
if (fread(magic, 1, MAGIC_LENGTH, fp) != MAGIC_LENGTH)
|
||||
{
|
||||
wld_fatal_error("Error reading texture %s.", filename);
|
||||
wld_fatal_error("ERROR: Reading texture %s.", filename);
|
||||
}
|
||||
|
||||
if (strncmp(magic, PPM_MAGIC, sizeof(PPM_MAGIC) - 1) == 0)
|
||||
@ -171,7 +171,7 @@ graphic_file_t *wld_readgraphic_file(char *filename)
|
||||
|
||||
if (gfile == NULL)
|
||||
{
|
||||
wld_fatal_error("Error reading texture %s\n");
|
||||
wld_fatal_error("ERROR: Reading texture %s\n");
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
@ -160,7 +160,7 @@ wld_bitmap_t *wld_read_texturefile(char *filename)
|
||||
gFile = wld_readgraphic_file(filename);
|
||||
if (gFile == NULL)
|
||||
{
|
||||
wld_fatal_error("Error reading texture %s.", filename);
|
||||
wld_fatal_error("ERROR: Reading texture %s.", filename);
|
||||
}
|
||||
|
||||
/* The height and width should be powers of two for efficient texture
|
||||
|
@ -90,7 +90,7 @@ static uint8_t wld_save_worldplane(FILE * fp, rect_list_t * rect)
|
||||
* This function stores the world data into the specified file
|
||||
************************************************************************/
|
||||
|
||||
uint8_t wld_save_planes(const char *wldFile)
|
||||
uint8_t wld_save_planes(const char *wldfile)
|
||||
{
|
||||
FILE *fp;
|
||||
plane_file_header_t fileHeader;
|
||||
@ -98,7 +98,7 @@ uint8_t wld_save_planes(const char *wldFile)
|
||||
|
||||
/* Open the file which contains the description of the world */
|
||||
|
||||
fp = fopen(wldFile, "wb");
|
||||
fp = fopen(wldfile, "wb");
|
||||
if (!fp)
|
||||
{
|
||||
return PLANE_WRITE_OPEN_ERROR;
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
#include "trv_types.h"
|
||||
#include "debug.h"
|
||||
#include "wld_plane.h"
|
||||
#include "wld_world.h"
|
||||
#include "wld_utils.h"
|
||||
#include "tcl_x11graphics.h"
|
||||
#include "tcl_colors.h"
|
||||
@ -650,10 +650,11 @@ int main(int argc, char **argv, char **envp)
|
||||
|
||||
g_in_filename = argv[optind];
|
||||
|
||||
/* Read the plane file now so that we can be certain that it is a valid
|
||||
* plaine file. */
|
||||
/* Read the world files now so that we can be certain that it is a valid
|
||||
* world file.
|
||||
*/
|
||||
|
||||
if (wld_load_planefile(g_in_filename) != PLANE_SUCCESS)
|
||||
if (wld_create_world(g_in_filename) != PLANE_SUCCESS)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@
|
||||
static GC gc;
|
||||
#ifndef NO_XSHM
|
||||
static XShmSegmentInfo xshminfo;
|
||||
static int xError;
|
||||
static int xerror;
|
||||
#endif
|
||||
static int shmCheckPoint = 0;
|
||||
static int useShm;
|
||||
@ -210,43 +210,43 @@ static bool x11_allocate_colors(tcl_window_t * w, Colormap colormap)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: errorHandler
|
||||
* Name: x11_error_handler
|
||||
* Description:
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NO_XSHM
|
||||
static int errorHandler(Display * display, XErrorEvent * event)
|
||||
static int x11_error_handler(Display * display, XErrorEvent * event)
|
||||
{
|
||||
xError = 1;
|
||||
xerror = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: trapErrors
|
||||
* Name: x11_trap_errors
|
||||
* Description:
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NO_XSHM
|
||||
static void trapErrors(void)
|
||||
static void x11_trap_errors(void)
|
||||
{
|
||||
xError = 0;
|
||||
XSetErrorHandler(errorHandler);
|
||||
xerror = 0;
|
||||
XSetErrorHandler(x11_error_handler);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: untrapErrors
|
||||
* Name: x11_untrap_errors
|
||||
* Description:
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NO_XSHM
|
||||
static int untrapErrors(Display * display)
|
||||
static int x11_untrap_errors(Display * display)
|
||||
{
|
||||
XSync(display, 0);
|
||||
XSetErrorHandler(NULL);
|
||||
return xError;
|
||||
return xerror;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -276,13 +276,13 @@ static void x11_map_sharedmemory(tcl_window_t * w, int depth)
|
||||
useShm = 1;
|
||||
printf("Using shared memory.\n");
|
||||
|
||||
trapErrors();
|
||||
x11_trap_errors();
|
||||
w->image = XShmCreateImage(w->display,
|
||||
DefaultVisual(w->display, w->screen),
|
||||
depth, ZPixmap, NULL, &xshminfo,
|
||||
w->width, w->height);
|
||||
|
||||
if (untrapErrors(w->display))
|
||||
if (x11_untrap_errors(w->display))
|
||||
{
|
||||
x11_unmap_sharedmemory(w);
|
||||
goto shmerror;
|
||||
@ -315,9 +315,9 @@ static void x11_map_sharedmemory(tcl_window_t * w, int depth)
|
||||
xshminfo.shmaddr = w->image->data;
|
||||
xshminfo.readOnly = false;
|
||||
|
||||
trapErrors();
|
||||
x11_trap_errors();
|
||||
result = XShmAttach(w->display, &xshminfo);
|
||||
if (untrapErrors(w->display) || !result)
|
||||
if (x11_untrap_errors(w->display) || !result)
|
||||
{
|
||||
x11_unmap_sharedmemory(w);
|
||||
goto shmerror;
|
||||
|
Loading…
Reference in New Issue
Block a user