From 0f67e93a0fd26b2ee50a920dbb5559db41ea0294 Mon Sep 17 00:00:00 2001 From: Corysia Taware Date: Sat, 5 Apr 2014 10:24:28 -0700 Subject: [PATCH] Backward port to OSX 10.6 (Snow Leopard) --- common/ipc_mutex.cpp | 11 +++++++++-- zone/client_packet.cpp | 26 +++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/common/ipc_mutex.cpp b/common/ipc_mutex.cpp index 1ac88538c..331144eca 100644 --- a/common/ipc_mutex.cpp +++ b/common/ipc_mutex.cpp @@ -55,10 +55,17 @@ namespace EQEmu { std::string final_name = name; final_name += ".lock"; +#ifdef __DARWIN +#if __DARWIN_C_LEVEL < 200809L imp_->fd_ = open(final_name.c_str(), - O_RDWR | O_CREAT | O_CLOEXEC, + O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - +#else + imp_->fd_ = open(final_name.c_str(), + O_RDWR | O_CREAT | O_CLOEXEC, + S_IRUSR | S_IWUSR); +#endif +#endif if(imp_->fd_ == -1) { EQ_EXCEPT("IPC Mutex", "Could not create mutex."); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cde2b143f..0a50d8cdc 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12483,7 +12483,15 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) // char *GuildName = (char *)app->pBuffer; +#ifdef DARWIN +#if __DARWIN_C_LEVEL < 200809L + if (strlen(GuildName) > 60) +#else if(strnlen(GuildName, 64) > 60) +#endif // __DARWIN_C_LEVEL +#else + if(strnlen(GuildName, 64) > 60) +#endif // DARWIN { Message(clientMessageError, "Guild name too long."); return; @@ -12941,7 +12949,15 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_PlayerToggle_Struct); LFGuild_PlayerToggle_Struct *pts = (LFGuild_PlayerToggle_Struct *)app->pBuffer; +#ifdef DARWIN +#if __DARWIN_C_LEVEL < 200809L + if (strlen(pts->Comment) > 256) +#else if(strnlen(pts->Comment, 256) > 256) +#endif // __DARWIN_C_LEVEL +#else + if(strnlen(pts->Comment, 256) > 256) +#endif // DARWIN return; ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + strlen(pts->Comment) + 38); @@ -12968,7 +12984,15 @@ void Client::Handle_OP_LFGuild(const EQApplicationPacket *app) VERIFY_PACKET_LENGTH(OP_LFGuild, app, LFGuild_GuildToggle_Struct); LFGuild_GuildToggle_Struct *gts = (LFGuild_GuildToggle_Struct *)app->pBuffer; - if(strnlen(gts->Comment, 256) > 256) +#ifdef DARWIN +#if __DARWIN_C_LEVEL < 200809L + if (strlen(gts->Comment) > 256) +#else + if(strnlen(gts->Comment, 256) > 256) +#endif // __DARWIN_C_LEVEL +#else + if(strnlen(gts->Comment, 256) > 256) +#endif // __DARWIN return; ServerPacket* pack = new ServerPacket(ServerOP_QueryServGeneric, strlen(GetName()) + strlen(gts->Comment) + strlen(guild_mgr.GetGuildName(GuildID())) + 43);