Fix most compiler warnings and fix for OSX.

This commit is contained in:
Zach Langley 2014-11-07 20:13:36 -08:00
parent a61c2c6c60
commit eadcd45b6e
6 changed files with 15 additions and 8 deletions

View file

@ -669,9 +669,16 @@ static int get_max_players(void)
/* set the current to the maximum */ /* set the current to the maximum */
limit.rlim_cur = limit.rlim_max; limit.rlim_cur = limit.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) { if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
#if defined(__APPLE__) && defined(RLIMIT_NOFILE) && defined(OPEN_MAX)
/* On OS X, setting rlim_cur above OPEN_MAX fails, so try again
* with OPEN_MAX. */
limit.rlim_cur = OPEN_MAX;
#endif
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
perror("SYSERR: calling setrlimit"); perror("SYSERR: calling setrlimit");
exit(1); exit(1);
} }
}
#ifdef RLIM_INFINITY #ifdef RLIM_INFINITY
if (limit.rlim_max == RLIM_INFINITY) if (limit.rlim_max == RLIM_INFINITY)
max_descs = CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS; max_descs = CONFIG_MAX_PLAYING + NUM_RESERVED_DESCS;

View file

@ -207,7 +207,7 @@ static void hedit_disp_menu(struct descriptor_data *d)
void hedit_parse(struct descriptor_data *d, char *arg) void hedit_parse(struct descriptor_data *d, char *arg)
{ {
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
char *oldtext = '\0'; char *oldtext = "";
int number; int number;
switch (OLC_MODE(d)) { switch (OLC_MODE(d)) {

View file

@ -971,7 +971,7 @@ void mag_rooms(int level, struct char_data *ch, int spellnum)
room_rnum rnum; room_rnum rnum;
int duration; int duration;
bool failure = FALSE; bool failure = FALSE;
event_id IdNum = -1; event_id IdNum = eNULL;
const char *msg = NULL; const char *msg = NULL;
const char *room = NULL; const char *room = NULL;
@ -995,7 +995,7 @@ void mag_rooms(int level, struct char_data *ch, int spellnum)
} }
if (failure || (event_id)IdNum == -1) { if (failure || IdNum == eNULL) {
send_to_char(ch, "You failed!\r\n"); send_to_char(ch, "You failed!\r\n");
return; return;
} }

View file

@ -474,7 +474,7 @@ void page_string(struct descriptor_data *d, char *str, int keep_internal)
if (!str || !*str) if (!str || !*str)
return; return;
if ((GET_PAGE_LENGTH(d->character) < 5 || GET_PAGE_LENGTH(d->character) > 255)) if (GET_PAGE_LENGTH(d->character) < 5)
GET_PAGE_LENGTH(d->character) = PAGE_LENGTH; GET_PAGE_LENGTH(d->character) = PAGE_LENGTH;
d->showstr_count = count_pages(str, d->character); d->showstr_count = count_pages(str, d->character);
CREATE(d->showstr_vector, char *, d->showstr_count); CREATE(d->showstr_vector, char *, d->showstr_count);

View file

@ -1184,7 +1184,8 @@ static int Crash_load_objs(struct char_data *ch) {
int i, num_of_days, orig_rent_code, num_objs=0; int i, num_of_days, orig_rent_code, num_objs=0;
unsigned long cost; unsigned long cost;
struct obj_data *cont_row[MAX_BAG_ROWS]; struct obj_data *cont_row[MAX_BAG_ROWS];
int rentcode,timed,netcost,gold,account,nitems; int rentcode = RENT_UNDEF;
int timed,netcost,gold,account,nitems;
obj_save_data *loaded, *current; obj_save_data *loaded, *current;
if (!get_filename(filename, sizeof(filename), CRASH_FILE, GET_NAME(ch))) if (!get_filename(filename, sizeof(filename), CRASH_FILE, GET_NAME(ch)))

View file

@ -12,7 +12,6 @@
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#include "protocol.h" #include "protocol.h"
#include <malloc.h>
/****************************************************************************** /******************************************************************************
The following section is for Diku/Merc derivatives. Replace as needed. The following section is for Diku/Merc derivatives. Replace as needed.