Skip to content

Commit

Permalink
-- fixed various bugs related to the new way in which the new xcode c…
Browse files Browse the repository at this point in the history
…ompiler is reporting errors

git-svn-id: https://svn.rtmpd.com/crtmpserver/trunk@759 01689507-d990-df11-9d7d-0017a411d416
  • Loading branch information
shiretu committed Mar 22, 2012
1 parent c225c27 commit c50b8bb
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 80 deletions.
2 changes: 1 addition & 1 deletion builders/cmake/cmake_find_modules/pch_support.cmake
Expand Up @@ -67,7 +67,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input )
IF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-I${_outdir} -include ${_name}")
ELSE (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-I${_outdir} -include ${_name} -Winvalid-pch")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-I${_outdir} -include ${_name}.h -Winvalid-pch")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
ENDMACRO(ADD_PRECOMPILED_HEADER)

3 changes: 3 additions & 0 deletions sources/common/include/platform/osx/osxplatform.h
Expand Up @@ -59,6 +59,9 @@
#include <vector>
using namespace std;

#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"

//platform defines
#define DLLEXP
#define HAS_MMAP 1
Expand Down
2 changes: 1 addition & 1 deletion sources/common/src/utils/lua/luautils.cpp
Expand Up @@ -315,7 +315,7 @@ bool PushVariant(lua_State *pLuaState,
}
default:
{
FATAL("Unknown type %hhu", (VariantType) variant);
FATAL("Unknown type %d", (VariantType) variant);
return false;
break;
}
Expand Down
57 changes: 29 additions & 28 deletions sources/common/src/utils/misc/mmapfile.cpp
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
Expand Down Expand Up @@ -32,34 +32,11 @@
map<string, __FileInfo__ > MmapFile::_fds;
int32_t MmapFile::_pageSize = 0;

MmapFile::MmapFile() {
_cursor = 0;
_size = 0;
_failed = false;
if (_pageSize == 0) {
_pageSize = getpagesize();
LOG_MMAP("_pageSize: %u", _pageSize);
}
_windowSize = 0;
memset(&_pointer1, 0, sizeof (MmapPointer));
memset(&_pointer2, 0, sizeof (MmapPointer));
}

MmapFile::~MmapFile() {
_pointer1.Free();
_pointer2.Free();

if (MAP_HAS1(_fds, _path)) {
_fds[_path].useCount = _fds[_path].useCount - 1;
if (_fds[_path].useCount == 0) {
close(_fds[_path].fd);
_fds.erase(_path);
}
}
}

MmapPointer::MmapPointer() {

_pData = NULL;
_size = 0;
_cursor = 0;
_bytesRead = 0;
}

MmapPointer::~MmapPointer() {
Expand Down Expand Up @@ -151,6 +128,30 @@ MmapPointer::operator string() {
return format("[%"PRIu64" - %"PRIu64"](%u)", _cursor, _cursor + _size - 1, _size);
}

MmapFile::MmapFile() {
_cursor = 0;
_size = 0;
_failed = false;
if (_pageSize == 0) {
_pageSize = getpagesize();
LOG_MMAP("_pageSize: %u", _pageSize);
}
_windowSize = 0;
}

MmapFile::~MmapFile() {
_pointer1.Free();
_pointer2.Free();

if (MAP_HAS1(_fds, _path)) {
_fds[_path].useCount = _fds[_path].useCount - 1;
if (_fds[_path].useCount == 0) {
close(_fds[_path].fd);
_fds.erase(_path);
}
}
}

bool MmapFile::Initialize(string path, uint32_t windowSize, bool exclusive) {
//1. Do we have this file open?
LOG_MMAP("Initial window size: %u", windowSize);
Expand Down
10 changes: 5 additions & 5 deletions sources/common/src/utils/misc/variant.cpp
Expand Up @@ -361,7 +361,7 @@ string Variant::ToString(string name, uint32_t indent) {
}
default:
{
FATAL("Invalid type: %hhu", _type);
FATAL("Invalid type: %d", _type);
o_assert(false);
}
}
Expand Down Expand Up @@ -1424,7 +1424,7 @@ bool Variant::SerializeToBin(string &result) {
default:
{
result = "";
FATAL("Invalid variant type: %hhu", _type);
FATAL("Invalid variant type: %d", _type);
return false;
}
}
Expand Down Expand Up @@ -1755,7 +1755,7 @@ bool Variant::SerializeToJSON(string &result) {
}
default:
{
ASSERT("Invalid type %hhu", _type);
ASSERT("Invalid type %d", _type);
break;
}
}
Expand Down Expand Up @@ -1915,7 +1915,7 @@ TiXmlElement *Variant::SerializeToXmlElement(string &name) {
}
default:
{
ASSERT("Invalid type: %hhu", _type);
ASSERT("Invalid type: %d", _type);
return NULL;
}
}
Expand Down Expand Up @@ -2112,7 +2112,7 @@ bool Variant::DeserializeFromBin(uint8_t *pBuffer, uint32_t bufferSize,
}
default:
{
FATAL("Invalid variant type: %hhu", type);
FATAL("Invalid variant type: %d", type);
return false;
}
}
Expand Down
58 changes: 29 additions & 29 deletions sources/thelib/include/protocols/rtmp/amftypes.h
@@ -1,18 +1,18 @@
/*
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* crtmpserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -44,32 +44,32 @@
AMF0_P_NS_Int32 = 0xf1,
AMF0_P_uninitialized = 0xff*/

#define AMF0_NUMBER 0x00
#define AMF0_BOOLEAN 0x01
#define AMF0_SHORT_STRING 0x02
#define AMF0_OBJECT 0x03
#define AMF0_NULL 0x05
#define AMF0_UNDEFINED 0x06
#define AMF0_MIXED_ARRAY 0x08
#define AMF0_ARRAY 0x0a
#define AMF0_TIMESTAMP 0x0b
#define AMF0_LONG_STRING 0x0c
#define AMF0_TYPED_OBJECT 0x10
#define AMF0_AMF3_OBJECT 0x11
#define AMF0_NUMBER ((uint8_t)0x00)
#define AMF0_BOOLEAN ((uint8_t)0x01)
#define AMF0_SHORT_STRING ((uint8_t)0x02)
#define AMF0_OBJECT ((uint8_t)0x03)
#define AMF0_NULL ((uint8_t)0x05)
#define AMF0_UNDEFINED ((uint8_t)0x06)
#define AMF0_MIXED_ARRAY ((uint8_t)0x08)
#define AMF0_ARRAY ((uint8_t)0x0a)
#define AMF0_TIMESTAMP ((uint8_t)0x0b)
#define AMF0_LONG_STRING ((uint8_t)0x0c)
#define AMF0_TYPED_OBJECT ((uint8_t)0x10)
#define AMF0_AMF3_OBJECT ((uint8_t)0x11)

#define AMF3_UNDEFINED 0x00
#define AMF3_NULL 0x01
#define AMF3_FALSE 0x02
#define AMF3_TRUE 0x03
#define AMF3_INTEGER 0x04
#define AMF3_DOUBLE 0x05
#define AMF3_STRING 0x06
#define AMF3_XMLDOC 0x07
#define AMF3_DATE 0x08
#define AMF3_ARRAY 0x09
#define AMF3_OBJECT 0x0a
#define AMF3_XML 0x0b
#define AMF3_BYTEARRAY 0x0c
#define AMF3_UNDEFINED ((uint8_t)0x00)
#define AMF3_NULL ((uint8_t)0x01)
#define AMF3_FALSE ((uint8_t)0x02)
#define AMF3_TRUE ((uint8_t)0x03)
#define AMF3_INTEGER ((uint8_t)0x04)
#define AMF3_DOUBLE ((uint8_t)0x05)
#define AMF3_STRING ((uint8_t)0x06)
#define AMF3_XMLDOC ((uint8_t)0x07)
#define AMF3_DATE ((uint8_t)0x08)
#define AMF3_ARRAY ((uint8_t)0x09)
#define AMF3_OBJECT ((uint8_t)0x0a)
#define AMF3_XML ((uint8_t)0x0b)
#define AMF3_BYTEARRAY ((uint8_t)0x0c)

#define AMF_CHECK_BOUNDARIES(x,y) \
do { \
Expand Down
6 changes: 3 additions & 3 deletions sources/thelib/src/mediaformats/mp4/mp4document.cpp
Expand Up @@ -577,7 +577,7 @@ bool MP4Document::BuildMOOVFrames(bool audio) {
compositionOffsets.size());
}
}
INFO("audio: %hhu; keyFrames: %"PRIz"u; frames: %"PRIz"u; compositionOffsets: %"PRIz"u",
INFO("audio: %d; keyFrames: %"PRIz"u; frames: %"PRIz"u; compositionOffsets: %"PRIz"u",
audio, keyFrames.size(), sampleSize.size(), compositionOffsets.size());

uint32_t timeScale = pMDHD->GetTimeScale();
Expand Down Expand Up @@ -743,12 +743,12 @@ string MP4Document::Hierarchy() {
AtomTRAK * MP4Document::GetTRAK(bool audio) {
if (_pMOOV == NULL) {
FATAL("Unable to find moov");
return false;
return NULL;
}
vector<AtomTRAK *> tracks = _pMOOV->GetTracks();
if (tracks.size() == 0) {
FATAL("No tracks defined");
return false;
return NULL;
}
for (uint32_t i = 0; i < tracks.size(); i++) {
AtomHDLR *pHDLR = (AtomHDLR *) tracks[i]->GetPath(2, A_MDIA, A_HDLR);
Expand Down
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
Expand Down Expand Up @@ -48,7 +48,7 @@ bool InboundLiveFLVProtocol::Initialize(Variant &parameters) {
_waitForMetadata = (bool)parameters["waitForMetadata"];
else
_waitForMetadata = false;
FINEST("_waitForMetadata: %hhu", _waitForMetadata);
FINEST("_waitForMetadata: %d", _waitForMetadata);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion sources/thelib/src/protocols/rtmp/amf3serializer.cpp
Expand Up @@ -164,7 +164,7 @@ bool AMF3Serializer::Write(IOBuffer &buffer, Variant &variant) {
}
default:
{
FATAL("Unable to serialize type %hhu; variant is:\n%s",
FATAL("Unable to serialize type %d; variant is:\n%s",
(VariantType) variant, STR(variant.ToString()));
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion sources/thelib/src/protocols/rtmp/inboundhttp4rtmp.cpp
Expand Up @@ -143,7 +143,7 @@ BaseProtocol *InboundHTTP4RTMP::Bind(string sid) {
//14. This might be a new connection. Do we have that sid generated?
if (!MAP_HAS1(_generatedSids, sid)) {
FATAL("Invalid sid: %s", STR(sid));
return false;
return NULL;
}

//15. See if we have to generate a new connection or we just pick up
Expand Down
2 changes: 1 addition & 1 deletion sources/thelib/src/protocols/rtmp/inboundrtmpprotocol.cpp
Expand Up @@ -112,7 +112,7 @@ bool InboundRTMPProtocol::PerformHandshake(IOBuffer &buffer) {
}
default:
{
FATAL("Invalid RTMP state: %hhu", _rtmpState);
FATAL("Invalid RTMP state: %d", _rtmpState);
return false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions sources/thelib/src/protocols/rtmp/outboundrtmpprotocol.cpp
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
Expand Down Expand Up @@ -122,7 +122,7 @@ bool OutboundRTMPProtocol::PerformHandshake(IOBuffer &buffer) {
}
default:
{
FATAL("Invalid RTMP state: %hhu", _rtmpState);
FATAL("Invalid RTMP state: %d", _rtmpState);
return false;
}
}
Expand Down
Expand Up @@ -261,7 +261,7 @@ InFileRTMPStream *InFileRTMPStream::GetInstance(BaseRTMPProtocol *pRTMPProtocol,
metadata[META_RTMP_META][HTTP_HEADERS_SERVER] = HTTP_HEADERS_SERVER_US;
if (!fileExists(metadata[META_SERVER_FULL_PATH])) {
FATAL("File not found. fullPath: `%s`", STR(metadata[META_SERVER_FULL_PATH]));
return false;
return NULL;
}

InFileRTMPStream *pResult = NULL;
Expand Down
4 changes: 2 additions & 2 deletions sources/thelib/src/protocols/rtp/rtspprotocol.cpp
Expand Up @@ -372,14 +372,14 @@ OutboundConnectivity * RTSPProtocol::GetOutboundConnectivity(
_pOutboundConnectivity = new OutboundConnectivity(forceTcp, this);
if (!_pOutboundConnectivity->Initialize()) {
FATAL("Unable to initialize outbound connectivity");
return false;
return NULL;
}
pOutStream->SetConnectivity(_pOutboundConnectivity);
_pOutboundConnectivity->SetOutStream(pOutStream);

if (!pInNetStream->Link(pOutStream)) {
FATAL("Unable to link streams");
return false;
return NULL;
}
}

Expand Down
Expand Up @@ -236,7 +236,7 @@ bool InNetRTPStream::FeedData(uint8_t *pData, uint32_t dataLength,
}

if (lastTs * 100.00 > absoluteTimestamp * 100.00) {
WARN("Back time on %s. ATS: %.08f LTS: %.08f; D: %.8f; isAudio: %"PRIu8,
WARN("Back time on %s. ATS: %.08f LTS: %.08f; D: %.8f; isAudio: %d",
STR(GetName()),
absoluteTimestamp,
lastTs,
Expand Down
4 changes: 2 additions & 2 deletions sources/thelib/src/protocols/ts/inboundtsprotocol.cpp
@@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
Expand Down Expand Up @@ -292,7 +292,7 @@ bool InboundTSProtocol::ProcessPacket(uint32_t packetHeader,
}
default:
{
WARN("PID type not implemented: %hhu. Pid number: %hu",
WARN("PID type not implemented: %d. Pid number: %"PRIu16,
pPIDDescriptor->type, pPIDDescriptor->pid);
return false;
}
Expand Down

0 comments on commit c50b8bb

Please sign in to comment.