#4 Fixes for "seticon"

open
nobody
None
5
2008-11-27
2008-11-27
Anonymous
No

A couple of fixes for file "main.m" in the "seticon" utility:

The first change is at line 119. No encoding is specified for the
NSString built from the command line parameters, which leads to failure
if the string contains unusual characters. Specifying UTF8 fixes this:

dstPath = [NSString stringWithCString: (char *)argv[optind]
encoding: NSUTF8StringEncoding];

The second I *think* is a bug; line 100 reads the icon source path from
index "optind", but does not also increment "optind". This means the
processing loop later on applies the icon both back to the icon source
file, as well as the real file or folder which the user had expected to
alter. Changing line 100 as follows prevents this:

FROM
(char *)src = (char *)argv[optind];
TO
src = (char *)argv[optind++];

Note the cast is removed because it is unnecessary ("src" is already a
"char *") and Xcode warns about it, saying that it will become a hard
error in future.

Discussion


Log in to post a comment.