git.fiddlerwoaroof.com
Browse code

fix warnings

Ed Langley authored on 10/03/2019 20:58:31
Showing 3 changed files
... ...
@@ -211,7 +211,7 @@ static NSStringEncoding PossibleSourceTextEncodings[] = {	NSUTF8StringEncoding,
211 211
     NSTextCheckingResult *match = [regex firstMatchInString:line options:NSMatchingAnchored range:NSMakeRange(0, [line length])];
212 212
     if (match)
213 213
     {
214
-        NSLog(@"%s", line);
214
+        NSLog(@"%s", [line UTF8String]);
215 215
         NSString *name = [line substringWithRange: [match rangeAtIndex:1]];
216 216
         [[attributes objectForKey:key] addObject:name];
217 217
         return YES;
... ...
@@ -7,7 +7,7 @@
7 7
 //  file.
8 8
 
9 9
 
10
-#import "NSData_HMExt.h"
10
+#import "NSData_HMext.h"
11 11
 #import "DebugLog.h"
12 12
 
13 13
 
... ...
@@ -17,13 +17,13 @@
17 17
 //
18 18
 // More or less taken from GnuStep's implementation of NSData.
19 19
 
20
-static BOOL readContentsOfFile(NSString* path, void** buf, unsigned int maxLen, unsigned int* len, NSZone* zone)
20
+static BOOL readContentsOfFile(NSString* path, void** buf, size_t maxLen, size_t* len, NSZone* zone)
21 21
 {
22 22
     const char	*thePath = 0;
23 23
     FILE		*theFile = 0;
24 24
     void		*tmp = 0;
25
-    int			c;
26
-    long		fileLength;
25
+    size_t			c;
26
+    size_t		fileLength;
27 27
     
28 28
     thePath = [path fileSystemRepresentation];
29 29
     if (thePath == 0)
... ...
@@ -79,7 +79,7 @@ static BOOL readContentsOfFile(NSString* path, void** buf, unsigned int maxLen,
79 79
     if (fileLength == 0)
80 80
     {
81 81
         unsigned char	buf[BUFSIZ];
82
-        unsigned bytesToRead = maxLen;
82
+        size_t bytesToRead = maxLen;
83 83
         /*
84 84
          * Special case ... a file of length zero may be a named pipe or some
85 85
          * file in the /proc filesystem, which will return us data if we read
... ...
@@ -186,7 +186,7 @@ failure:
186 186
 - (id) initWithContentsOfFile: (NSString*)path maxSize:(int)theMaxSize error:(NSError**)error
187 187
 {
188 188
     void		*fileBytes = NULL;
189
-    unsigned	fileLength = 0;
189
+    size_t	fileLength = 0;
190 190
     NSZone	*zone;
191 191
     
192 192
     zone = NSDefaultMallocZone();
... ...
@@ -195,7 +195,7 @@ failure:
195 195
         if (error)
196 196
         {
197 197
             NSNumber *errorCode = [NSNumber numberWithInt:errno];
198
-            NSString *errorDescription = [NSString stringWithCString:strerror(errno)];
198
+            NSString *errorDescription = [NSString stringWithCString:strerror(errno) encoding:NSUTF8StringEncoding];
199 199
             NSString* errorPath = path;
200 200
             NSMutableDictionary *errorAttribs = [NSMutableDictionary dictionaryWithCapacity:2];
201 201
             [errorAttribs setObject:errorCode forKey:@"Errno"];
... ...
@@ -6,8 +6,8 @@
6 6
 //  Licensed under the MIT license--see the accompanying LICENSE.txt
7 7
 //  file.
8 8
 
9
-#import "NSString_HMExt.h"
10
-#import "NSData_HMExt.h"
9
+#import "NSString_HMext.h"
10
+#import "NSData_HMext.h"
11 11
 
12 12
 @implementation NSString (NSString_ParsingExtensions)
13 13
 
... ...
@@ -71,7 +71,7 @@
71 71
 - (NSString*)initWithContentsOfFile:(NSString*)path maxSize:(int)theMaxSize encoding:(NSStringEncoding)theEncoding error:(NSError**)theError
72 72
 {
73 73
     NSData		*d;
74
-    unsigned int		len;
74
+    NSUInteger		len;
75 75
     const unsigned char	*data_bytes;
76 76
     
77 77
     d = [[NSData alloc] initWithContentsOfFile:path maxSize:theMaxSize error:theError];