Permalink
Browse files

Changes for 2.059

Add trusted and nothrow methods
update to const ref GUID
  • Loading branch information...
JesseKPhillips committed May 15, 2012
1 parent a4c7abb commit ff994a8da62e8891e9f88e00db1d66e1ce0d2353
Showing with 26 additions and 11 deletions.
  1. +1 −1 juno/com/client.d
  2. +1 −1 juno/io/filesystem.d
  3. +1 −1 juno/locale/convert.d
  4. +23 −8 juno/net/core.d
View
@@ -523,7 +523,7 @@ class EventProvider(T) : Implements!(T) {
extern(Windows):
- override int Invoke(int dispIdMember, ref GUID riid, uint lcid, ushort wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, uint* puArgError) {
+ override int Invoke(int dispIdMember, const ref GUID riid, uint lcid, ushort wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, uint* puArgError) {
if (riid != GUID.empty)
return DISP_E_UNKNOWNINTERFACE;
View
@@ -742,7 +742,7 @@ class Watcher {
if (isHandleInvalid)
throw new FileNotFoundException("Unable to find the specified file.", directory_);
- auto completionPortThread = new Thread({
+ auto completionPortThread = new Thread(function() {
uint errorCode;
uint numBytes;
uint key;
View
@@ -14,7 +14,7 @@ private import juno.base.core,
/**
* Converts the specified _value to its equivalent string representation.
*/
-string toString(T)(T value, string format = null, IFormatProvider provider = null) {
+string toString(T)(T value, string format = null, IFormatProvider provider = null) @trusted {
static if (is(T == ubyte)
|| is(T == ushort)
|| is(T == uint))
View
@@ -162,8 +162,16 @@ class Uri {
}
override hash_t toHash() {
- string hashString = getComponents(UriComponents.SchemeAndServer | UriComponents.PathAndQuery);
- return typeid(string).getHash(&hashString);
+ string hashString;
+ try hashString = getComponents(UriComponents.SchemeAndServer | UriComponents.PathAndQuery);
+ catch(Exception) {
+ /* Don't need to do anything */
+ }
+ return safeHash(hashString);
+ }
+
+ hash_t safeHash(string s) @trusted nothrow {
+ return typeid(string).getHash(&s);
}
/**
@@ -207,7 +215,7 @@ class Uri {
* Gets the specified _components.
* Params: components = Specifies which parts of the URI to return.
*/
- final string getComponents(UriComponents components) {
+ final string getComponents(UriComponents components) @safe {
if (!isAbsolute)
throw new InvalidOperationException("This operation is not supported for a relative URI.");
@@ -317,14 +325,14 @@ class Uri {
/**
* Indicates whether the instance is absolute.
*/
- final @property bool isAbsolute() {
+ final @property bool isAbsolute() @safe nothrow {
return scheme_ != null;
}
/**
* Indicates whether the instance is a file URI.
*/
- final @property bool isFile() {
+ final @property bool isFile() @safe nothrow {
return scheme_ == fileScheme.schemeName;
}
@@ -395,7 +403,7 @@ class Uri {
/**
* Indicates whether the port value of the URI is the default for this scheme.
*/
- @property bool isDefaultPort() {
+ @property bool isDefaultPort() @safe nothrow {
return (getDefaultPort(scheme_) == port_);
}
@@ -520,8 +528,8 @@ class Uri {
}
}
- private int getDefaultPort(string scheme) {
- scheme = scheme.toLower();
+ private int getDefaultPort(string scheme) @safe nothrow {
+ scheme = scheme.safeToLower();
if (scheme == httpScheme.schemeName)
return httpScheme.defaultPort;
@@ -1687,3 +1695,10 @@ bool ping(string hostNameOrAddress, uint timeout = Ping.DEFAULT_TIMEOUT) {
scope sender = new Ping;
return (sender.send(hostNameOrAddress, timeout).status == IPStatus.Success);
}
+
+@property string safeToLower(string s) @trusted nothrow {
+ try return s.toLower();
+ catch(Exception)
+ return "";
+}
+

0 comments on commit ff994a8

Please sign in to comment.