summaryrefslogtreecommitdiff
path: root/objective-c
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-06-22 00:29:53 +0200
committerJose <jose@zeroc.com>2019-06-22 00:29:53 +0200
commitc5959fd09de61604bedd75354401df6a57395d65 (patch)
tree3b0227f631c8b20fb1a1a274b92f63f52f34af2c /objective-c
parentSmall fix (diff)
parentEnable -Wconversion with clang - Close #363 (diff)
downloadice-c5959fd09de61604bedd75354401df6a57395d65.tar.bz2
ice-c5959fd09de61604bedd75354401df6a57395d65.tar.xz
ice-c5959fd09de61604bedd75354401df6a57395d65.zip
Merge remote-tracking branch 'origin/3.7' into swift
Diffstat (limited to 'objective-c')
-rw-r--r--objective-c/include/objc/Ice/Proxy.h1
-rw-r--r--objective-c/src/Ice/Object.mm20
-rw-r--r--objective-c/src/Ice/Proxy.mm10
-rw-r--r--objective-c/src/Ice/Stream.mm50
-rw-r--r--objective-c/src/Ice/Util.h2
-rw-r--r--objective-c/test/Ice/admin/AllTests.m2
-rw-r--r--objective-c/test/Ice/binding/AllTests.m10
-rw-r--r--objective-c/test/Ice/enums/AllTests.m48
-rw-r--r--objective-c/test/Ice/exceptions/TestI.m2
-rw-r--r--objective-c/test/Ice/hash/AllTests.m6
-rw-r--r--objective-c/test/Ice/hold/TestI.m2
-rw-r--r--objective-c/test/Ice/operations/TestI.m6
-rw-r--r--objective-c/test/Ice/operations/Twoways.m10
-rw-r--r--objective-c/test/Ice/operations/TwowaysAMI.m13
-rw-r--r--objective-c/test/Ice/proxy/AllTests.m2
-rw-r--r--objective-c/test/Ice/slicing/objects/AllTests.m16
-rw-r--r--objective-c/test/Ice/stream/Client.m4
17 files changed, 103 insertions, 101 deletions
diff --git a/objective-c/include/objc/Ice/Proxy.h b/objective-c/include/objc/Ice/Proxy.h
index 64ae023b3e1..24b5a0af9a7 100644
--- a/objective-c/include/objc/Ice/Proxy.h
+++ b/objective-c/include/objc/Ice/Proxy.h
@@ -145,6 +145,7 @@ ICE_API @protocol ICEObjectPrx <NSObject, NSCopying>
-(id) ice_timeout:(int)timeout;
-(id) ice_getTimeout;
-(id) ice_fixed:(id<ICEConnection>)connection;
+-(BOOL) ice_isFixed;
-(id) ice_connectionId:(NSString*)connectionId;
-(id<ICEConnection>) ice_getConnection;
-(id<ICEAsyncResult>) begin_ice_getConnection;
diff --git a/objective-c/src/Ice/Object.mm b/objective-c/src/Ice/Object.mm
index 888c0dfb352..21c83688029 100644
--- a/objective-c/src/Ice/Object.mm
+++ b/objective-c/src/Ice/Object.mm
@@ -173,7 +173,7 @@ BlobjectI::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr& cb,
{
ICECurrent* c = [[ICECurrent alloc] initWithCurrent:current];
NSData* inE = [NSData dataWithBytesNoCopy:const_cast<Ice::Byte*>(inEncaps.first)
- length:(inEncaps.second - inEncaps.first)
+ length:static_cast<NSUInteger>(inEncaps.second - inEncaps.first)
freeWhenDone:NO];
@try
{
@@ -216,7 +216,7 @@ int
ICEInternalLookupString(NSString* const array[], size_t count, NSString* __unsafe_unretained str)
{
size_t low = 0;
- size_t high = count - 1;
+ size_t high = static_cast<size_t>(count - 1);
while(low <= high)
{
size_t mid = (low + high) / 2;
@@ -233,7 +233,7 @@ ICEInternalLookupString(NSString* const array[], size_t count, NSString* __unsaf
low = mid + 1;
break;
case NSOrderedSame:
- return mid;
+ return static_cast<int>(mid);
default:
return -1; // Can't be reached
}
@@ -247,17 +247,12 @@ ICEInternalCheckModeAndSelector(id target, ICEOperationMode expected, SEL sel, I
ICEOperationMode received = current.mode;
if(expected != received)
{
+ assert(expected != ICENonmutating); // We never expect Nonmutating
if(expected == ICEIdempotent && received == ICENonmutating)
{
//
// Fine: typically an old client still using the deprecated nonmutating keyword
//
-
- //
- // Note that expected == Nonmutating and received == Idempotent is not ok:
- // the server may still use the deprecated nonmutating keyword to detect updates
- // and the client should not break this (deprecated) feature.
- //
}
else
{
@@ -432,9 +427,10 @@ static NSString* ICEObject_all[4] =
-(BOOL) ice_isA:(NSString*)typeId current:(ICECurrent*)__unused current
{
- int count, index;
+ int count;
+ int index;
NSString*const* staticIds = [[self class] iceStaticIds:&count idIndex:&index];
- return ICEInternalLookupString(staticIds, count, typeId) >= 0;
+ return ICEInternalLookupString(staticIds, static_cast<size_t>(count), typeId) >= 0;
}
-(void) ice_ping:(ICECurrent*)__unused current
@@ -451,7 +447,7 @@ static NSString* ICEObject_all[4] =
{
int count, index;
NSString*const* staticIds = [[self class] iceStaticIds:&count idIndex:&index];
- return [NSArray arrayWithObjects:staticIds count:count];
+ return [NSArray arrayWithObjects:staticIds count:static_cast<NSUInteger>(count)];
}
-(void) ice_dispatch:(id<ICERequest>)request
diff --git a/objective-c/src/Ice/Proxy.mm b/objective-c/src/Ice/Proxy.mm
index fab4ceb94c1..7f0107726fe 100644
--- a/objective-c/src/Ice/Proxy.mm
+++ b/objective-c/src/Ice/Proxy.mm
@@ -1340,7 +1340,7 @@ BOOL _returnsData;
if(response)
{
NSMutableData* outEncaps =
- [NSMutableData dataWithBytes:outP.first length:(outP.second - outP.first)];
+ [NSMutableData dataWithBytes:outP.first length:static_cast<NSUInteger>(outP.second - outP.first)];
response(ret, outEncaps);
}
},
@@ -1371,7 +1371,7 @@ BOOL _returnsData;
if(response)
{
NSMutableData* outEncaps =
- [NSMutableData dataWithBytes:outP.first length:(outP.second - outP.first)];
+ [NSMutableData dataWithBytes:outP.first length:static_cast<NSUInteger>(outP.second - outP.first)];
response(ret, outEncaps);
}
},
@@ -1385,7 +1385,7 @@ BOOL _returnsData;
{
std::pair<const ::Ice::Byte*, const ::Ice::Byte*> outP;
ret = OBJECTPRX->_iceI_end_ice_invoke(outP, r);
- *outEncaps = [NSMutableData dataWithBytes:outP.first length:(outP.second - outP.first)];
+ *outEncaps = [NSMutableData dataWithBytes:outP.first length:static_cast<NSUInteger>(outP.second - outP.first)];
}, result);
return ret;
}
@@ -1629,6 +1629,10 @@ BOOL _returnsData;
@throw nsex;
return nil; // Keep the compiler happy.
}
+-(BOOL) ice_isFixed
+{
+ return OBJECTPRX->ice_isFixed();
+}
-(id) ice_connectionId:(NSString*)connectionId
{
return [[self class] iceObjectPrxWithObjectPrx:OBJECTPRX->ice_connectionId(fromNSString(connectionId))];
diff --git a/objective-c/src/Ice/Stream.mm b/objective-c/src/Ice/Stream.mm
index ec323da9038..e49f494058e 100644
--- a/objective-c/src/Ice/Stream.mm
+++ b/objective-c/src/Ice/Stream.mm
@@ -190,7 +190,7 @@ public:
{
ICEObject* o = ValueWrapperPtr::dynamicCast(obj)->getValue();
checkType(o);
- [_array replaceObjectAtIndex:_index withObject:o];
+ [_array replaceObjectAtIndex:static_cast<NSUInteger>(_index) withObject:o];
}
}
@catch(id ex)
@@ -481,7 +481,7 @@ private:
std::pair<const bool*, const bool*> seq;
IceUtil::ScopedArray<bool> result;
is_->read(seq, result);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first) * sizeof(BOOL)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first) * sizeof(BOOL)];
}
catch(const std::exception& ex)
{
@@ -520,7 +520,7 @@ private:
{
std::pair<const Ice::Byte*, const Ice::Byte*> seq;
is_->read(seq);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first)];
}
catch(const std::exception& ex)
{
@@ -537,7 +537,7 @@ private:
std::pair<const Ice::Byte*, const Ice::Byte*> seq;
is_->read(seq);
return [NSData dataWithBytesNoCopy:const_cast<Ice::Byte*>(seq.first)
- length:(seq.second - seq.first) freeWhenDone:NO];
+ length:static_cast<NSUInteger>(seq.second - seq.first) freeWhenDone:NO];
}
catch(const std::exception& ex)
{
@@ -577,7 +577,7 @@ private:
std::pair<const Ice::Short*, const Ice::Short*> seq;
IceUtil::ScopedArray<Ice::Short> result;
is_->read(seq, result);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first) * sizeof(ICEShort)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first) * sizeof(ICEShort)];
}
catch(const std::exception& ex)
{
@@ -617,7 +617,7 @@ private:
std::pair<const Ice::Int*, const Ice::Int*> seq;
IceUtil::ScopedArray<Ice::Int> result;
is_->read(seq, result);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first) * sizeof(ICEInt)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first) * sizeof(ICEInt)];
}
catch(const std::exception& ex)
{
@@ -657,7 +657,7 @@ private:
std::pair<const Ice::Long*, const Ice::Long*> seq;
IceUtil::ScopedArray<Ice::Long> result;
is_->read(seq, result);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first) * sizeof(ICELong)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first) * sizeof(ICELong)];
}
catch(const std::exception& ex)
{
@@ -697,7 +697,7 @@ private:
std::pair<const Ice::Float*, const Ice::Float*> seq;
IceUtil::ScopedArray<Ice::Float> result;
is_->read(seq, result);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first) * sizeof(ICEFloat)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first) * sizeof(ICEFloat)];
}
catch(const std::exception& ex)
{
@@ -737,7 +737,7 @@ private:
std::pair<const Ice::Double*, const Ice::Double*> seq;
IceUtil::ScopedArray<Ice::Double> result;
is_->read(seq, result);
- return [[NSMutableData alloc] initWithBytes:seq.first length:(seq.second - seq.first) * sizeof(ICEDouble)];
+ return [[NSMutableData alloc] initWithBytes:seq.first length:static_cast<NSUInteger>(seq.second - seq.first) * sizeof(ICEDouble)];
}
catch(const std::exception& ex)
{
@@ -850,7 +850,7 @@ private:
try
{
int count = is_->readSize();
- if((ret = [[NSMutableData alloc] initWithLength:(count * ENUM_SIZE)]) == 0)
+ if((ret = [[NSMutableData alloc] initWithLength:static_cast<NSUInteger>(count) * ENUM_SIZE]) == 0)
{
return ret;
}
@@ -984,7 +984,7 @@ private:
-(NSMutableArray*) newValueSeq:(Class)type
{
ICEInt sz = [self readAndCheckSeqSize:1];
- NSMutableArray* arr = [[NSMutableArray alloc] initWithCapacity:sz];
+ NSMutableArray* arr = [[NSMutableArray alloc] initWithCapacity:static_cast<NSUInteger>(sz)];
if(sz > 0)
{
NSException* nsex = nil;
@@ -1025,7 +1025,7 @@ private:
-(NSMutableDictionary*) newValueDict:(Class)keyHelper expectedType:(Class)type
{
ICEInt sz = [self readAndCheckSeqSize:[keyHelper minWireSize] + 1];
- NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] initWithCapacity:sz];
+ NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] initWithCapacity:static_cast<NSUInteger>(sz)];
if(sz > 0)
{
if(!objectReaders_)
@@ -1076,7 +1076,7 @@ private:
-(NSMutableArray*) newSequence:(Class)helper
{
ICEInt sz = [self readAndCheckSeqSize:[helper minWireSize]];
- NSMutableArray* arr = [[NSMutableArray alloc] initWithCapacity:sz];
+ NSMutableArray* arr = [[NSMutableArray alloc] initWithCapacity:static_cast<NSUInteger>(sz)];
id obj = nil;
@try
{
@@ -1111,7 +1111,7 @@ private:
-(NSMutableDictionary*) newDictionary:(ICEKeyValueTypeHelper)helper
{
ICEInt sz = [self readAndCheckSeqSize:[helper.key minWireSize] + [helper.value minWireSize]];
- NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] initWithCapacity:sz];
+ NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] initWithCapacity:static_cast<NSUInteger>(sz)];
id key = nil;
id value = nil;
@try
@@ -1420,7 +1420,7 @@ private:
NSException* nsex = nil;
try
{
- is_->skip(sz);
+ is_->skip(static_cast<Ice::InputStream::size_type>(sz));
}
catch(const std::exception& ex)
{
@@ -1804,7 +1804,7 @@ private:
return;
}
- [self writeSize:[arr count]];
+ [self writeSize:static_cast<Ice::Int>([arr count])];
for(id i in arr)
{
[helper write:(i == [NSNull null] ? nil : i) stream:self];
@@ -1819,7 +1819,7 @@ private:
return;
}
- [self writeSize:[dictionary count]];
+ [self writeSize:static_cast<Ice::Int>([dictionary count])];
NSEnumerator* e = [dictionary keyEnumerator];
id key;
while((key = [e nextObject]))
@@ -1903,7 +1903,7 @@ private:
NSException* nsex = nil;
try
{
- int count = v == nil ? 0 : [v length] / ENUM_SIZE;
+ int count = v == nil ? 0 : static_cast<int>([v length] / ENUM_SIZE);
[self writeSize:count];
if(count == 0)
{
@@ -1992,7 +1992,7 @@ private:
return;
}
- [self writeSize:[arr count]];
+ [self writeSize:static_cast<Ice::Int>([arr count])];
for(id i in arr)
{
[self writeValue:(i == [NSNull null] ? nil : i)];
@@ -2007,7 +2007,7 @@ private:
return;
}
- [self writeSize:[dictionary count]];
+ [self writeSize:static_cast<Ice::Int>([dictionary count])];
NSEnumerator* e = [dictionary keyEnumerator];
id key;
while((key = [e nextObject]))
@@ -2240,7 +2240,7 @@ private:
try
{
std::pair<const Ice::Byte*, const Ice::Byte*> b = os_->finished();
- return [NSData dataWithBytesNoCopy:const_cast<Ice::Byte*>(b.first) length:(b.second - b.first) freeWhenDone:NO];
+ return [NSData dataWithBytesNoCopy:const_cast<Ice::Byte*>(b.first) length:static_cast<NSUInteger>(b.second - b.first) freeWhenDone:NO];
}
catch(const std::exception& ex)
{
@@ -2917,7 +2917,7 @@ private:
}
+(ICEInt) count:(id)obj
{
- return [obj count];
+ return static_cast<ICEInt>([obj count]);
}
@end
@@ -2954,7 +2954,7 @@ private:
}
+(ICEInt) count:(id)obj
{
- return [obj length] / [[self getElementHelper] minWireSize];
+ return static_cast<ICEInt>([obj length]) / [[self getElementHelper] minWireSize];
}
+(Class) getElementHelper
{
@@ -3104,7 +3104,7 @@ private:
@implementation ICEEnumSequenceHelper
+(ICEInt) count:(id)obj
{
- return [obj length] / ENUM_SIZE;
+ return static_cast<ICEInt>([obj length] / ENUM_SIZE);
}
+(Class) getElementHelper
{
@@ -3206,7 +3206,7 @@ private:
}
+(ICEInt) count:(id)obj
{
- return [obj count];
+ return static_cast<ICEInt>([obj count]);
}
@end
diff --git a/objective-c/src/Ice/Util.h b/objective-c/src/Ice/Util.h
index 7fce38929ac..2c31fb62c11 100644
--- a/objective-c/src/Ice/Util.h
+++ b/objective-c/src/Ice/Util.h
@@ -141,7 +141,7 @@ fromNSData(NSData* array, std::vector<T>& seq)
{
if(array != nil)
{
- int len = [array length] / sizeof(T);
+ size_t len = static_cast<size_t>([array length]) / sizeof(T);
seq.reserve(len);
T* src = (T*)[array bytes];
while(len-- > 0)
diff --git a/objective-c/test/Ice/admin/AllTests.m b/objective-c/test/Ice/admin/AllTests.m
index 01b223f8ccd..41e6c9a4c7b 100644
--- a/objective-c/test/Ice/admin/AllTests.m
+++ b/objective-c/test/Ice/admin/AllTests.m
@@ -392,7 +392,7 @@ adminAllTests(id<ICECommunicator> communicator)
test([logMessages count] == 4);
test([prefix isEqual:@"NullLogger"]);
- int i = 0;
+ NSUInteger i = 0;
test([((ICELogMessage*)[logMessages objectAtIndex:i]).traceCategory isEqual:@"testCat"] &&
[((ICELogMessage*)[logMessages objectAtIndex:i++]).message isEqual:@"trace"]);
test([((ICELogMessage*)[logMessages objectAtIndex:i++]).message isEqual:@"warning"]);
diff --git a/objective-c/test/Ice/binding/AllTests.m b/objective-c/test/Ice/binding/AllTests.m
index e3df5180c1e..909ccb6132f 100644
--- a/objective-c/test/Ice/binding/AllTests.m
+++ b/objective-c/test/Ice/binding/AllTests.m
@@ -89,11 +89,11 @@ getEndpoints(id<TestBindingTestIntfPrx> proxy)
{
NSMutableArray* edpts = [NSMutableArray array];
bool escape = NO;
- int beg = 0;
- int length = 0;
+ NSUInteger beg = 0;
+ NSUInteger length = 0;
NSString* s = [proxy ice_toString];
- int index;
- for(index = 0; index < (int)[s length]; ++index)
+ NSUInteger index;
+ for(index = 0; index < [s length]; ++index)
{
unichar c = [s characterAtIndex:index];
if(c == '"')
@@ -156,7 +156,7 @@ random_shuffle(NSMutableArray* array)
NSUInteger count = [array count];
while(count--)
{
- [array exchangeObjectAtIndex:count withObjectAtIndex:(random() % (count + 1))];
+ [array exchangeObjectAtIndex:count withObjectAtIndex:(NSUInteger)random() % (count + 1)];
}
}
diff --git a/objective-c/test/Ice/enums/AllTests.m b/objective-c/test/Ice/enums/AllTests.m
index dd8c8477a64..b116c9ec60d 100644
--- a/objective-c/test/Ice/enums/AllTests.m
+++ b/objective-c/test/Ice/enums/AllTests.m
@@ -94,9 +94,9 @@ enumAllTests(id<ICECommunicator> communicator)
TestEnumbenum6, TestEnumbenum7, TestEnumbenum8, TestEnumbenum9, TestEnumbenum10,
TestEnumbenum11};
- int enumSize = sizeof(TestEnumByteEnum);
- int length = sizeof(values);
- int elements = length/enumSize;
+ NSUInteger enumSize = sizeof(TestEnumByteEnum);
+ NSUInteger length = sizeof(values);
+ NSUInteger elements = length / enumSize;
TestEnumMutableByteEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableByteEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -106,7 +106,7 @@ enumAllTests(id<ICECommunicator> communicator)
ICEByte* p2 = (ICEByte *)[enumSeq2 bytes];
ICEByte* p3 = (ICEByte *)[enumSeq3 bytes];
- for(int i = 0; i < elements; ++i)
+ for(NSUInteger i = 0; i < elements; ++i)
{
test(*p1 == *p2);
test(*p1 == *p3);
@@ -121,9 +121,9 @@ enumAllTests(id<ICECommunicator> communicator)
TestEnumsenum6, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10,
TestEnumsenum11};
- int enumSize = sizeof(TestEnumShortEnum);
- int length = sizeof(values);
- int elements = length/enumSize;
+ NSUInteger enumSize = sizeof(TestEnumShortEnum);
+ NSUInteger length = sizeof(values);
+ NSUInteger elements = length / enumSize;
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -133,7 +133,7 @@ enumAllTests(id<ICECommunicator> communicator)
ICEByte* p2 = (ICEByte *)[enumSeq2 bytes];
ICEByte* p3 = (ICEByte *)[enumSeq3 bytes];
- for(int i = 0; i < elements; ++i)
+ for(NSUInteger i = 0; i < elements; ++i)
{
test(*p1 == *p2);
test(*p1 == *p3);
@@ -149,9 +149,9 @@ enumAllTests(id<ICECommunicator> communicator)
TestEnumienum6, TestEnumienum7, TestEnumienum8, TestEnumienum9, TestEnumienum10,
TestEnumienum11};
- int enumSize = sizeof(TestEnumShortEnum);
- int length = sizeof(values);
- int elements = length/enumSize;
+ NSUInteger enumSize = sizeof(TestEnumShortEnum);
+ NSUInteger length = sizeof(values);
+ NSUInteger elements = length / enumSize;
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -161,7 +161,7 @@ enumAllTests(id<ICECommunicator> communicator)
ICEByte* p2 = (ICEByte *)[enumSeq2 bytes];
ICEByte* p3 = (ICEByte *)[enumSeq3 bytes];
- for(int i = 0; i < elements; ++i)
+ for(NSUInteger i = 0; i < elements; ++i)
{
test(*p1 == *p2);
test(*p1 == *p3);
@@ -175,9 +175,9 @@ enumAllTests(id<ICECommunicator> communicator)
TestEnumSimpleEnum values[] = {TestEnumred, TestEnumgreen, TestEnumblue};
- int enumSize = sizeof(TestEnumShortEnum);
- int length = sizeof(values);
- int elements = length/enumSize;
+ NSUInteger enumSize = sizeof(TestEnumShortEnum);
+ NSUInteger length = sizeof(values);
+ NSUInteger elements = length / enumSize;
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -187,7 +187,7 @@ enumAllTests(id<ICECommunicator> communicator)
ICEByte* p2 = (ICEByte *)[enumSeq2 bytes];
ICEByte* p3 = (ICEByte *)[enumSeq3 bytes];
- for(int i = 0; i < elements; ++i)
+ for(NSUInteger i = 0; i < elements; ++i)
{
test(*p1 == *p2);
test(*p1 == *p3);
@@ -260,11 +260,11 @@ enumAllTests(id<ICECommunicator> communicator)
TestEnumbenum6, (TestEnumByteEnum)-1, TestEnumbenum8, TestEnumbenum9, TestEnumbenum10,
TestEnumbenum11}; // Negative enumerators are not supported
- int length = sizeof(values);
+ NSUInteger length = sizeof(values);
TestEnumMutableByteEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableByteEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
- @try
+ @try
{
[proxy opByteSeq:enumSeq1 b2:&enumSeq2];
test(NO);
@@ -279,11 +279,11 @@ enumAllTests(id<ICECommunicator> communicator)
TestEnumbenum6, (TestEnumByteEnum)127, TestEnumbenum8, TestEnumbenum9, TestEnumbenum10,
TestEnumbenum11}; // Invalid enumerator
- int length = sizeof(values);
+ NSUInteger length = sizeof(values);
TestEnumMutableByteEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableByteEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
- @try
+ @try
{
[proxy opByteSeq:enumSeq1 b2:&enumSeq2];
test(NO);
@@ -299,7 +299,7 @@ enumAllTests(id<ICECommunicator> communicator)
(TestEnumShortEnum)-1, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10,
TestEnumsenum11}; // Negative enumerators are not supported
- int length = sizeof(values);
+ NSUInteger length = sizeof(values);
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -319,7 +319,7 @@ enumAllTests(id<ICECommunicator> communicator)
(TestEnumShortEnum)0, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10,
TestEnumsenum11}; // Invalid enumerator
- int length = sizeof(values);
+ NSUInteger length = sizeof(values);
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -339,7 +339,7 @@ enumAllTests(id<ICECommunicator> communicator)
(TestEnumShortEnum)32767, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10,
TestEnumsenum11}; // Invalid enumerator
- int length = sizeof(values);
+ NSUInteger length = sizeof(values);
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
@@ -359,7 +359,7 @@ enumAllTests(id<ICECommunicator> communicator)
(TestEnumIntEnum)-1, TestEnumienum7, TestEnumienum8, TestEnumienum9, TestEnumienum10,
TestEnumienum11}; // Negative enumerators are not supported
- int length = sizeof(values);
+ NSUInteger length = sizeof(values);
TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length];
TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length];
diff --git a/objective-c/test/Ice/exceptions/TestI.m b/objective-c/test/Ice/exceptions/TestI.m
index 17463a7d8d4..bcfceb948db 100644
--- a/objective-c/test/Ice/exceptions/TestI.m
+++ b/objective-c/test/Ice/exceptions/TestI.m
@@ -109,7 +109,7 @@
-(ICEByteSeq*) throwMemoryLimitException:(ICEMutableByteSeq*)__unused bs current:(ICECurrent*)__unused current
{
- int limit = 20 * 1024;
+ NSUInteger limit = 20 * 1024;
ICEMutableByteSeq *r = [NSMutableData dataWithLength:limit];
ICEByte *p = (ICEByte *)[r bytes];
while(--limit > 0)
diff --git a/objective-c/test/Ice/hash/AllTests.m b/objective-c/test/Ice/hash/AllTests.m
index c5da614c8b4..8533410f39b 100644
--- a/objective-c/test/Ice/hash/AllTests.m
+++ b/objective-c/test/Ice/hash/AllTests.m
@@ -89,9 +89,9 @@ hashAllTests()
NSMutableDictionary* seenObject = [[NSMutableDictionary alloc] init];
for(int i = 0; collisions < maxCollisions && i < maxIterations; ++i)
{
- TestHashPointF* obj = [TestHashPointF pointF:(arc4random() % 1000)/3.0
- y:(arc4random() % 1000)/5.0
- z:(arc4random() % 1000)/7.0];
+ TestHashPointF* obj = [TestHashPointF pointF:(arc4random() % 1000) / 3.0f
+ y:(arc4random() % 1000) / 5.0f
+ z:(arc4random() % 1000) / 7.0f];
NSNumber* hash = [NSNumber numberWithUnsignedInteger:[obj hash]];
if([seenObject objectForKey:hash])
diff --git a/objective-c/test/Ice/hold/TestI.m b/objective-c/test/Ice/hold/TestI.m
index 0213fb0d165..c1e5a4e5f1d 100644
--- a/objective-c/test/Ice/hold/TestI.m
+++ b/objective-c/test/Ice/hold/TestI.m
@@ -28,7 +28,7 @@
-(void) schedule:(void(^)(void))callback timeout:(ICEInt)t
{
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
- dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, t * NSEC_PER_MSEC), DISPATCH_TIME_FOREVER, 0);
+ dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, t * (ICEInt)NSEC_PER_MSEC), DISPATCH_TIME_FOREVER, 0);
dispatch_source_set_event_handler(timer, ^{
callback();
dispatch_source_cancel(timer);
diff --git a/objective-c/test/Ice/operations/TestI.m b/objective-c/test/Ice/operations/TestI.m
index a61bf84f388..c5e7a9b6e4d 100644
--- a/objective-c/test/Ice/operations/TestI.m
+++ b/objective-c/test/Ice/operations/TestI.m
@@ -145,8 +145,8 @@
*p5 = [TestOperationsMutableIntS dataWithLength:[p2 length]];
ICEInt *target = (ICEInt *)[*p5 bytes];
ICEInt *src = (ICEInt *)([p2 bytes] + [p2 length]);
- int i;
- for(i = 0; i != (int)[p2 length] / sizeof(ICEInt); ++i)
+ NSUInteger i;
+ for(i = 0; i != [p2 length] / sizeof(ICEInt); ++i)
{
*target++ = *--src;
}
@@ -855,8 +855,6 @@
}
@end
-
-
@implementation TestOperationsBI
-(void) opB:(ICECurrent*)__unused current
diff --git a/objective-c/test/Ice/operations/Twoways.m b/objective-c/test/Ice/operations/Twoways.m
index 8cc9825a59a..40c74784603 100644
--- a/objective-c/test/Ice/operations/Twoways.m
+++ b/objective-c/test/Ice/operations/Twoways.m
@@ -1460,7 +1460,7 @@ twoways(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p, id<Tes
ICEFloat buf1[] = { -1.1f, 123123.2f, 100.0f };
ICEFloat buf2[] = { 42.24f, -1.61f };
- ICEFloat buf3[] = { -3.14, 3.14 };
+ ICEFloat buf3[] = { -3.14f, 3.14f };
TestOperationsMutableFloatS *si1 = [TestOperationsMutableFloatS data];
TestOperationsMutableFloatS *si2 = [TestOperationsMutableFloatS data];
@@ -1629,17 +1629,17 @@ twoways(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p, id<Tes
}
{
- const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+ const NSUInteger lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
- int l;
+ NSUInteger l;
for(l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
{
TestOperationsMutableIntS *s = [TestOperationsMutableIntS dataWithLength:(lengths[l] * sizeof(ICEInt))];
ICEInt *ip = (ICEInt *)[s bytes];
- int i;
+ NSUInteger i;
for(i = 0; i < lengths[l]; ++i)
{
- *ip++ = i;
+ *ip++ = (ICEInt)i;
}
TestOperationsIntS *r = [p opIntS:s];
test([r length] == lengths[l] * sizeof(ICEInt));
diff --git a/objective-c/test/Ice/operations/TwowaysAMI.m b/objective-c/test/Ice/operations/TwowaysAMI.m
index 1a111534990..a2b1b886129 100644
--- a/objective-c/test/Ice/operations/TwowaysAMI.m
+++ b/objective-c/test/Ice/operations/TwowaysAMI.m
@@ -1813,7 +1813,7 @@ twowaysAMI(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p)
ICEFloat buf1[] = { -1.1f, 123123.2f, 100.0f };
ICEFloat buf2[] = { 42.24f, -1.61f };
- ICEFloat buf3[] = { -3.14, 3.14 };
+ ICEFloat buf3[] = { -3.14f, 3.14f };
TestOperationsMutableFloatS *si1 = [TestOperationsMutableFloatS data];
TestOperationsMutableFloatS *si2 = [TestOperationsMutableFloatS data];
@@ -1928,17 +1928,18 @@ twowaysAMI(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p)
}
{
- const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+ const NSUInteger lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
- int l;
+ NSUInteger l;
for(l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
{
- TestOperationsMutableIntS *s = [TestOperationsMutableIntS dataWithLength:(lengths[l] * sizeof(ICEInt))];
+ TestOperationsMutableIntS *s =
+ [TestOperationsMutableIntS dataWithLength:(lengths[l] * sizeof(ICEInt))];
ICEInt *ip = (ICEInt *)[s bytes];
- int i;
+ NSUInteger i;
for(i = 0; i < lengths[l]; ++i)
{
- *ip++ = i;
+ *ip++ = (ICEInt)i;
}
TestAMIOperationsCallback* cb = [TestAMIOperationsCallback create];
diff --git a/objective-c/test/Ice/proxy/AllTests.m b/objective-c/test/Ice/proxy/AllTests.m
index 50fc2cbb7bd..8519772a1b3 100644
--- a/objective-c/test/Ice/proxy/AllTests.m
+++ b/objective-c/test/Ice/proxy/AllTests.m
@@ -714,6 +714,8 @@ proxyAllTests(id<ICECommunicator> communicator)
id<ICEConnection> connection = [cl ice_getConnection];
if(connection != nil)
{
+ test(![cl ice_isFixed]);
+ test([[cl ice_fixed:connection] ice_isFixed]);
[[cl ice_fixed:connection] getContext];
test([[[cl ice_secure:YES] ice_fixed:connection] ice_isSecure]);
test([[[[cl ice_facet:@"facet"] ice_fixed:connection] ice_getFacet] isEqualToString:@"facet"]);
diff --git a/objective-c/test/Ice/slicing/objects/AllTests.m b/objective-c/test/Ice/slicing/objects/AllTests.m
index 0dc911dfbbe..f41db004813 100644
--- a/objective-c/test/Ice/slicing/objects/AllTests.m
+++ b/objective-c/test/Ice/slicing/objects/AllTests.m
@@ -680,13 +680,13 @@ static void breakCycles(id o)
test([res isKindOfClass:[TestSlicingObjectsClientPCDerived3 class]]);
TestSlicingObjectsClientPCDerived3* p3 = (TestSlicingObjectsClientPCDerived3*)res;
test(p3.pi == 3);
- for(int i = 0; i < 300; ++i)
+ for(NSUInteger i = 0; i < 300; ++i)
{
TestSlicingObjectsClientPCDerived2* p2 = (TestSlicingObjectsClientPCDerived2*)[p3.pbs objectAtIndex:i];
- test(p2.pi == i);
+ test(p2.pi == (ICEInt)i);
test([p2.pbs count] == 1);
test([[p2.pbs objectAtIndex:0] isEqual:[NSNull null]]);
- test(p2.pcd2 == i);
+ test(p2.pcd2 == (ICEInt)i);
}
test(p3.pcd2 == p3.pi);
test([p3.pcd3 isEqual:[p3.pbs objectAtIndex:10]]);
@@ -2293,14 +2293,14 @@ slicingObjectsAllTests(id<ICECommunicator> communicator)
//
// Sending more than 254 objects exercises the encoding for object ids.
//
- int i;
+ NSUInteger i;
pcd.pbs = [NSArray array];
for(i = 0; i < 300; ++i)
{
TestSlicingObjectsClientPCDerived2* p2 = [TestSlicingObjectsClientPCDerived2 pcDerived2];
- p2.pi = i;
+ p2.pi = (ICEInt)i;
p2.pbs = [NSArray arrayWithObjects:[NSNull null], nil]; // Nil reference. This slice should not have an indirection table.
- p2.pcd2 = i;
+ p2.pcd2 = (ICEInt)i;
pcd.pbs = [pcd.pbs arrayByAddingObject:p2];
}
pcd.pcd2 = pcd.pi;
@@ -2321,10 +2321,10 @@ slicingObjectsAllTests(id<ICECommunicator> communicator)
for(i = 0; i < 300; ++i)
{
TestSlicingObjectsClientPCDerived2* p2 = (TestSlicingObjectsClientPCDerived2*)[p3.pbs objectAtIndex:i];
- test(p2.pi == i);
+ test(p2.pi == (ICEInt)i);
test([p2.pbs count] == 1);
test([[p2.pbs objectAtIndex:0] isEqual:[NSNull null]]);
- test(p2.pcd2 == i);
+ test(p2.pcd2 == (ICEInt)i);
}
test(p3.pcd2 == p3.pi);
test(p3.pcd3 == [p3.pbs objectAtIndex:10]);
diff --git a/objective-c/test/Ice/stream/Client.m b/objective-c/test/Ice/stream/Client.m
index 0fd785433d8..b51a3b43f29 100644
--- a/objective-c/test/Ice/stream/Client.m
+++ b/objective-c/test/Ice/stream/Client.m
@@ -477,7 +477,7 @@ run(id<ICECommunicator> communicator)
TestStreamSmallStructS* arr2 = [TestStreamSmallStructSHelper read:in];
[in readPendingValues];
test([arr2 count] == [arr count]);
- for(int j = 0; j < (int)[arr2 count]; ++j)
+ for(NSUInteger j = 0; j < [arr2 count]; ++j)
{
test([[arr objectAtIndex:j] isEqual:[arr2 objectAtIndex:j]]);
}
@@ -548,7 +548,7 @@ run(id<ICECommunicator> communicator)
[in readPendingValues];
test([arr2 count] > 0);
test([arr2 count] == [arr count]);
- for(int j = 0; j < (int)[arr2 count]; ++j)
+ for(NSUInteger j = 0; j < [arr2 count]; ++j)
{
TestStreamMyClass* e = [arr2 objectAtIndex:j];
TestStreamMyClass* f = [arr objectAtIndex:j];