less compiler warnings

This commit is contained in:
UnknownShadow200 2019-05-19 18:12:35 +10:00
parent c037aa31a1
commit 97d52f3dca
7 changed files with 29 additions and 29 deletions

View File

@ -19,7 +19,7 @@
# You should now be able to compile both 32 and 64 bit variants of the client for linux
# However! The default libcurl package will produce an executable that won't run on Arch (due to defining CURL_OPENSSL_3)
# As such, you may want to uninstall libcurl package, manually compile curl's source code for both 32 and 64 bit,
# then add the .so files to /usr/lib/i386-linux-gnu and /usr/lib/i386-linux-gnu/
# then add the .so files to /usr/lib/i386-linux-gnu and /usr/lib/x86_64-linux-gnu/
cd ~/client/src/
echo $PWD

View File

@ -777,7 +777,7 @@ static ReturnCode Music_PlayOgg(struct Stream* source) {
/* so we may end up decoding slightly over a second of audio */
chunkSize = fmt.Channels * (fmt.SampleRate + vorbis.BlockSizes[1]);
samplesPerSecond = fmt.Channels * fmt.SampleRate;
data = Mem_Alloc(chunkSize * AUDIO_MAX_BUFFERS, 2, "Ogg - final PCM output");
data = (int16_t*)Mem_Alloc(chunkSize * AUDIO_MAX_BUFFERS, 2, "Ogg final output");
/* fill up with some samples before playing */
for (i = 0; i < AUDIO_MAX_BUFFERS && !res; i++) {

View File

@ -484,8 +484,8 @@ COMPOUND "ClassicWorld" {
}
}
}*/
static void* Cw_GetBlocks(struct NbtTag* tag) {
void* ptr;
static BlockRaw* Cw_GetBlocks(struct NbtTag* tag) {
BlockRaw* ptr;
if (NbtTag_IsSmall(tag)) {
ptr = Mem_Alloc(tag->DataSize, 1, ".cw map blocks");
Mem_Copy(ptr, tag->Value.Small, tag->DataSize);

View File

@ -246,12 +246,12 @@ static void LInput_DrawText(struct LInput* w, struct DrawTextArgs* args) {
}
static void LInput_Draw(void* widget) {
struct LInput* w = (struct LInput*)widget;
String text; char textBuffer[STRING_SIZE];
struct DrawTextArgs args;
Size2D size;
BitmapCol white = BITMAPCOL_CONST(255, 255, 255, 255);
struct LInput* w = widget;
if (w->Hidden) return;
String_InitArray(text, textBuffer);

View File

@ -774,7 +774,7 @@ void* Waitable_Create(void) {
}
void Waitable_Free(void* handle) {
struct WaitData* ptr = handle;
struct WaitData* ptr = (struct WaitData*)handle;
int res;
res = pthread_cond_destroy(&ptr->cond);
@ -785,13 +785,13 @@ void Waitable_Free(void* handle) {
}
void Waitable_Signal(void* handle) {
struct WaitData* ptr = handle;
struct WaitData* ptr = (struct WaitData*)handle;
int res = pthread_cond_signal(&ptr->cond);
if (res) Logger_Abort2(res, "Signalling event");
}
void Waitable_Wait(void* handle) {
struct WaitData* ptr = handle;
struct WaitData* ptr = (struct WaitData*)handle;
int res;
Mutex_Lock(&ptr->mutex);
@ -801,7 +801,7 @@ void Waitable_Wait(void* handle) {
}
void Waitable_WaitFor(void* handle, uint32_t milliseconds) {
struct WaitData* ptr = handle;
struct WaitData* ptr = (struct WaitData*)handle;
struct timeval tv;
struct timespec ts;
int res;
@ -839,7 +839,7 @@ static void Font_Init(void);
#define DPI_PIXEL 72
#define DPI_DEVICE 96 /* TODO: GetDeviceCaps(hdc, LOGPIXELSY) in Window_Init ? */
typedef struct FontData_ {
struct FontData {
FT_Face face;
struct Stream src, file;
FT_StreamRec stream;
@ -850,21 +850,21 @@ typedef struct FontData_ {
#ifdef CC_BUILD_OSX
char filename[FILENAME_SIZE + 1];
#endif
} FontData;
};
static unsigned long FontData_Read(FT_Stream s, unsigned long offset, unsigned char* buffer, unsigned long count) {
FontData* data;
struct FontData* data;
ReturnCode res;
if (!count && offset > s->size) return 1;
data = (FontData*)s->descriptor.pointer;
data = (struct FontData*)s->descriptor.pointer;
if (s->pos != offset) data->src.Seek(&data->src, offset);
res = Stream_Read(&data->src, buffer, count);
return res ? 0 : count;
}
static void FontData_Free(FontData* font) {
static void FontData_Free(struct FontData* font) {
int i;
/* Close the actual underlying file */
@ -883,11 +883,11 @@ static void FontData_Free(FontData* font) {
}
static void FontData_Close(FT_Stream stream) {
FontData* data = (FontData*)stream->descriptor.pointer;
struct FontData* data = (struct FontData*)stream->descriptor.pointer;
FontData_Free(data);
}
static bool FontData_Init(const String* path, FontData* data, FT_Open_Args* args) {
static bool FontData_Init(const String* path, struct FontData* data, FT_Open_Args* args) {
FileHandle file;
uint32_t size;
@ -962,7 +962,7 @@ String Font_Lookup(const String* fontName, int style) {
}
void Font_Make(FontDesc* desc, const String* fontName, int size, int style) {
FontData* data;
struct FontData* data;
String value, path, index;
int faceIndex;
FT_Open_Args args;
@ -976,7 +976,7 @@ void Font_Make(FontDesc* desc, const String* fontName, int size, int style) {
String_UNSAFE_Separate(&value, ',', &path, &index);
Convert_ParseInt(&index, &faceIndex);
data = (FontData*)Mem_Alloc(1, sizeof(FontData), "FontData");
data = (struct FontData*)Mem_Alloc(1, sizeof(struct FontData), "FontData");
if (!FontData_Init(&path, data, &args)) return;
desc->Handle = data;
@ -987,7 +987,7 @@ void Font_Make(FontDesc* desc, const String* fontName, int size, int style) {
}
void Font_Free(FontDesc* desc) {
FontData* data;
struct FontData* data;
FT_Error err;
desc->Size = 0;
@ -995,7 +995,7 @@ void Font_Free(FontDesc* desc) {
/* NULL for fonts created by Drawer2D_MakeFont and bitmapped text mode is on */
if (!desc->Handle) return;
data = (FontData*)desc->Handle;
data = (struct FontData*)desc->Handle;
err = FT_Done_Face(data->face);
if (err) Logger_Abort2(err, "Deleting font failed");
@ -1031,7 +1031,7 @@ static void Font_Add(const String* path, FT_Face face, int index, char type, con
}
static int Font_Register(const String* path, int faceIndex) {
FontData data;
struct FontData data;
FT_Open_Args args;
FT_Error err;
int flags, count;
@ -1084,7 +1084,7 @@ static void Font_DirCallback(const String* path, void* obj) {
#define TEXT_CEIL(x) (((x) + 63) >> 6)
int Platform_TextWidth(struct DrawTextArgs* args) {
FontData* data = (FontData*)args->Font.Handle;
struct FontData* data = (struct FontData*)args->Font.Handle;
FT_Face face = data->face;
String text = args->Text;
int i, width = 0, charWidth;
@ -1113,7 +1113,7 @@ int Platform_TextWidth(struct DrawTextArgs* args) {
}
int Platform_FontHeight(const FontDesc* font) {
FontData* data = (FontData*)font->Handle;
struct FontData* data = (struct FontData*)font->Handle;
FT_Face face = data->face;
return TEXT_CEIL(face->size->metrics.height);
}
@ -1167,7 +1167,7 @@ static void Platform_BlackWhiteGlyph(FT_Bitmap* img, Bitmap* bmp, int x, int y,
}
int Platform_TextDraw(struct DrawTextArgs* args, Bitmap* bmp, int x, int y, BitmapCol col, bool shadow) {
FontData* data = (FontData*)args->Font.Handle;
struct FontData* data = (struct FontData*)args->Font.Handle;
FT_Face face = data->face;
String text = args->Text;
FT_Glyph* glyphs = data->glyphs;
@ -1815,7 +1815,7 @@ static String Platform_NextArg(STRING_REF String* args) {
return arg;
}
int Platform_GetCommandLineArgs(int argc, STRING_REF const char** argv, String* args) {
int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, String* args) {
String cmdArgs = String_FromReadonly(GetCommandLineA());
int i;
Platform_NextArg(&cmdArgs); /* skip exe path */
@ -1919,7 +1919,7 @@ ReturnCode Platform_MarkExecutable(const String* path) {
return chmod(str, st.st_mode) == -1 ? errno : 0;
}
int Platform_GetCommandLineArgs(int argc, STRING_REF const char** argv, String* args) {
int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, String* args) {
int i, count;
argc--; /* skip executable path argument */
count = min(argc, GAME_MAX_CMDARGS);

View File

@ -50,7 +50,7 @@ CC_API ReturnCode Platform_SetCurrentDirectory(const String* path);
CC_API ReturnCode Platform_MarkExecutable(const String* path);
/* Gets the command line arguments passed to the program. */
int Platform_GetCommandLineArgs(int argc, STRING_REF const char** argv, String* args);
int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, String* args);
/* Encrypts data in a platform-specific manner. (may not be supported) */
/* NOTE: Should only be implemented when platform natively supports it. */
ReturnCode Platform_Encrypt(const void* data, int len, uint8_t** enc, int* encLen);

View File

@ -91,7 +91,7 @@ void World_SetBlock(int x, int y, int z, BlockID block) {
/* defer allocation of second map array if possible */
if (World.Blocks == World.Blocks2) {
if (block < 256) return;
World_SetMapUpper(Mem_AllocCleared(World.Volume, 1, "blocks array upper"));
World_SetMapUpper((BlockRaw*)Mem_AllocCleared(World.Volume, 1, "map blocks upper"));
}
World.Blocks2[i] = (BlockRaw)(block >> 8);
}