Merge pull request #13 from zlangley/warnings

Fix most compiler warnings and fix for OSX.
This commit is contained in:
Rumble 2014-11-07 20:44:15 -08:00
commit 4e27091e57
6 changed files with 15 additions and 8 deletions

View file

@ -669,8 +669,15 @@ static int get_max_players(void)
/* set the current to the maximum */
limit.rlim_cur = limit.rlim_max;
if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
perror("SYSERR: calling setrlimit");
exit(1);
#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");
exit(1);
}
}
#ifdef RLIM_INFINITY
if (limit.rlim_max == RLIM_INFINITY)

View file

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

View file

@ -971,7 +971,7 @@ void mag_rooms(int level, struct char_data *ch, int spellnum)
room_rnum rnum;
int duration;
bool failure = FALSE;
event_id IdNum = -1;
event_id IdNum = eNULL;
const char *msg = 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");
return;
}

View file

@ -474,7 +474,7 @@ void page_string(struct descriptor_data *d, char *str, int keep_internal)
if (!str || !*str)
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;
d->showstr_count = count_pages(str, d->character);
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;
unsigned long cost;
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;
if (!get_filename(filename, sizeof(filename), CRASH_FILE, GET_NAME(ch)))

View file

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