Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumblekit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2014-04-06 20:04:22 +0400
committerMikkel Krautz <mikkel@krautz.dk>2014-04-06 20:04:22 +0400
commit95b46a572eddfd23b5f08dbfc4e859d36c7124b8 (patch)
tree4342848e9004e1738bec42c6f75025499c31cfc5
parent0d753bceb48025c85f05f2ccc2de417ed7b7d6fb (diff)
MumbleKit: build on arm64.
-rw-r--r--3rdparty/celt-0.7.0-build/Base.xcconfig2
-rw-r--r--3rdparty/opensslbuild/Base.xcconfig2
-rw-r--r--3rdparty/opusbuild/Base.xcconfig2
-rw-r--r--3rdparty/protobufbuild/Base.xcconfig2
-rw-r--r--3rdparty/speexbuild/Base.xcconfig2
-rw-r--r--3rdparty/speexdspbuild/Base.xcconfig2
-rw-r--r--cfg/Base.xcconfig2
-rw-r--r--src/MKAudioInput.m10
-rw-r--r--src/MKAudioOutput.m6
-rw-r--r--src/MKAudioOutputSpeech.m65
-rw-r--r--src/MKCertificate.m24
-rw-r--r--src/MKChannelACL.m2
-rw-r--r--src/MKConnection.m9
-rw-r--r--src/MKCryptState_openssl.mm12
-rw-r--r--src/MKPacketDataStream.m4
-rw-r--r--src/MKServerModel.m32
-rw-r--r--src/MKServerPinger.m4
-rw-r--r--src/MKTextMessage.m2
-rw-r--r--src/MKVoiceProcessingDevice.m2
19 files changed, 110 insertions, 76 deletions
diff --git a/3rdparty/celt-0.7.0-build/Base.xcconfig b/3rdparty/celt-0.7.0-build/Base.xcconfig
index ce41b9b..3f386b1 100644
--- a/3rdparty/celt-0.7.0-build/Base.xcconfig
+++ b/3rdparty/celt-0.7.0-build/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/3rdparty/opensslbuild/Base.xcconfig b/3rdparty/opensslbuild/Base.xcconfig
index c4b1503..5773295 100644
--- a/3rdparty/opensslbuild/Base.xcconfig
+++ b/3rdparty/opensslbuild/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/3rdparty/opusbuild/Base.xcconfig b/3rdparty/opusbuild/Base.xcconfig
index 9b87316..4a487df 100644
--- a/3rdparty/opusbuild/Base.xcconfig
+++ b/3rdparty/opusbuild/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/3rdparty/protobufbuild/Base.xcconfig b/3rdparty/protobufbuild/Base.xcconfig
index 381a424..5b83147 100644
--- a/3rdparty/protobufbuild/Base.xcconfig
+++ b/3rdparty/protobufbuild/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/3rdparty/speexbuild/Base.xcconfig b/3rdparty/speexbuild/Base.xcconfig
index 1acdb81..2170c9c 100644
--- a/3rdparty/speexbuild/Base.xcconfig
+++ b/3rdparty/speexbuild/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/3rdparty/speexdspbuild/Base.xcconfig b/3rdparty/speexdspbuild/Base.xcconfig
index 375064f..7965530 100644
--- a/3rdparty/speexdspbuild/Base.xcconfig
+++ b/3rdparty/speexdspbuild/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/cfg/Base.xcconfig b/cfg/Base.xcconfig
index f76c9ea..3bfc75e 100644
--- a/cfg/Base.xcconfig
+++ b/cfg/Base.xcconfig
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-ARCHS = armv7
+ARCHS = armv7 arm64
SDKROOT = iphoneos
MACOSX_DEPLOYMENT_TARGET = 10.7
diff --git a/src/MKAudioInput.m b/src/MKAudioInput.m
index d2b6ad7..661d7f1 100644
--- a/src/MKAudioInput.m
+++ b/src/MKAudioInput.m
@@ -239,7 +239,7 @@
int i;
while (nsamp > 0) {
- unsigned int left = MIN(nsamp, micLength - micFilled);
+ NSUInteger left = MIN(nsamp, micLength - micFilled);
short *output = psMic + micFilled;
@@ -311,7 +311,7 @@
speex_preprocess_ctl(state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
}
-- (int) encodeAudioFrameOfSpeech:(BOOL)isSpeech intoBuffer:(unsigned char *)encbuf ofSize:(int)max {
+- (int) encodeAudioFrameOfSpeech:(BOOL)isSpeech intoBuffer:(unsigned char *)encbuf ofSize:(NSUInteger)max {
int len = 0;
int encoded = 1;
BOOL resampled = micFrequency != sampleRate;
@@ -357,7 +357,7 @@
}
opus_encoder_ctl(_opusEncoder, OPUS_SET_BITRATE(_settings.quality));
- len = opus_encode(_opusEncoder, (short *) [_opusBuffer bytes], _bufferedFrames * frameSize, encbuf, max);
+ len = opus_encode(_opusEncoder, (short *) [_opusBuffer bytes], (opus_int32)(_bufferedFrames * frameSize), encbuf, (opus_int32)max);
[_opusBuffer setLength:0];
if (len <= 0) {
bitrate = 0;
@@ -397,7 +397,7 @@
msgType = preferAlpha ? UDPVoiceCELTBetaMessage : UDPVoiceCELTAlphaMessage;
}
if (msgType != udpMessageType) {
- udpMessageType = msgType;
+ udpMessageType = (MKUDPMessageType)msgType;
}
}
}
@@ -585,7 +585,7 @@
[pds appendBytes:(unsigned char *)[frame bytes] length:[frame length]];
} else {
/* fix terminator stuff here. */
- int i, nframes = [frameList count];
+ NSUInteger i, nframes = [frameList count];
for (i = 0; i < nframes; i++) {
NSData *frame = [frameList objectAtIndex:i];
unsigned char head = (unsigned char)[frame length];
diff --git a/src/MKAudioOutput.m b/src/MKAudioOutput.m
index b96ae52..5b684d9 100644
--- a/src/MKAudioOutput.m
+++ b/src/MKAudioOutput.m
@@ -252,7 +252,7 @@
- (void) removeBuffer:(MKAudioOutputUser *)u {
if ([u respondsToSelector:@selector(userSession)]) {
[_outputLock lock];
- [_outputs removeObjectForKey:[NSNumber numberWithUnsignedInt:[(id)u userSession]]];
+ [_outputs removeObjectForKey:[NSNumber numberWithUnsignedInteger:[(id)u userSession]]];
[_outputLock unlock];
}
}
@@ -262,7 +262,7 @@
return;
[_outputLock lock];
- MKAudioOutputSpeech *outputUser = [_outputs objectForKey:[NSNumber numberWithUnsignedInt:session]];
+ MKAudioOutputSpeech *outputUser = [_outputs objectForKey:[NSNumber numberWithUnsignedInteger:session]];
[outputUser retain];
[_outputLock unlock];
@@ -273,7 +273,7 @@
}
outputUser = [[MKAudioOutputSpeech alloc] initWithSession:session sampleRate:_mixerFrequency messageType:msgType];
[_outputLock lock];
- [_outputs setObject:outputUser forKey:[NSNumber numberWithUnsignedInt:session]];
+ [_outputs setObject:outputUser forKey:[NSNumber numberWithUnsignedInteger:session]];
[_outputLock unlock];
}
diff --git a/src/MKAudioOutputSpeech.m b/src/MKAudioOutputSpeech.m
index 3b867df..42ebf4b 100644
--- a/src/MKAudioOutputSpeech.m
+++ b/src/MKAudioOutputSpeech.m
@@ -84,7 +84,7 @@
_sampleRate = SAMPLE_RATE;
_frameSize = _sampleRate / 100;
_audioBufferSize = 12 * _frameSize;
- _opusDecoder = opus_decoder_create(_sampleRate, _useStereo ? 2 : 1, NULL);
+ _opusDecoder = opus_decoder_create((opus_int32)_sampleRate, _useStereo ? 2 : 1, NULL);
} else if (type == UDPVoiceSpeexMessage) {
_sampleRate = 32000;
speex_bits_init(&_speexBits);
@@ -110,9 +110,9 @@
if (_freq != _sampleRate) {
int err;
- _resampler = speex_resampler_init(_useStereo ? 2 : 1, _sampleRate, _freq, 3, &err);
+ _resampler = speex_resampler_init(_useStereo ? 2 : 1, (spx_uint32_t)_sampleRate, (spx_uint32_t)_freq, 3, &err);
_resamplerBuffer = malloc(sizeof(float)*_audioBufferSize);
- NSLog(@"AudioOutputSpeech: Resampling from %i Hz to %d Hz", _sampleRate, _freq);
+ NSLog(@"AudioOutputSpeech: Resampling from %lu Hz to %lu Hz", (unsigned long)_sampleRate, (unsigned long)_freq);
}
_bufferOffset = 0;
@@ -127,9 +127,9 @@
_flags = 0xff;
_jitterLock = [[NSLock alloc] init];
- _jitter = jitter_buffer_init(_frameSize);
+ _jitter = jitter_buffer_init((int)_frameSize);
- int margin = /* g.s.iJitterBufferSize */ 10 * _frameSize;
+ int margin = /* g.s.iJitterBufferSize */ 10 * (int)_frameSize;
jitter_buffer_ctl(_jitter, JITTER_BUFFER_SET_MARGIN, &margin);
_fadeIn = malloc(sizeof(float) * _frameSize);
@@ -195,13 +195,13 @@
MKPacketDataStream *pds = [[MKPacketDataStream alloc] initWithData:data];
[pds next];
- int samples = 0;
+ NSUInteger samples = 0;
if (_msgType == UDPVoiceOpusMessage) {
uint64_t header = [pds getVarint];
- NSUInteger size = (header & ((1 << 13) - 1));
+ opus_uint32 size = (header & ((1 << 13) - 1));
if (size > 0) {
NSData *opusFrames = [pds copyDataBlock:size];
- if ([opusFrames length] != size || ![pds valid]) {
+ if ([opusFrames length] != (NSUInteger)size || ![pds valid]) {
[pds release];
[_jitterLock unlock];
return;
@@ -229,13 +229,16 @@
return;
}
- JitterBufferPacket jbp;
- jbp.data = (char *)[data bytes];
- jbp.len = [data length];
- jbp.span = samples;
- jbp.timestamp = _frameSize * seq;
+ if ([data length] <= UINT32_MAX) {
+ JitterBufferPacket jbp;
+ jbp.data = (char *)[data bytes];
+ jbp.len = (spx_uint32_t)[data length];
+ jbp.span = (spx_uint32_t)samples;
+ jbp.timestamp = (spx_uint32_t)_frameSize * (spx_uint32_t)seq;
+
+ jitter_buffer_put(_jitter, &jbp);
+ }
- jitter_buffer_put(_jitter, &jbp);
[pds release];
[_jitterLock unlock];
@@ -259,7 +262,7 @@
BOOL nextAlive = _lastAlive;
while (_bufferFilled < nsamples) {
- int decodedSamples = _frameSize;
+ int decodedSamples = (int)_frameSize;
[self resizeBuffer:(_bufferFilled + _outputSize)];
if (_resampler) {
@@ -300,7 +303,7 @@
spx_int32_t startofs = 0;
- if (jitter_buffer_get(_jitter, &jbp, _frameSize, &startofs) == JITTER_BUFFER_OK) {
+ if (jitter_buffer_get(_jitter, &jbp, (spx_int32_t)_frameSize, &startofs) == JITTER_BUFFER_OK) {
MKPacketDataStream *pds = [[MKPacketDataStream alloc] initWithBuffer:(unsigned char *)jbp.data length:jbp.len];
_missCount = 0;
@@ -368,23 +371,29 @@
NSData *frameData = [_frames objectAtIndex:0];
if (_msgType == UDPVoiceOpusMessage) {
- decodedSamples = opus_decode_float(_opusDecoder, [frameData bytes], [frameData length], output, _audioBufferSize, 0);
- if (decodedSamples < 0) {
- decodedSamples = _frameSize;
+ if ([frameData length] <= INT_MAX) {
+ decodedSamples = opus_decode_float(_opusDecoder, [frameData bytes], (int)[frameData length], output, (int)_audioBufferSize, 0);
+ if (decodedSamples < 0) {
+ decodedSamples = (int)_frameSize;
+ memset(output, 0, _frameSize * sizeof(float));
+ }
+ } else {
+ decodedSamples = (int)_frameSize;
memset(output, 0, _frameSize * sizeof(float));
}
} else if (_msgType == UDPVoiceSpeexMessage) {
- if ([frameData length] == 0) {
- speex_decode(_speexDecoder, NULL, output);
- } else {
- speex_bits_read_from(&_speexBits, [frameData bytes], [frameData length]);
+ if ([frameData length] > 0 && [frameData length] <= INT_MAX) {
+ speex_bits_read_from(&_speexBits, [frameData bytes], (int)[frameData length]);
speex_decode(_speexDecoder, &_speexBits, output);
+ } else {
+ speex_decode(_speexDecoder, NULL, output);
}
- for (unsigned int i=0; i < _frameSize; i++)
+ for (unsigned int i=0; i < _frameSize; i++) {
output[i] *= (1.0f / 32767.0f);
+ }
} else {
- if ([frameData length] != 0) {
- celt_decode_float(_celtDecoder, [frameData bytes], [frameData length], output);
+ if ([frameData length] > 0 && [frameData length] <= INT_MAX) {
+ celt_decode_float(_celtDecoder, [frameData bytes], (int)[frameData length], output);
} else {
celt_decode_float(_celtDecoder, NULL, 0, output);
}
@@ -423,7 +432,7 @@
}
} else {
if (_msgType == UDPVoiceOpusMessage) {
- decodedSamples = opus_decode_float(_opusDecoder, NULL, 0, output, _frameSize, 0);
+ decodedSamples = opus_decode_float(_opusDecoder, NULL, 0, output, (int)_frameSize, 0);
} else if (_msgType == UDPVoiceSpeexMessage) {
speex_decode(_speexDecoder, NULL, output);
for (unsigned int i = 0; i < _frameSize; i++)
@@ -482,7 +491,7 @@
nextframe:
{
spx_uint32_t inlen = decodedSamples;
- spx_uint32_t outlen = (unsigned long)(ceilf((float)(decodedSamples * _freq) / (float)_sampleRate));
+ spx_uint32_t outlen = (spx_uint32_t) (ceilf((float)(decodedSamples * _freq) / (float)_sampleRate));
if (_resampler && _lastAlive) {
speex_resampler_process_float(_resampler, 0, _resamplerBuffer, &inlen, _buffer + _bufferFilled, &outlen);
diff --git a/src/MKCertificate.m b/src/MKCertificate.m
index bd91ad2..d9ea16c 100644
--- a/src/MKCertificate.m
+++ b/src/MKCertificate.m
@@ -188,7 +188,11 @@ static int add_ext(X509 * crt, int nid, char *value) {
STACK_OF(X509) *certs = NULL;
int ret = 0;
- mem = BIO_new_mem_buf((void *)[pkcs12 bytes], [pkcs12 length]);
+ if ([pkcs12 length] > INT_MAX) {
+ return nil;
+ }
+
+ mem = BIO_new_mem_buf((void *)[pkcs12 bytes], (int)[pkcs12 length]);
(void) BIO_set_close(mem, BIO_NOCLOSE);
pkcs = d2i_PKCS12_bio(mem, NULL);
if (pkcs) {
@@ -248,8 +252,12 @@ static int add_ext(X509 * crt, int nid, char *value) {
return out_certs;
}
+ if ([pkcs12 length] > INT_MAX) {
+ return nil;
+ }
+
void *buf = (void *) [pkcs12 bytes];
- int len = [pkcs12 length];
+ int len = (int) [pkcs12 length];
mem = BIO_new_mem_buf(buf, len);
(void) BIO_set_close(mem, BIO_NOCLOSE);
@@ -597,15 +605,19 @@ static int add_ext(X509 * crt, int nid, char *value) {
if (_derCert == nil) {
return nil;
}
+
+ if ([_derCert length] > UINT32_MAX) {
+ return nil;
+ }
digestKind = [digestKind lowercaseString];
if ([digestKind isEqualToString:@"sha1"]) {
unsigned char buf[CC_SHA1_DIGEST_LENGTH];
- CC_SHA1([_derCert bytes], [_derCert length], buf);
+ CC_SHA1([_derCert bytes], (CC_LONG)[_derCert length], buf);
return [NSData dataWithBytes:buf length:CC_SHA1_DIGEST_LENGTH];
} else if ([digestKind isEqualToString:@"sha256"]) {
unsigned char buf[CC_SHA256_DIGEST_LENGTH];
- CC_SHA256([_derCert bytes], [_derCert length], buf);
+ CC_SHA256([_derCert bytes], (CC_LONG)[_derCert length], buf);
return [NSData dataWithBytes:buf length:CC_SHA256_DIGEST_LENGTH];
}
@@ -624,7 +636,7 @@ static int add_ext(X509 * crt, int nid, char *value) {
}
NSData *digest = [self digestOfKind:digestKind];
- unsigned int len = [digest length];
+ NSUInteger len = [digest length];
if (len%2 != 0) {
return nil;
}
@@ -634,7 +646,7 @@ static int add_ext(X509 * crt, int nid, char *value) {
unsigned char *hexstr = [hexStrBacking mutableBytes];
unsigned char *buf = (unsigned char *)[digest bytes];
const char *tbl = "0123456789abcdef";
- for (int i = 0; i < len; i++) {
+ for (NSUInteger i = 0; i < len; i++) {
hexstr[2*i+0] = tbl[(buf[i] >> 4) & 0x0f];
hexstr[2*i+1] = tbl[buf[i] & 0x0f];
}
diff --git a/src/MKChannelACL.m b/src/MKChannelACL.m
index 4a5b1ce..904d1b9 100644
--- a/src/MKChannelACL.m
+++ b/src/MKChannelACL.m
@@ -138,7 +138,7 @@
self.applySubs ? @"YES" : @"NO",
self.inherited ? @"YES" : @"NO",
self.hasUserID ? @"userID" : @"group",
- self.hasUserID ? [NSNumber numberWithInt:self.userID] : self.group,
+ self.hasUserID ? [NSNumber numberWithInteger:self.userID] : self.group,
grantDescription,
denyDescription];
}
diff --git a/src/MKConnection.m b/src/MKConnection.m
index d263748..d6f6bf7 100644
--- a/src/MKConnection.m
+++ b/src/MKConnection.m
@@ -469,7 +469,7 @@ static void MKConnectionUDPCallback(CFSocketRef sock, CFSocketCallBackType type,
}
default:
- NSLog(@"MKConnection: Unknown event (%u)", eventCode);
+ NSLog(@"MKConnection: Unknown event (%lu)", (unsigned long)eventCode);
break;
}
}
@@ -667,6 +667,11 @@ out:
}
NSData *crypted = [_crypt encryptData:data];
+ if (crypted == nil) {
+ NSLog(@"MKConnection: unable to encrypt UDP message");
+ return;
+ }
+
CFSocketError err = CFSocketSendData(_udpSock, NULL, (CFDataRef)crypted, -1.0f);
if (err != kCFSocketSuccess) {
NSLog(@"MKConnection: CFSocketSendData failed with err=%i", (int)err);
@@ -716,7 +721,7 @@ out:
NSInteger nwritten = [_outputStream write:[msg bytes] maxLength:[msg length]];
if (nwritten != expectedLength) {
- NSLog(@"MKConnection: write error, wrote %d, expected %u", nwritten, expectedLength);
+ NSLog(@"MKConnection: write error, wrote %li, expected %lu", (long int)nwritten, (unsigned long)expectedLength);
}
[msg release];
}
diff --git a/src/MKCryptState_openssl.mm b/src/MKCryptState_openssl.mm
index b757920..cbdb6ad 100644
--- a/src/MKCryptState_openssl.mm
+++ b/src/MKCryptState_openssl.mm
@@ -65,8 +65,12 @@ struct MKCryptStatePrivate {
}
- (NSData *) encryptData:(NSData *)data {
+ if ([data length] > UINT_MAX) {
+ return nil;
+ }
+
NSMutableData *crypted = [[NSMutableData alloc] initWithLength:[data length]+4];
- _priv->cs.encrypt((const unsigned char *)[data bytes], (unsigned char *)[crypted mutableBytes], [data length]);
+ _priv->cs.encrypt((const unsigned char *)[data bytes], (unsigned char *)[crypted mutableBytes], (unsigned int)[data length]);
return [crypted autorelease];
}
@@ -74,8 +78,12 @@ struct MKCryptStatePrivate {
if (!([data length] > 4))
return nil;
+ if ([data length] > UINT_MAX) {
+ return nil;
+ }
+
NSMutableData *plain = [[NSMutableData alloc] initWithLength:[data length]-4];
- if (_priv->cs.decrypt((const unsigned char *)[data bytes], (unsigned char *)[plain mutableBytes], [data length])) {
+ if (_priv->cs.decrypt((const unsigned char *)[data bytes], (unsigned char *)[plain mutableBytes], (unsigned int)[data length])) {
return [plain autorelease];
} else {
[plain release];
diff --git a/src/MKPacketDataStream.m b/src/MKPacketDataStream.m
index fa89be1..a4c517f 100644
--- a/src/MKPacketDataStream.m
+++ b/src/MKPacketDataStream.m
@@ -79,7 +79,7 @@
memcpy(&data[offset], buffer, len);
offset += len;
} else {
- int l = [self left];
+ NSUInteger l = [self left];
memset(&data[offset], 0, l);
overshoot += len - l;
ok = NO;
@@ -275,7 +275,7 @@
offset += len;
return db;
} else {
- NSLog(@"PacketDataStream: Unable to copyDataBlock. Requsted=%u, avail=%u", len, [self left]);
+ NSLog(@"PacketDataStream: Unable to copyDataBlock. Requsted=%lu, avail=%lu", (unsigned long)len, (unsigned long)[self left]);
ok = NO;
return nil;
}
diff --git a/src/MKServerModel.m b/src/MKServerModel.m
index 378b13f..5a5fff8 100644
--- a/src/MKServerModel.m
+++ b/src/MKServerModel.m
@@ -568,7 +568,7 @@
MKUser *user = [[MKUser alloc] init];
[user setSession:userSession];
[user setUserName:userName];
- [_userMap setObject:user forKey:[NSNumber numberWithUnsignedInt:userSession]];
+ [_userMap setObject:user forKey:[NSNumber numberWithUnsignedInteger:userSession]];
[user release];
return user;
@@ -763,7 +763,7 @@
[chan setChannelName:chanName];
[chan setParent:parent];
- [_channelMap setObject:chan forKey:[NSNumber numberWithUnsignedInt:chanId]];
+ [_channelMap setObject:chan forKey:[NSNumber numberWithUnsignedInteger:chanId]];
[parent addChannel:chan];
[chan release];
@@ -774,9 +774,9 @@
- (void) internalSetLinks:(PBArray *)links forChannel:(MKChannel *)chan {
[chan unlinkAll];
- int numLinks = [links count];
+ NSUInteger i, numLinks = [links count];
NSMutableArray *channels = [[NSMutableArray alloc] initWithCapacity:numLinks];
- for (int i = 0; i < numLinks; i++) {
+ for (i = 0; i < numLinks; i++) {
MKChannel *linkedChan = [self channelWithId:(NSUInteger)[links uint32AtIndex:i]];
[channels addObject:linkedChan];
[chan linkToChannel:linkedChan];
@@ -792,7 +792,7 @@
// Handle the 'links_add' list from a ChannelState message
- (void) internalAddLinks:(PBArray *)links toChannel:(MKChannel *)chan {
- int i, numLinks = [links count];
+ NSUInteger i, numLinks = [links count];
NSMutableArray *channels = [[NSMutableArray alloc] initWithCapacity:numLinks];
for (i = 0; i < numLinks; i++) {
MKChannel *linkedChan = [self channelWithId:(NSUInteger)[links uint32AtIndex:i]];
@@ -810,7 +810,7 @@
// Handle the 'links_remove' list from a ChannelState message
- (void) internalRemoveLinks:(PBArray *)links fromChannel:(MKChannel *)chan {
- int i, numLinks = [links count];
+ NSUInteger i, numLinks = [links count];
NSMutableArray *channels = [[NSMutableArray alloc] initWithCapacity:numLinks];
for (i = 0; i < numLinks; i++) {
MKChannel *linkedChan = [self channelWithId:(NSUInteger)[links uint32AtIndex:i]];
@@ -887,7 +887,7 @@
if (_connectedUser) {
[_delegate serverModel:self channelRemoved:chan];
}
- [_channelMap removeObjectForKey:[NSNumber numberWithUnsignedInt:[chan channelId]]];
+ [_channelMap removeObjectForKey:[NSNumber numberWithUnsignedInteger:[chan channelId]]];
}
#pragma mark -
@@ -902,7 +902,7 @@
}
- (MKUser *) userWithSession:(NSUInteger)session {
- return [_userMap objectForKey:[NSNumber numberWithUnsignedInt:session]];
+ return [_userMap objectForKey:[NSNumber numberWithUnsignedInteger:session]];
}
- (MKUser *) userWithHash:(NSString *)hash {
@@ -911,14 +911,14 @@
// Lookup a channel by its channelId.
- (MKChannel *) channelWithId:(NSUInteger)channelId {
- return [_channelMap objectForKey:[NSNumber numberWithUnsignedInt:channelId]];
+ return [_channelMap objectForKey:[NSNumber numberWithUnsignedInteger:channelId]];
}
// Request to join a channel.
- (void) joinChannel:(MKChannel *)chan {
MPUserState_Builder *userState = [MPUserState builder];
- [userState setSession:[[self connectedUser] session]];
- [userState setChannelId:[chan channelId]];
+ [userState setSession:(uint32_t)[[self connectedUser] session]];
+ [userState setChannelId:(uint32_t)[chan channelId]];
NSData *data = [[userState build] data];
[_connection sendMessageWithType:UserStateMessage data:data];
@@ -928,7 +928,7 @@
- (void) createChannelWithName:(NSString *)channelName parent:(MKChannel *)parent temporary:(BOOL)temp {
MPChannelState_Builder *channelState = [MPChannelState builder];
channelState.name = channelName;
- channelState.parent = parent.channelId;
+ channelState.parent = (uint32_t)parent.channelId;
channelState.temporary = temp;
NSData *data = [[channelState build] data];
@@ -938,7 +938,7 @@
// Request the access control for a channel
- (void) requestAccessControlForChannel:(MKChannel *)channel {
MPACL_Builder *mpacl = [MPACL builder];
- mpacl.channelId = channel.channelId;
+ mpacl.channelId = (uint32_t)channel.channelId;
mpacl.query = YES;
NSData *data = [[mpacl build] data];
@@ -948,7 +948,7 @@
// Set the access control for a channel
- (void) setAccessControl:(MKAccessControl *)accessControl forChannel:(MKChannel *)channel {
MPACL_Builder *mpacl = [MPACL builder];
- mpacl.channelId = channel.channelId;
+ mpacl.channelId = (uint32_t)channel.channelId;
mpacl.query = YES;
mpacl.inheritAcls = accessControl.inheritACLs;
@@ -965,7 +965,7 @@
chanACL.grant = channelACL.grant;
if (channelACL.hasUserID) {
- chanACL.userId = channelACL.userID;
+ chanACL.userId = (uint32_t)channelACL.userID;
} else {
chanACL.group = channelACL.group;
}
@@ -1073,7 +1073,7 @@
- (void) registerConnectedUser {
MPUserState_Builder *mpus = [MPUserState builder];
- [mpus setSession:[_connectedUser session]];
+ [mpus setSession:(uint32_t)[_connectedUser session]];
[mpus setUserId:0];
NSData *data = [[mpus build] data];
diff --git a/src/MKServerPinger.m b/src/MKServerPinger.m
index 50bdd4f..5e3145a 100644
--- a/src/MKServerPinger.m
+++ b/src/MKServerPinger.m
@@ -198,9 +198,9 @@
struct sockaddr *sa = (struct sockaddr *) [addr bytes];
if (sa->sa_family == AF_INET)
- sendto(_sock4, buf, 12, 0, [addr bytes], [addr length]);
+ sendto(_sock4, buf, 12, 0, [addr bytes], (socklen_t)[addr length]);
else if (sa->sa_family == AF_INET6)
- sendto(_sock6, buf, 12, 0, [addr bytes], [addr length]);
+ sendto(_sock6, buf, 12, 0, [addr bytes], (socklen_t)[addr length]);
}
}
diff --git a/src/MKTextMessage.m b/src/MKTextMessage.m
index 9b615ee..d87d6e4 100644
--- a/src/MKTextMessage.m
+++ b/src/MKTextMessage.m
@@ -33,7 +33,7 @@
// Strip extra whitespace
NSMutableData *filtered = [[NSMutableData alloc] init];
NSCharacterSet *whitespaceNewlineSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
- int i, len = [_plainStr length];
+ NSUInteger i, len = [_plainStr length];
unichar lastc = 0;
for (i = 0; i < len; i++) {
unichar c = [_plainStr characterAtIndex:i];
diff --git a/src/MKVoiceProcessingDevice.m b/src/MKVoiceProcessingDevice.m
index 8f39810..069fcaf 100644
--- a/src/MKVoiceProcessingDevice.m
+++ b/src/MKVoiceProcessingDevice.m
@@ -63,7 +63,7 @@ static OSStatus inputCallback(void *udata, AudioUnitRenderActionFlags *flags, co
err = AudioUnitRender(dev->_audioUnit, flags, ts, busnum, nframes, &dev->_buflist);
if (err != noErr) {
- NSLog(@"MKVoiceProcessingDevice: AudioUnitRender failed. err = %ld", err);
+ NSLog(@"MKVoiceProcessingDevice: AudioUnitRender failed. err = %li", (long int)err);
return err;
}