Skip to content

Commit

Permalink
Add some scope attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Sep 18, 2020
1 parent 9f286ef commit 44872dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions source/desktopfile/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public:
* It applies unquoting and unescaping.
* See_Also: $(D execValue), $(D desktopfile.utils.expandExecArgs), $(D start)
*/
@safe string[] expandExecValue(in string[] urls = null, string locale = null) const
@safe string[] expandExecValue(scope const(string)[] urls = null, string locale = null) const
{
return expandExecArgs(unquoteExec(execValue()), urls, localizedIconName(locale), localizedDisplayName(locale));
}
Expand All @@ -92,7 +92,7 @@ public:
* $(D desktopfile.utils.DesktopExecException) if exec string is invalid.
* See_Also: $(D execValue), $(D desktopfile.utils.spawnApplication)
*/
@safe void start(in string[] urls, string locale = null) const
@safe void start(scope const(string)[] urls, string locale = null) const
{
auto unquotedArgs = unquoteExec(execValue());

Expand Down Expand Up @@ -1150,7 +1150,7 @@ Type=Directory`;
* It applies unquoting and unescaping.
* See_Also: $(D execValue), $(D desktopfile.utils.expandExecArgs), $(D startApplication)
*/
@safe string[] expandExecValue(in string[] urls = null, string locale = null) const
@safe string[] expandExecValue(scope const(string)[] urls = null, string locale = null) const
{
return expandExecArgs(unquoteExec(execValue()), urls, localizedIconName(locale), localizedDisplayName(locale), fileName());
}
Expand Down Expand Up @@ -1185,7 +1185,7 @@ Icon[ru]=folder_ru`;
* $(D desktopfile.utils.DesktopExecException) if exec string is invalid.
* See_Also: $(D desktopfile.utils.spawnApplication), $(D desktopfile.utils.getTerminalCommand), $(D start), $(D expandExecValue)
*/
@trusted void startApplication(in string[] urls = null, string locale = null, lazy const(string)[] terminalCommand = getTerminalCommand) const
@trusted void startApplication(scope const(string)[] urls = null, string locale = null, lazy const(string)[] terminalCommand = getTerminalCommand) const
{
auto unquotedArgs = unquoteExec(execValue());

Expand Down
16 changes: 8 additions & 8 deletions source/desktopfile/utils.d
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct SpawnParams
bool allowMultipleInstances = true;
}

private @trusted void execProcess(in string[] args, string workingDirectory = null)
private @trusted void execProcess(scope const(string)[] args, string workingDirectory = null)
{
spawnProcess(args, getNullStdin(), getNullStdout(), getNullStderr(), null, Config.detached, workingDirectory);
}
Expand Down Expand Up @@ -162,7 +162,7 @@ private @safe bool needQuoting(char c) nothrow pure
}
}

private @safe bool needQuoting(string arg) nothrow pure
private @safe bool needQuoting(scope string arg) nothrow pure
{
if (arg.length == 0) {
return true;
Expand Down Expand Up @@ -334,7 +334,7 @@ private @trusted string urlToFilePath(string url) nothrow pure
* $(D DesktopExecException) if command line contains unknown field code.
* See_Also: $(D unquoteExec)
*/
@trusted string[] expandExecArgs(in string[] unquotedArgs, in string[] urls = null, string iconName = null, string displayName = null, string fileName = null) pure
@trusted string[] expandExecArgs(scope const(string)[] unquotedArgs, scope const(string)[] urls = null, string iconName = null, string displayName = null, string fileName = null) pure
{
string[] toReturn;
foreach(token; unquotedArgs) {
Expand Down Expand Up @@ -479,7 +479,7 @@ enum ParamSupport
* execArgs = Array of unescaped and unquoted arguments.
* See_Also: $(D unquoteExec), $(D needMultipleInstances)
*/
@nogc @safe ParamSupport paramSupport(in string[] execArgs) pure nothrow
@nogc @safe ParamSupport paramSupport(scope const(string)[] execArgs) pure nothrow
{
auto support = ParamSupport.none;
foreach(token; execArgs) {
Expand Down Expand Up @@ -528,7 +528,7 @@ unittest
* Returns: true if execArgs have only %f or %u and not %F or %U. Otherwise false is returned.
* See_Also: $(D unquoteExec), $(D paramSupport)
*/
@nogc @safe bool needMultipleInstances(in string[] execArgs) pure nothrow
@nogc @safe bool needMultipleInstances(scope const(string)[] execArgs) pure nothrow
{
auto support = paramSupport(execArgs);
const bool noNeed = support == ParamSupport.none || (support & (ParamSupport.urls|ParamSupport.files)) != 0;
Expand Down Expand Up @@ -774,7 +774,7 @@ unittest
}
}

package void xdgOpen(string url)
package void xdgOpen(scope string url)
{
execProcess(["xdg-open", url]);
}
Expand Down Expand Up @@ -834,7 +834,7 @@ struct FireOptions
bool allowMultipleInstances = true;
}

package bool readDesktopEntryValues(IniLikeReader)(IniLikeReader reader, string locale, string fileName,
package bool readDesktopEntryValues(IniLikeReader)(IniLikeReader reader, scope string locale, string fileName,
out string iconName, out string name,
out string execValue, out string url,
out string workingDirectory, out bool terminal)
Expand Down Expand Up @@ -1170,7 +1170,7 @@ static if (isFreedesktop)
* This function should be applicable only to desktop files of $(D desktopfile.file.DesktopEntry.Type.Application) type.
* Note: Always returns true on non-posix systems.
*/
@trusted bool isTrusted(string appFileName) nothrow
@trusted bool isTrusted(scope string appFileName) nothrow
{
version(Posix) {
import core.sys.posix.sys.stat;
Expand Down

0 comments on commit 44872dc

Please sign in to comment.