Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Swift dependency on non-public C++ APIs #2648

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions swift/src/Ice/InputStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,8 @@ public class InputStream {
return
}

ICETraceUtil.traceSlicing(
kind: sliceType == SliceType.ExceptionSlice ? "exception" : "object",
typeId: typeId,
slicingCat: "Slicing",
logger: LoggerWrapper(handle: communicator.getLogger()))
let kind = sliceType == SliceType.ExceptionSlice ? "exception" : "object"
communicator.getLogger().trace(category: "Slicing", message: "unknown \(kind) type '\(typeId)'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we apply this change to other mappings?

}

static func throwUOE(expectedType: Value.Type, v: Value) throws {
Expand Down
10 changes: 4 additions & 6 deletions swift/src/Ice/ServantManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ServantManager: Dispatcher {
if m[facet] != nil {
var id = communicator.identityToString(ident)
if !facet.isEmpty {
id += try " - f " + escapeString(string: facet, special: "", communicator: communicator)
id += " -f \(facet)"
}
throw AlreadyRegisteredException(kindOfObject: "servant", id: id)
}
Expand All @@ -52,7 +52,7 @@ class ServantManager: Dispatcher {
guard var m = servantMapMap[ident], let obj = m.removeValue(forKey: facet) else {
var id = communicator.identityToString(ident)
if !facet.isEmpty {
id += try " - f " + escapeString(string: facet, special: "", communicator: communicator)
id += " -f \(facet)"
}
throw NotRegisteredException(kindOfObject: "servant", id: id)
}
Expand Down Expand Up @@ -125,8 +125,7 @@ class ServantManager: Dispatcher {
func addServantLocator(locator: ServantLocator, category: String) throws {
return try mutex.sync {
guard locatorMap[category] == nil else {
let id = try escapeString(string: category, special: "", communicator: communicator)
throw AlreadyRegisteredException(kindOfObject: "servant locator", id: id)
throw AlreadyRegisteredException(kindOfObject: "servant locator", id: category)
}

locatorMap[category] = locator
Expand All @@ -136,8 +135,7 @@ class ServantManager: Dispatcher {
func removeServantLocator(category: String) throws -> ServantLocator {
return try mutex.sync {
guard let l = locatorMap.removeValue(forKey: category) else {
let id = try escapeString(string: category, special: "", communicator: communicator)
throw NotRegisteredException(kindOfObject: "servant locator", id: id)
throw NotRegisteredException(kindOfObject: "servant locator", id: category)
}

return l
Expand Down
12 changes: 0 additions & 12 deletions swift/src/Ice/Util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ func stringToMajorMinor(_ s: String) throws -> (UInt8, UInt8) {
return (major, minor)
}

func escapeString(string: String, special: String, communicator: Communicator) throws -> String {
guard factoriesRegistered else {
fatalError("Unable to initialize Ice")
}
return try autoreleasepool {
try ICEUtil.escapeString(
string: string,
special: special,
communicator: (communicator as! CommunicatorI).handle)
}
}

func checkSupportedEncoding(_ v: EncodingVersion) throws {
let c = currentEncoding
if v.major != c.major || v.minor > c.minor {
Expand Down
30 changes: 0 additions & 30 deletions swift/src/IceImpl/IceUtil.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#import "include/Logger.h"
#import "include/Properties.h"

#import "Ice/Instance.h"
#import "Ice/Network.h"
#import "Ice/StringUtil.h"

namespace
Expand Down Expand Up @@ -180,32 +178,4 @@ + (NSString*)encodingVersionToString:(UInt8)major minor:(UInt8)minor
return toNSString(Ice::encodingVersionToString(v));
}

+ (NSString*)escapeString:(NSString*)string
special:(NSString*)special
communicator:(ICECommunicator*)communicator
error:(NSError* __autoreleasing _Nullable*)error
{
try
{
auto instance = IceInternal::getInstance([communicator communicator]);
return toNSString(
IceInternal::escapeString(fromNSString(string), fromNSString(special), instance->toStringMode()));
}
catch (...)
{
*error = convertException(std::current_exception());
return nil;
}
}

+ (NSString*)errorToString:(int32_t)error
{
return toNSString(IceInternal::errorToString(error));
}

+ (NSString*)errorToStringDNS:(int32_t)error
{
return toNSString(IceInternal::errorToStringDNS(error));
}

@end
19 changes: 0 additions & 19 deletions swift/src/IceImpl/TraceUtil.mm

This file was deleted.

9 changes: 0 additions & 9 deletions swift/src/IceImpl/include/IceUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ ICEIMPL_API @interface ICEUtil : NSObject

+ (NSString*)encodingVersionToString:(UInt8)major
minor:(UInt8)minor NS_SWIFT_NAME(encodingVersionToString(major:minor:));

+ (nullable NSString*)escapeString:(NSString*)string
special:(NSString*)special
communicator:(ICECommunicator*)communicator
error:(NSError* _Nullable* _Nullable)error
NS_SWIFT_NAME(escapeString(string:special:communicator:));

+ (NSString*)errorToString:(int32_t)error NS_SWIFT_NAME(errorToString(_:));
+ (NSString*)errorToStringDNS:(int32_t)error NS_SWIFT_NAME(errorToStringDNS(_:));
@end

NS_ASSUME_NONNULL_END
15 changes: 0 additions & 15 deletions swift/src/IceImpl/include/TraceUtil.h

This file was deleted.

Loading