Warnings fix.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3511 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2010-01-23 22:06:59 +00:00
parent 1d5caebb1c
commit b6e0ed9cd3
31 changed files with 165 additions and 86 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.7: Changes towards version 0.7:
- Got rid of many warnings - SvdB
- Clean up and some refactoring of the SuperMelee code - SvdB - Clean up and some refactoring of the SuperMelee code - SvdB
- Fixed concurrent screen fades regression (bug #1079) - Alex - Fixed concurrent screen fades regression (bug #1079) - Alex
- Removed some legacy source code files related to resources - SvdB - Removed some legacy source code files related to resources - SvdB
+2 -1
View File
@@ -27,6 +27,7 @@
#include "filintrn.h" #include "filintrn.h"
#include "libs/compiler.h" #include "libs/compiler.h"
#include "libs/memlib.h" #include "libs/memlib.h"
#include "libs/misc.h"
#include "libs/log.h" #include "libs/log.h"
#ifdef HAVE_DRIVE_LETTERS #ifdef HAVE_DRIVE_LETTERS
@@ -788,7 +789,7 @@ strrchr2(const char *start, int c, const char *end) {
if (end < start) if (end < start)
return (char *) NULL; return (char *) NULL;
if (*end == c) if (*end == c)
return (char *) end; return (char *) unconst(end);
} }
} }
+1
View File
@@ -141,6 +141,7 @@ extern GRAPHICS_STATUS _GraphicsStatusFlags;
// pValidRect or origin may be NULL // pValidRect or origin may be NULL
BOOLEAN GetContextValidRect (RECT *pValidRect, POINT *origin); BOOLEAN GetContextValidRect (RECT *pValidRect, POINT *origin);
extern void FixContextFontEffect (void);
#endif /* _CONTEXT_H */ #endif /* _CONTEXT_H */
-1
View File
@@ -20,7 +20,6 @@
#include "tfb_prim.h" #include "tfb_prim.h"
#include "libs/log.h" #include "libs/log.h"
extern void FixContextFontEffect (void);
static inline TFB_Char *getCharFrame (FONT_DESC *fontPtr, UniChar ch); static inline TFB_Char *getCharFrame (FONT_DESC *fontPtr, UniChar ch);
+6 -4
View File
@@ -356,9 +356,12 @@ typedef struct BuildCharDesc
UniChar index; UniChar index;
} BuildCharDesc; } BuildCharDesc;
int static int
compareBCDIndex (const BuildCharDesc *bcd1, const BuildCharDesc *bcd2) compareBCDIndex (const void *arg1, const void *arg2)
{ {
const BuildCharDesc *bcd1 = (const BuildCharDesc *) arg1;
const BuildCharDesc *bcd2 = (const BuildCharDesc *) arg2;
return (int) bcd1->index - (int) bcd2->index; return (int) bcd1->index - (int) bcd2->index;
} }
@@ -466,8 +469,7 @@ _GetFontData (uio_Stream *fp, DWORD length)
#endif #endif
// sort on the character index // sort on the character index
qsort (bcds, numBCDs, sizeof (BuildCharDesc), qsort (bcds, numBCDs, sizeof (BuildCharDesc), compareBCDIndex);
(int (*)(const void *, const void *)) compareBCDIndex);
fontPtr = AllocFont (0); fontPtr = AllocFont (0);
if (fontPtr == NULL) if (fontPtr == NULL)
+20 -5
View File
@@ -24,7 +24,8 @@
#include "sdl_common.h" #include "sdl_common.h"
#include "primitives.h" #include "primitives.h"
#if 0
/* Unused */
void process_rgb_bmp (FRAME FramePtr, Uint32 *rgba, int maxx, int maxy) void process_rgb_bmp (FRAME FramePtr, Uint32 *rgba, int maxx, int maxy)
{ {
int x, y; int x, y;
@@ -45,7 +46,10 @@ void process_rgb_bmp (FRAME FramePtr, Uint32 *rgba, int maxx, int maxy)
SDL_UnlockSurface (img); SDL_UnlockSurface (img);
UnlockMutex (tfbImg->mutex); UnlockMutex (tfbImg->mutex);
} }
#endif
#if 0
/* Unused */
void fill_frame_rgb (FRAME FramePtr, Uint32 color, int x0, int y0, void fill_frame_rgb (FRAME FramePtr, Uint32 color, int x0, int y0,
int x, int y) int x, int y)
{ {
@@ -70,8 +74,12 @@ void fill_frame_rgb (FRAME FramePtr, Uint32 color, int x0, int y0,
SDL_UnlockSurface (img); SDL_UnlockSurface (img);
UnlockMutex (tfbImg->mutex); UnlockMutex (tfbImg->mutex);
} }
#endif
void arith_frame_blit (FRAME srcFrame, const RECT *rsrc, FRAME dstFrame, #if 0
/* Unused */
void
arith_frame_blit (FRAME srcFrame, const RECT *rsrc, FRAME dstFrame,
const RECT *rdst, int num, int denom) const RECT *rdst, int num, int denom)
{ {
TFB_Image *srcImg, *dstImg; TFB_Image *srcImg, *dstImg;
@@ -120,7 +128,10 @@ void arith_frame_blit (FRAME srcFrame, const RECT *rsrc, FRAME dstFrame,
UnlockMutex (srcImg->mutex); UnlockMutex (srcImg->mutex);
UnlockMutex (dstImg->mutex); UnlockMutex (dstImg->mutex);
} }
#endif
#if 0
/* Unused */
// Generate an array of all pixels in FramePtr // Generate an array of all pixels in FramePtr
// The 32bpp pixel format is : // The 32bpp pixel format is :
// bits 24-31 : red // bits 24-31 : red
@@ -128,8 +139,8 @@ void arith_frame_blit (FRAME srcFrame, const RECT *rsrc, FRAME dstFrame,
// bits 8-15 : blue // bits 8-15 : blue
// bits 0-7 : alpha // bits 0-7 : alpha
// The 8bpp pixel format is 1 index per pixel // The 8bpp pixel format is 1 index per pixel
void getpixelarray (void *map, int Bpp, FRAME FramePtr, void
int width, int height) getpixelarray (void *map, int Bpp, FRAME FramePtr, int width, int height)
{ {
Uint8 r,g,b,a; Uint8 r,g,b,a;
Uint32 p, pos, row; Uint32 p, pos, row;
@@ -179,8 +190,10 @@ void getpixelarray (void *map, int Bpp, FRAME FramePtr,
SDL_UnlockSurface (img); SDL_UnlockSurface (img);
UnlockMutex (tfbImg->mutex); UnlockMutex (tfbImg->mutex);
} }
#endif
#if 0
/* Unused */
// Generate a pixel (in the correct format to be applied to FramePtr) from the // Generate a pixel (in the correct format to be applied to FramePtr) from the
// r,g,b,a values supplied // r,g,b,a values supplied
Uint32 frame_mapRGBA (FRAME FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a) Uint32 frame_mapRGBA (FRAME FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a)
@@ -188,5 +201,7 @@ Uint32 frame_mapRGBA (FRAME FramePtr,Uint8 r, Uint8 g, Uint8 b, Uint8 a)
SDL_Surface *img= (SDL_Surface *)FramePtr->image->NormalImg; SDL_Surface *img= (SDL_Surface *)FramePtr->image->NormalImg;
return (SDL_MapRGBA (img->format, r, g, b, a)); return (SDL_MapRGBA (img->format, r, g, b, a));
} }
#endif
#endif #endif
+1 -1
View File
@@ -56,7 +56,7 @@ TFB_DrawCanvas_GetError (void)
return err; return err;
} }
void static void
checkPrimitiveMode (SDL_Surface *surf, Color *color, DrawMode *mode) checkPrimitiveMode (SDL_Surface *surf, Color *color, DrawMode *mode)
{ {
const SDL_PixelFormat *fmt = surf->format; const SDL_PixelFormat *fmt = surf->format;
+55 -30
View File
@@ -25,42 +25,48 @@
// Pixel drawing routines // Pixel drawing routines
Uint32 getpixel_8(SDL_Surface *surface, int x, int y) static Uint32
getpixel_8(SDL_Surface *surface, int x, int y)
{ {
/* Here p is the address to the pixel we want to retrieve */ /* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x;
return *p; return *p;
} }
void putpixel_8(SDL_Surface *surface, int x, int y, Uint32 pixel) static void
putpixel_8(SDL_Surface *surface, int x, int y, Uint32 pixel)
{ {
/* Here p is the address to the pixel we want to set */ /* Here p is the address to the pixel we want to set */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 1; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 1;
*p = pixel; *p = pixel;
} }
Uint32 getpixel_16(SDL_Surface *surface, int x, int y) static Uint32
getpixel_16(SDL_Surface *surface, int x, int y)
{ {
/* Here p is the address to the pixel we want to retrieve */ /* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 2; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 2;
return *(Uint16 *)p; return *(Uint16 *)p;
} }
void putpixel_16(SDL_Surface *surface, int x, int y, Uint32 pixel) static void
putpixel_16(SDL_Surface *surface, int x, int y, Uint32 pixel)
{ {
/* Here p is the address to the pixel we want to set */ /* Here p is the address to the pixel we want to set */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 2; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 2;
*(Uint16 *)p = pixel; *(Uint16 *)p = pixel;
} }
Uint32 getpixel_24_be(SDL_Surface *surface, int x, int y) static Uint32
getpixel_24_be(SDL_Surface *surface, int x, int y)
{ {
/* Here p is the address to the pixel we want to retrieve */ /* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
return p[0] << 16 | p[1] << 8 | p[2]; return p[0] << 16 | p[1] << 8 | p[2];
} }
void putpixel_24_be(SDL_Surface *surface, int x, int y, Uint32 pixel) static void
putpixel_24_be(SDL_Surface *surface, int x, int y, Uint32 pixel)
{ {
/* Here p is the address to the pixel we want to set */ /* Here p is the address to the pixel we want to set */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
@@ -69,14 +75,16 @@ void putpixel_24_be(SDL_Surface *surface, int x, int y, Uint32 pixel)
p[2] = pixel & 0xff; p[2] = pixel & 0xff;
} }
Uint32 getpixel_24_le(SDL_Surface *surface, int x, int y) static Uint32
getpixel_24_le(SDL_Surface *surface, int x, int y)
{ {
/* Here p is the address to the pixel we want to retrieve */ /* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
return p[0] | p[1] << 8 | p[2] << 16; return p[0] | p[1] << 8 | p[2] << 16;
} }
void putpixel_24_le(SDL_Surface *surface, int x, int y, Uint32 pixel) static void
putpixel_24_le(SDL_Surface *surface, int x, int y, Uint32 pixel)
{ {
/* Here p is the address to the pixel we want to set */ /* Here p is the address to the pixel we want to set */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
@@ -85,21 +93,24 @@ void putpixel_24_le(SDL_Surface *surface, int x, int y, Uint32 pixel)
p[2] = (pixel >> 16) & 0xff; p[2] = (pixel >> 16) & 0xff;
} }
Uint32 getpixel_32(SDL_Surface *surface, int x, int y) static Uint32
getpixel_32(SDL_Surface *surface, int x, int y)
{ {
/* Here p is the address to the pixel we want to retrieve */ /* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 4; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 4;
return *(Uint32 *)p; return *(Uint32 *)p;
} }
void putpixel_32(SDL_Surface *surface, int x, int y, Uint32 pixel) static void
putpixel_32(SDL_Surface *surface, int x, int y, Uint32 pixel)
{ {
/* Here p is the address to the pixel we want to set */ /* Here p is the address to the pixel we want to set */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 4; Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 4;
*(Uint32 *)p = pixel; *(Uint32 *)p = pixel;
} }
GetPixelFn getpixel_for(SDL_Surface *surface) GetPixelFn
getpixel_for(SDL_Surface *surface)
{ {
int bpp = surface->format->BytesPerPixel; int bpp = surface->format->BytesPerPixel;
switch (bpp) { switch (bpp) {
@@ -119,7 +130,8 @@ GetPixelFn getpixel_for(SDL_Surface *surface)
return NULL; return NULL;
} }
PutPixelFn putpixel_for(SDL_Surface *surface) PutPixelFn
putpixel_for(SDL_Surface *surface)
{ {
int bpp = surface->format->BytesPerPixel; int bpp = surface->format->BytesPerPixel;
switch (bpp) { switch (bpp) {
@@ -139,14 +151,16 @@ PutPixelFn putpixel_for(SDL_Surface *surface)
return NULL; return NULL;
} }
static void renderpixel_replace(SDL_Surface *surface, int x, int y, static void
Uint32 pixel, int factor) renderpixel_replace(SDL_Surface *surface, int x, int y, Uint32 pixel,
int factor)
{ {
(void) factor; // ignored (void) factor; // ignored
putpixel_32(surface, x, y, pixel); putpixel_32(surface, x, y, pixel);
} }
static inline Uint8 clip_channel(int c) static inline Uint8
clip_channel(int c)
{ {
if (c < 0) if (c < 0)
c = 0; c = 0;
@@ -155,7 +169,8 @@ static inline Uint8 clip_channel(int c)
return c; return c;
} }
static inline Uint8 modulated_sum(Uint8 dc, Uint8 sc, int factor) static inline Uint8
modulated_sum(Uint8 dc, Uint8 sc, int factor)
{ {
// We use >> 8 instead of / 255 because it is faster, but it does // We use >> 8 instead of / 255 because it is faster, but it does
// not work 100% correctly. It should be safe because this should // not work 100% correctly. It should be safe because this should
@@ -164,7 +179,8 @@ static inline Uint8 modulated_sum(Uint8 dc, Uint8 sc, int factor)
return clip_channel(b); return clip_channel(b);
} }
static inline Uint8 alpha_blend(Uint8 dc, Uint8 sc, int alpha) static inline Uint8
alpha_blend(Uint8 dc, Uint8 sc, int alpha)
{ {
// We use >> 8 instead of / 255 because it is faster, but it does // We use >> 8 instead of / 255 because it is faster, but it does
// not work 100% correctly. It should be safe because this should // not work 100% correctly. It should be safe because this should
@@ -183,15 +199,17 @@ static inline Uint8 alpha_blend(Uint8 dc, Uint8 sc, int alpha)
} while (0) } while (0)
// Assumes the channels already clipped to 8 bits // Assumes the channels already clipped to 8 bits
static inline Uint32 PACK_PIXEL_32(const SDL_PixelFormat *fmt, static inline Uint32
PACK_PIXEL_32(const SDL_PixelFormat *fmt,
Uint8 r, Uint8 g, Uint8 b) Uint8 r, Uint8 g, Uint8 b)
{ {
return ((Uint32)r << fmt->Rshift) | ((Uint32)g << fmt->Gshift) return ((Uint32)r << fmt->Rshift) | ((Uint32)g << fmt->Gshift)
| ((Uint32)b << fmt->Bshift); | ((Uint32)b << fmt->Bshift);
} }
static void renderpixel_additive(SDL_Surface *surface, int x, int y, static void
Uint32 pixel, int factor) renderpixel_additive(SDL_Surface *surface, int x, int y, Uint32 pixel,
int factor)
{ {
const SDL_PixelFormat *fmt = surface->format; const SDL_PixelFormat *fmt = surface->format;
Uint32 *p; Uint32 *p;
@@ -223,8 +241,9 @@ static void renderpixel_additive(SDL_Surface *surface, int x, int y,
*p = PACK_PIXEL_32(fmt, sr, sg, sb); *p = PACK_PIXEL_32(fmt, sr, sg, sb);
} }
static void renderpixel_alpha(SDL_Surface *surface, int x, int y, static void
Uint32 pixel, int factor) renderpixel_alpha(SDL_Surface *surface, int x, int y, Uint32 pixel,
int factor)
{ {
const SDL_PixelFormat *fmt = surface->format; const SDL_PixelFormat *fmt = surface->format;
Uint32 *p; Uint32 *p;
@@ -249,7 +268,8 @@ static void renderpixel_alpha(SDL_Surface *surface, int x, int y,
*p = PACK_PIXEL_32(fmt, sr, sg, sb); *p = PACK_PIXEL_32(fmt, sr, sg, sb);
} }
RenderPixelFn renderpixel_for(SDL_Surface *surface, RenderKind kind) RenderPixelFn
renderpixel_for(SDL_Surface *surface, RenderKind kind)
{ {
const SDL_PixelFormat *fmt = surface->format; const SDL_PixelFormat *fmt = surface->format;
@@ -278,8 +298,9 @@ RenderPixelFn renderpixel_for(SDL_Surface *surface, RenderKind kind)
* Adapted from Paul Heckbert's implementation of Bresenham's algorithm, * Adapted from Paul Heckbert's implementation of Bresenham's algorithm,
* 3 Sep 85; taken from Graphics Gems I */ * 3 Sep 85; taken from Graphics Gems I */
void line_prim(int x1, int y1, int x2, int y2, Uint32 color, void
RenderPixelFn plot, int factor, SDL_Surface *dst) line_prim(int x1, int y1, int x2, int y2, Uint32 color, RenderPixelFn plot,
int factor, SDL_Surface *dst)
{ {
int d, x, y, ax, ay, sx, sy, dx, dy; int d, x, y, ax, ay, sx, sy, dx, dy;
SDL_Rect clip_r; SDL_Rect clip_r;
@@ -417,8 +438,9 @@ clip_line (int *lx1, int *ly1, int *lx2, int *ly2, const SDL_Rect *r)
} }
} }
void fillrect_prim(SDL_Rect r, Uint32 color, void
RenderPixelFn plot, int factor, SDL_Surface *dst) fillrect_prim(SDL_Rect r, Uint32 color, RenderPixelFn plot, int factor,
SDL_Surface *dst)
{ {
int x, y; int x, y;
int x1, y1; int x1, y1;
@@ -440,7 +462,8 @@ void fillrect_prim(SDL_Rect r, Uint32 color,
} }
// clip the rectangle against the clip rectangle // clip the rectangle against the clip rectangle
int clip_rect(SDL_Rect *r, const SDL_Rect *clip_r) int
clip_rect(SDL_Rect *r, const SDL_Rect *clip_r)
{ {
// NOTE: the following clipping code is copied in part // NOTE: the following clipping code is copied in part
// from SDL-1.2.4 sources // from SDL-1.2.4 sources
@@ -475,7 +498,8 @@ int clip_rect(SDL_Rect *r, const SDL_Rect *clip_r)
return 1; return 1;
} }
void blt_prim(SDL_Surface *src, SDL_Rect src_r, RenderPixelFn plot, int factor, void
blt_prim(SDL_Surface *src, SDL_Rect src_r, RenderPixelFn plot, int factor,
SDL_Surface *dst, SDL_Rect dst_r) SDL_Surface *dst, SDL_Rect dst_r)
{ {
SDL_PixelFormat *srcfmt = src->format; SDL_PixelFormat *srcfmt = src->format;
@@ -544,7 +568,8 @@ void blt_prim(SDL_Surface *src, SDL_Rect src_r, RenderPixelFn plot, int factor,
} }
// clip the source and destination rectangles against the clip rectangle // clip the source and destination rectangles against the clip rectangle
int clip_blt_rects(SDL_Rect *src_r, SDL_Rect *dst_r, const SDL_Rect *clip_r) int
clip_blt_rects(SDL_Rect *src_r, SDL_Rect *dst_r, const SDL_Rect *clip_r)
{ {
// NOTE: the following clipping code is copied in part // NOTE: the following clipping code is copied in part
// from SDL-1.2.4 sources // from SDL-1.2.4 sources
+1
View File
@@ -23,5 +23,6 @@
int TFB_Pure_InitGraphics (int driver, int flags, int width, int height); int TFB_Pure_InitGraphics (int driver, int flags, int width, int height);
int TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int togglefullscreen); int TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int togglefullscreen);
void Scale_PerfTest (void);
#endif #endif
+5 -3
View File
@@ -338,8 +338,9 @@ TFB_GetScreenCanvas (SCREEN screen)
return SDL_Screens[screen]; return SDL_Screens[screen];
} }
void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, void
SDL_Rect *dstrect, int blend_numer, int blend_denom) TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
SDL_Rect *dstrect, int blend_numer, int blend_denom)
{ {
BOOLEAN has_colorkey; BOOLEAN has_colorkey;
int x, y, x1, y1, x2, y2, dst_x2, dst_y2, nr, ng, nb; int x, y, x1, y1, x2, y2, dst_x2, dst_y2, nr, ng, nb;
@@ -369,7 +370,7 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
} }
// clip the source rectangle to the source surface // clip the source rectangle to the source surface
if (srcrect) if (srcrect)
{ {
int maxw, maxh; int maxw, maxh;
@@ -452,6 +453,7 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
else else
{ {
has_colorkey = FALSE; has_colorkey = FALSE;
colorkey = 0; /* Satisfying compiler */
} }
src_getpix = getpixel_for (src); src_getpix = getpixel_for (src);
+2 -2
View File
@@ -1076,7 +1076,7 @@ next_token (parse_state *state)
} }
static void static void
expected_error (parse_state *state, char *expected) expected_error (parse_state *state, const char *expected)
{ {
log_add (log_Warning, "VControl: Expected '%s' on config file line %d", log_add (log_Warning, "VControl: Expected '%s' on config file line %d",
expected, state->linenum); expected, state->linenum);
@@ -1084,7 +1084,7 @@ expected_error (parse_state *state, char *expected)
} }
static void static void
consume (parse_state *state, char *expected) consume (parse_state *state, const char *expected)
{ {
if (strcasecmp (expected, state->token)) if (strcasecmp (expected, state->token))
{ {
+13
View File
@@ -41,5 +41,18 @@ static inline void explode (void)
#endif #endif
} }
/* Sometimes you just have to remove a 'const'.
* (for instance, when implementing a function like strchr)
*/
static inline void *
unconst(const void *arg) {
union {
char *c;
const char *cc;
} u;
u.cc = arg;
return u.c;
}
#endif #endif
+2
View File
@@ -84,6 +84,8 @@ ssize_t Socket_recv(Socket *sock, void *buf, size_t len, int flags);
int Socket_setNonBlocking(Socket *sock); int Socket_setNonBlocking(Socket *sock);
int Socket_setReuseAddr(Socket *sock); int Socket_setReuseAddr(Socket *sock);
int Socket_setNodelay(Socket *sock);
int Socket_setTOS(Socket *sock, int tos);
int Socket_setInteractive(Socket *sock); int Socket_setInteractive(Socket *sock);
int Socket_setInlineOOB(Socket *sock); int Socket_setInlineOOB(Socket *sock);
int Socket_setKeepAlive(Socket *sock); int Socket_setKeepAlive(Socket *sock);
+2 -2
View File
@@ -40,12 +40,12 @@
#include <fcntl.h> #include <fcntl.h>
Socket * static Socket *
Socket_alloc(void) { Socket_alloc(void) {
return malloc(sizeof (Socket)); return malloc(sizeof (Socket));
} }
void static void
Socket_free(Socket *sock) { Socket_free(Socket *sock) {
free(sock); free(sock);
} }
+1 -1
View File
@@ -64,7 +64,7 @@ void UninitResourceSystem (void);
BOOLEAN InstallResTypeVectors (const char *res_type, ResourceLoadFun *loadFun, ResourceFreeFun *freeFun, ResourceStringFun *stringFun); BOOLEAN InstallResTypeVectors (const char *res_type, ResourceLoadFun *loadFun, ResourceFreeFun *freeFun, ResourceStringFun *stringFun);
void *res_GetResource (RESOURCE res); void *res_GetResource (RESOURCE res);
void *res_DetachResource (RESOURCE res); void *res_DetachResource (RESOURCE res);
BOOLEAN FreeResource (RESOURCE res); void res_FreeResource (RESOURCE res);
COUNT CountResourceTypes (void); COUNT CountResourceTypes (void);
DWORD res_GetIntResource (RESOURCE res); DWORD res_GetIntResource (RESOURCE res);
BOOLEAN res_GetBooleanResource (RESOURCE res); BOOLEAN res_GetBooleanResource (RESOURCE res);
+1 -1
View File
@@ -578,7 +578,7 @@ StreamDecoderTaskFunc (void *data)
return 0; return 0;
} }
inline sint32 static inline sint32
readSoundSample (void *ptr, int sample_size) readSoundSample (void *ptr, int sample_size)
{ {
if (sample_size == sizeof (uint8)) if (sample_size == sizeof (uint8))
+2 -2
View File
@@ -314,8 +314,8 @@ GetTimeStamps (UNICODE *TimeStamps, sint32 *time_stamps)
} }
#define TEXT_SPEED 80 #define TEXT_SPEED 80
// Returns number of parsed pages // Returns number of parsed pages
int static int
SplitSubPages (UNICODE *text, UNICODE *pages[], sint32 timestamp[], int size) SplitSubPages (UNICODE *text, UNICODE *pages[], sint32 timestamp[], int size)
{ {
int lead_ellips = 0; int lead_ellips = 0;
+9 -8
View File
@@ -24,6 +24,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "libs/log.h" #include "libs/log.h"
#include "libs/misc.h"
// Resynchronise (skip everything starting with 0x10xxxxxx): // Resynchronise (skip everything starting with 0x10xxxxxx):
@@ -176,7 +177,7 @@ getLineFromString(const unsigned char *start, const unsigned char **end,
if (*ptr == '\0') { if (*ptr == '\0') {
*end = ptr; *end = ptr;
*startNext = ptr; *startNext = ptr;
return (unsigned char *) start; return (unsigned char *) unconst(start);
} }
lastPtr = ptr; lastPtr = ptr;
ch = getCharFromString(&ptr); ch = getCharFromString(&ptr);
@@ -191,7 +192,7 @@ getLineFromString(const unsigned char *start, const unsigned char **end,
if (*ptr == '\0'){ if (*ptr == '\0'){
// LF at the end of the string. // LF at the end of the string.
*startNext = ptr; *startNext = ptr;
return (unsigned char *) start; return (unsigned char *) unconst(start);
} }
ch = getCharFromString(&ptr); ch = getCharFromString(&ptr);
if (ch == '\0') { if (ch == '\0') {
@@ -205,11 +206,11 @@ getLineFromString(const unsigned char *start, const unsigned char **end,
// LF // LF
*startNext = *end; *startNext = *end;
} }
return (unsigned char *) start; return (unsigned char *) unconst(start);
} else if (ch == '\r') { } else if (ch == '\r') {
*end = lastPtr; *end = lastPtr;
*startNext = ptr; *startNext = ptr;
return (unsigned char *) start; return (unsigned char *) unconst(start);
} // else: a normal character } // else: a normal character
} }
} }
@@ -271,7 +272,7 @@ utf8StringCopy (unsigned char *dst, size_t size, const unsigned char *src)
if (size == 0) if (size == 0)
return 0; return 0;
strncpy ((char *) dst, (char *) src, size); strncpy ((char *) dst, (const char *) src, size);
dst[size - 1] = '\0'; dst[size - 1] = '\0';
return dst; return dst;
@@ -319,7 +320,7 @@ utf8StringCompare (const unsigned char *str1, const unsigned char *str2)
return 0; return 0;
#else #else
// this will do for now // this will do for now
return strcmp ((char *) str1, (char *) str2); return strcmp ((const char *) str1, (const char *) str2);
#endif #endif
} }
@@ -332,9 +333,9 @@ skipUTF8Chars(const unsigned char *ptr, size_t num) {
oldPtr = ptr; oldPtr = ptr;
ch = getCharFromString(&ptr); ch = getCharFromString(&ptr);
if (ch == '\0') if (ch == '\0')
return (unsigned char *) oldPtr; return (unsigned char *) unconst(oldPtr);
} }
return (unsigned char *) ptr; return (unsigned char *) unconst(ptr);
} }
// Decodes a UTF-8 string (start) into a unicode character string (wstr) // Decodes a UTF-8 string (start) into a unicode character string (wstr)
+3
View File
@@ -102,6 +102,9 @@ int uio_close(uio_Handle *handle);
int uio_rename(uio_DirHandle *oldDir, const char *oldPath, int uio_rename(uio_DirHandle *oldDir, const char *oldPath,
uio_DirHandle *newDir, const char *newPath); uio_DirHandle *newDir, const char *newPath);
// Test permissions on a file or directory.
int uio_access(uio_DirHandle *dir, const char *path, int mode);
// Fstat a file descriptor // Fstat a file descriptor
int uio_fstat(uio_Handle *handle, struct stat *statBuf); int uio_fstat(uio_Handle *handle, struct stat *statBuf);
+1 -1
View File
@@ -172,7 +172,7 @@ MCD_DrawSlider (WIDGET *_self, int x, int y)
SetContextForeGroundColor (oldtext); SetContextForeGroundColor (oldtext);
} }
void static void
MCD_DrawTextEntry (WIDGET *_self, int x, int y) MCD_DrawTextEntry (WIDGET *_self, int x, int y)
{ {
WIDGET_TEXTENTRY *self = (WIDGET_TEXTENTRY *)_self; WIDGET_TEXTENTRY *self = (WIDGET_TEXTENTRY *)_self;
+18 -10
View File
@@ -227,10 +227,10 @@ static void NeedInfo (RESPONSE_REF R);
static void TellHistory (RESPONSE_REF R); static void TellHistory (RESPONSE_REF R);
static void AlienRaces (RESPONSE_REF R); static void AlienRaces (RESPONSE_REF R);
static BYTE stack0, static BYTE stack0;
stack1, static BYTE stack1;
stack2, static BYTE stack2;
stack3; static BYTE stack3;
static void static void
AllianceInfo (RESPONSE_REF R) AllianceInfo (RESPONSE_REF R)
@@ -492,7 +492,9 @@ TellHistory (RESPONSE_REF R)
if (PLAYER_SAID (R, history)) if (PLAYER_SAID (R, history))
{ {
NPCPhrase (WHICH_HISTORY); NPCPhrase (WHICH_HISTORY);
stack0 = stack1 = stack2 = 0; stack0 = 0;
stack1 = 0;
stack2 = 0;
} }
else if (PLAYER_SAID (R, enough_aliens)) else if (PLAYER_SAID (R, enough_aliens))
{ {
@@ -518,7 +520,7 @@ TellHistory (RESPONSE_REF R)
case 0: case 0:
pstack[0] = alien_races; pstack[0] = alien_races;
break; break;
case 1: default:
pstack[0] = 0; pstack[0] = 0;
break; break;
} }
@@ -527,7 +529,7 @@ TellHistory (RESPONSE_REF R)
case 0: case 0:
pstack[1] = the_war; pstack[1] = the_war;
break; break;
case 1: default:
pstack[1] = 0; pstack[1] = 0;
break; break;
} }
@@ -536,7 +538,7 @@ TellHistory (RESPONSE_REF R)
case 0: case 0:
pstack[2] = ancient_history; pstack[2] = ancient_history;
break; break;
case 1: default:
pstack[2] = 0; pstack[2] = 0;
break; break;
} }
@@ -782,7 +784,10 @@ TellMission (RESPONSE_REF R)
if (PLAYER_SAID (R, our_mission)) if (PLAYER_SAID (R, our_mission))
{ {
NPCPhrase (WHICH_MISSION); NPCPhrase (WHICH_MISSION);
stack0 = stack1 = stack2 = stack3 = 0; stack0 = 0;
stack1 = 0;
stack2 = 0;
stack3 = 0;
} }
else if (PLAYER_SAID (R, where_get_minerals)) else if (PLAYER_SAID (R, where_get_minerals))
{ {
@@ -881,7 +886,10 @@ TellStarBase (RESPONSE_REF R)
if (PLAYER_SAID (R, starbase_functions)) if (PLAYER_SAID (R, starbase_functions))
{ {
NPCPhrase (WHICH_FUNCTION); NPCPhrase (WHICH_FUNCTION);
stack0 = stack1 = stack2 = stack3 = 0; stack0 = 0;
stack1 = 0;
stack2 = 0;
stack3 = 0;
} }
else if (PLAYER_SAID (R, tell_me_about_fuel0)) else if (PLAYER_SAID (R, tell_me_about_fuel0))
{ {
+1 -1
View File
@@ -318,7 +318,7 @@ FlushInput (void)
_clear_menu_state (); _clear_menu_state ();
} }
MENU_SOUND_FLAGS static MENU_SOUND_FLAGS
MenuKeysToSoundFlags (const CONTROLLER_INPUT_STATE *state) MenuKeysToSoundFlags (const CONTROLLER_INPUT_STATE *state)
{ {
MENU_SOUND_FLAGS soundFlags; MENU_SOUND_FLAGS soundFlags;
+1
View File
@@ -16,6 +16,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.
*/ */
#include "gendef.h"
#include "encount.h" #include "encount.h"
#include "planets/generate.h" #include "planets/generate.h"
+1 -1
View File
@@ -156,7 +156,7 @@ UninitSpace (void)
} }
} }
HSTARSHIP static HSTARSHIP
BuildSIS (void) BuildSIS (void)
{ {
HSTARSHIP hStarShip; HSTARSHIP hStarShip;
+1 -1
View File
@@ -282,7 +282,7 @@ Present_DrawMovieFrame (PRESENTATION_INPUT_STATE* pPIS)
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
} }
BOOLEAN static BOOLEAN
ShowPresentationFile (const char *name) ShowPresentationFile (const char *name)
{ {
STRING pres = CaptureStringTable (LoadStringTableFile (contentDir, name)); STRING pres = CaptureStringTable (LoadStringTableFile (contentDir, name));
+1 -1
View File
@@ -199,7 +199,7 @@ struct solarsys_state
BYTE max_ship_speed; BYTE max_ship_speed;
STRING XlatRef; STRING XlatRef;
void *XlatPtr; const void *XlatPtr;
COLORMAP OrbitalCMap; COLORMAP OrbitalCMap;
SYSTEM_INFO SysInfo; SYSTEM_INFO SysInfo;
+4 -2
View File
@@ -105,12 +105,13 @@ RenderTopography (FRAME DstFrame, SBYTE *pTopoData, int w, int h)
COUNT i; COUNT i;
BYTE AlgoType; BYTE AlgoType;
SIZE base, d; SIZE base, d;
const XLAT_DESC *xlatDesc;
POINT pt; POINT pt;
const PlanetFrame *PlanDataPtr; const PlanetFrame *PlanDataPtr;
PRIMITIVE BatchArray[NUM_BATCH_POINTS]; PRIMITIVE BatchArray[NUM_BATCH_POINTS];
PRIMITIVE *pBatch; PRIMITIVE *pBatch;
SBYTE *pSrc; SBYTE *pSrc;
BYTE *xlat_tab; const BYTE *xlat_tab;
BYTE *cbase; BYTE *cbase;
POINT oldOrigin; POINT oldOrigin;
RECT ClipRect; RECT ClipRect;
@@ -132,7 +133,8 @@ RenderTopography (FRAME DstFrame, SBYTE *pTopoData, int w, int h)
]; ];
AlgoType = PLANALGO (PlanDataPtr->Type); AlgoType = PLANALGO (PlanDataPtr->Type);
base = PlanDataPtr->base_elevation; base = PlanDataPtr->base_elevation;
xlat_tab = (BYTE*)((XLAT_DESC*)pSolarSysState->XlatPtr)->xlat_tab; xlatDesc = (const XLAT_DESC *) pSolarSysState->XlatPtr;
xlat_tab = (const BYTE *) xlatDesc->xlat_tab;
cbase = GetColorMapAddress (pSolarSysState->OrbitalCMap); cbase = GetColorMapAddress (pSolarSysState->OrbitalCMap);
i = NUM_BATCH_POINTS; i = NUM_BATCH_POINTS;
+2 -2
View File
@@ -375,8 +375,8 @@ DoModifyRoster (MENU_STATE *pMS)
static int static int
compShipPos (const void *ptr1, const void *ptr2) compShipPos (const void *ptr1, const void *ptr2)
{ {
POINT *pt1 = (POINT *) ptr1; const POINT *pt1 = (const POINT *) ptr1;
POINT *pt2 = (POINT *) ptr2; const POINT *pt2 = (const POINT *) ptr2;
// Ships on the left in the lower half // Ships on the left in the lower half
if (pt1->x < pt2->x) if (pt1->x < pt2->x)
+2 -2
View File
@@ -1274,7 +1274,7 @@ GetCPodCapacity (POINT *ppt)
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Get the total amount of minerals aboard the SIS. // Get the total amount of minerals aboard the SIS.
COUNT static COUNT
GetElementMass (void) GetElementMass (void)
{ {
return GLOBAL_SIS (TotalElementMass); return GLOBAL_SIS (TotalElementMass);
@@ -1379,7 +1379,7 @@ GetSBayCapacity (POINT *ppt)
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Get the total amount of fuel aboard the SIS. // Get the total amount of fuel aboard the SIS.
DWORD static DWORD
GetFuelTotal (void) GetFuelTotal (void)
{ {
return GLOBAL_SIS (FuelOnBoard); return GLOBAL_SIS (FuelOnBoard);
+2
View File
@@ -231,9 +231,11 @@ extern COUNT GetModuleCrewCapacity (BYTE moduleType);
extern COUNT GetCrewPodCapacity (void); extern COUNT GetCrewPodCapacity (void);
extern COUNT GetCPodCapacity (POINT *ppt); extern COUNT GetCPodCapacity (POINT *ppt);
extern COUNT GetModuleStorageCapacity (BYTE moduleType);
extern COUNT GetStorageBayCapacity (void); extern COUNT GetStorageBayCapacity (void);
extern COUNT GetSBayCapacity (POINT *ppt); extern COUNT GetSBayCapacity (POINT *ppt);
extern DWORD GetModuleFuelCapacity (BYTE moduleType);
extern DWORD GetFuelTankCapacity (void); extern DWORD GetFuelTankCapacity (void);
extern DWORD GetFTankCapacity (POINT *ppt); extern DWORD GetFTankCapacity (POINT *ppt);
+4 -4
View File
@@ -1923,7 +1923,7 @@ DoMelee (MELEE_STATE *pMS)
return TRUE; return TRUE;
} }
int static int
LoadMeleeConfig (MELEE_STATE *pMS) LoadMeleeConfig (MELEE_STATE *pMS)
{ {
uio_Stream *stream; uio_Stream *stream;
@@ -1968,7 +1968,7 @@ err:
return -1; return -1;
} }
int static int
WriteMeleeConfig (MELEE_STATE *pMS) WriteMeleeConfig (MELEE_STATE *pMS)
{ {
uio_Stream *stream; uio_Stream *stream;
@@ -2125,7 +2125,7 @@ connectedFeedback (NetConnection *conn) {
PlayMenuSound (MENU_SOUND_INVOKED); PlayMenuSound (MENU_SOUND_INVOKED);
} }
const char * static const char *
abortReasonString (NetplayAbortReason reason) abortReasonString (NetplayAbortReason reason)
{ {
switch (reason) switch (reason)
@@ -2160,7 +2160,7 @@ abortFeedback (NetConnection *conn, NetplayAbortReason reason)
connectionFeedback (conn, msg, true); connectionFeedback (conn, msg, true);
} }
const char * static const char *
resetReasonString (NetplayResetReason reason) resetReasonString (NetplayResetReason reason)
{ {
switch (reason) switch (reason)