View Issue Details

IDProjectCategoryView StatusLast Update
0002553SOGoSOPEpublic2014-02-04 08:58
Reporterbuzzdee Assigned Toludovic  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformamd64OSOpenBSDOS Version5.4-current
Product Version2.1.1b 
Target Version2.2.0Fixed in Version2.2.0 
Summary0002553: fix compilation warnings in sope-core/NGExtensions/FdExt
Description

attached patch fixes the following warnings:

NSProcessInfo+misc.m:71:48: warning: format specifies type 'unsigned int' but the argument has type 'time_t' (aka 'long long') [-Wformat]
@"%04X%X%02X.tmp", getpid(), time(NULL),
~~ ^~~~~~
%llX
1 warning generated.
NSString+Ext.m:76:36: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
for (idx = (len - 1); (idx >= 0) && (buf[idx] == 32); idx--)


1 warning generated.
NSString+Encoding.m:200:13: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
  if ((type == (iconv_t)-1)) {
       ~~~~~^~~~~~~~~~~~~~
NSString+Encoding.m:200:13: note: remove extraneous parentheses around the comparison to silence this warning
  if ((type == (iconv_t)-1)) {
      ~     ^             ~
NSString+Encoding.m:200:13: note: use '=' to turn this equality comparison into an assignment
  if ((type == (iconv_t)-1)) {
            ^~
            =
1 warning generated.
NSString+Escaping.m:74:24: warning: protocol has no object type specified; defaults to qualified 'id'
  usingStringEscaping:(<NGStringEscaping>)_esc
                       ^~~~~~~~~~~~~~~~~~
                       id
1 warning generated.
NSString+misc.m:60:5: warning: 'NSStringVariableBindingException' may not respond to 'initWithFormat:'
           initWithFormat:@"did not find end of variable for string %@", self]
           ^
NSString+misc.m:88:3: warning: 'NSStringVariableBindingException' may not respond to 'initWithFormat:'
         initWithFormat:@"did not find end of variable for string %@", self]
         ^
NSString+misc.m:123:5: warning: 'NSStringVariableBindingException' may not respond to 'initWithFormat:'
           initWithFormat:@"did not find end of variable for string %@", self]
           ^
NSString+misc.m:149:7: warning: 'NSStringVariableBindingException' may not respond to 'initWithFormat:'
             initWithFormat:@"did not find end of variable for string %@", 
             ^
NSString+misc.m:163:27: warning: 'NSStringVariableBindingException' may not respond to 'initWithFormat:'
                          initWithFormat:@"did not find binding for "
                          ^
5 warnings generated.
NGPropertyListParser.m:459:35: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
            for (pos = _idx; (pos >= 0) && (_buffer[pos] != '\n'); pos--)
                              ~~~ ^  ~
1 warning generated.
TagsNo tags attached.

Activities

buzzdee

buzzdee

2013-12-18 01:14

reporter  

fix-warnings-in-sope-core-NGExtensions-FdExt.diff (6,006 bytes)   
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NGPropertyListParser.m.orig	Mon Dec 16 07:37:27 2013
+++ sope-core/NGExtensions/FdExt.subproj/NGPropertyListParser.m	Mon Dec 16 07:38:24 2013
@@ -456,7 +456,7 @@ static NSException *_makeException(NSException *_excep
             register unsigned pos;
             const unsigned char *startPos, *endPos;
 
-            for (pos = _idx; (pos >= 0) && (_buffer[pos] != '\n'); pos--)
+            for (pos = _idx; (pos > 0) && (_buffer[pos] != '\n'); pos--)
                 ;
             startPos = &(_buffer[pos + 1]);
 
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m.orig	Wed Dec  4 17:51:26 2013
+++ sope-core/NGExtensions/FdExt.subproj/NSProcessInfo+misc.m	Tue Dec 17 07:11:27 2013
@@ -68,7 +68,7 @@
   NSString *s;
   cnt++;
   s = [NSString stringWithFormat:
-                  @"%04X%X%02X.tmp", getpid(), time(NULL),
+                  @"%04X%llX%02X.tmp", getpid(), (long long)time(NULL),
                   cnt];
   return [_prefix stringByAppendingString:s];
 }
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m.orig	Mon Dec 16 07:15:13 2013
+++ sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m	Mon Dec 16 07:16:45 2013
@@ -197,7 +197,7 @@ static char *iconv_wrapper(id self, char *_src, unsign
   inbuf      = NULL;
   outbuf     = NULL;
   
-  if ((type == (iconv_t)-1)) {
+  if (type == (iconv_t)-1) {
     [self logWithFormat:@"%s: Could not handle iconv encoding. FromEncoding:%@"
           @" to encoding:%@", __PRETTY_FUNCTION__, _fromEncode, _toEncode];
     goto CLEAR_AND_RETURN;
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NSString+Escaping.m.orig	Mon Dec 16 07:17:30 2013
+++ sope-core/NGExtensions/FdExt.subproj/NSString+Escaping.m	Mon Dec 16 07:18:17 2013
@@ -71,7 +71,7 @@
 }
 
 - (NSString *)stringByEscapingCharactersFromSet:(NSCharacterSet *)_escSet
-  usingStringEscaping:(<NGStringEscaping>)_esc
+  usingStringEscaping:(id <NGStringEscaping>)_esc
 {
   NSMutableString *safeString;
   unsigned length;
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NSString+Ext.m.orig	Mon Dec 16 07:11:20 2013
+++ sope-core/NGExtensions/FdExt.subproj/NSString+Ext.m	Mon Dec 16 07:14:18 2013
@@ -64,16 +64,16 @@
 - (NSString *)stringByTrimmingTailWhiteSpaces
 {
     // should check 'whitespaceAndNewlineCharacterSet' ..
-    unsigned len;
+    NSUInteger len;
     
     if ((len = [self length]) > 0) {
         unichar  *buf;
-        unsigned idx;
+        NSUInteger idx;
         
         buf = calloc(len + 1, sizeof(unichar));
         [self getCharacters:buf];
 
-        for (idx = (len - 1); (idx >= 0) && (buf[idx] == 32); idx--)
+        for (idx = (len - 1); (idx > 0) && (buf[idx] == 32); idx--)
             ;
         
         self = [NSString stringWithCharacters:buf length:(idx + 1)];
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NSString+misc.m.orig	Wed Dec  4 17:51:26 2013
+++ sope-core/NGExtensions/FdExt.subproj/NSString+misc.m	Tue Dec 17 07:15:41 2013
@@ -23,12 +23,6 @@
 #include "NSString+misc.h"
 #include "common.h"
 
-@interface NSStringVariableBindingException : NSException
-@end
-
-@implementation NSStringVariableBindingException
-@end
-
 @implementation NSObject(StringBindings)
 
 - (NSString *)valueForStringBinding:(NSString *)_key {
@@ -56,9 +50,10 @@
     
     if (pos + 1 == len) { /* last entry */
       if (wbuf[pos] == '$') { /* found $ without end-char */
-        [[[NSStringVariableBindingException alloc]
-	   initWithFormat:@"did not find end of variable for string %@", self]
-	   raise];
+	[[NSException exceptionWithName: @"NSStringVariableBindingException"
+		reason:[NSString stringWithFormat:
+			@"did not find end of variable for string %@", self]
+		userInfo:nil] raise];
       }
       break;
     }
@@ -84,9 +79,10 @@
 	break;
     }
     if (pos == len) { /* end of string was reached */
-      [[[NSStringVariableBindingException alloc]
-	 initWithFormat:@"did not find end of variable for string %@", self]
-	 raise];
+	[[NSException exceptionWithName: @"NSStringVariableBindingException"
+		reason:[NSString stringWithFormat:
+			@"did not find end of variable for string %@", self]
+		userInfo:nil] raise];
     }
     else {
       NSString *key = nil;
@@ -119,9 +115,10 @@
   while (pos < len) {
     if (pos + 1 == len) { /* last entry */
       if (wbuf[pos] == '$') { /* found $ without end-char */
-        [[[NSStringVariableBindingException alloc]
-	   initWithFormat:@"did not find end of variable for string %@", self]
-	  raise];
+	[[NSException exceptionWithName: @"NSStringVariableBindingException"
+		reason:[NSString stringWithFormat:
+			@"did not find end of variable for string %@", self]
+		userInfo:nil] raise];
       }
       break;
     }
@@ -145,9 +142,10 @@
             break;
         }
         if (pos == len) { /* end of string was reached */
-          [[[NSStringVariableBindingException alloc]
-	     initWithFormat:@"did not find end of variable for string %@", 
-	     self] raise];
+	[[NSException exceptionWithName: @"NSStringVariableBindingException"
+		reason:[NSString stringWithFormat:
+			@"did not find end of variable for string %@", self]
+		userInfo:nil] raise];
 	}
         else {
           NSString *key;
@@ -159,10 +157,13 @@
 	  
           if ((value = [_bindings valueForStringBinding:key]) == nil) {
             if (_unknown == nil) {
-              [[[NSStringVariableBindingException alloc]
-                          initWithFormat:@"did not find binding for "
-                                         @"name %@ in binding-dictionary %@",
-                                         [key autorelease], _bindings] raise];
+		[[NSException exceptionWithName:
+			@"NSStringVariableBindingException"
+			reason:[NSString stringWithFormat:
+				@"did not find binding for "
+				@"name %@ in binding-dictionary %@",
+				[key autorelease], _bindings]
+			userInfo:nil] raise];
             }
             else
               value = _unknown;
buzzdee

buzzdee

2014-01-15 13:29

reporter   ~0006397

ping

ludovic

ludovic

2014-02-04 08:58

administrator   ~0006483

https://github.com/inverse-inc/sope/commit/0261eafb19da1e46be7ed589ef9517007793b875

Issue History

Date Modified Username Field Change
2013-12-18 01:14 buzzdee New Issue
2013-12-18 01:14 buzzdee File Added: fix-warnings-in-sope-core-NGExtensions-FdExt.diff
2014-01-15 13:29 buzzdee Note Added: 0006397
2014-02-03 19:06 ludovic Target Version => 2.2.0
2014-02-04 08:58 ludovic Note Added: 0006483
2014-02-04 08:58 ludovic Status new => closed
2014-02-04 08:58 ludovic Assigned To => ludovic
2014-02-04 08:58 ludovic Resolution open => fixed
2014-02-04 08:58 ludovic Fixed in Version => 2.2.0