Package: lusernet.app / 0.4.3-1

gcc-warnings.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
Description: Fix some GCC warnings.
 cast to pointer from integer of different size
 cast from pointer to integer of different size
 pointer targets in assignment differ in signedness
 pointer targets in passing argument N of 'foo' differ in signedness
 conflicting types for '-foo'
 'Foo' may not respond to '-bar'
 passing argument N of 'foo:' from distinct Objective-C type
 passing argument N of ‘foo:’ from incompatible pointer type
 '-foo' not found in protocol(s)
 @interface of class 'Foo' not found
 no '-foo' method found
 ignoring return value of 'foo', declared with attribute warn_unused_result
Author: Yavor Doganov <yavor@gnu.org>
Bug-Debian: http://bugs.debian.org/749758
Forwarded: no
Last-Update: 2019-01-24
---

--- lusernet.app.orig/NNTPServer.m
+++ lusernet.app/NNTPServer.m
@@ -590,9 +590,9 @@
 		int i,count=[runmodes count];
 		for (i=0;i<count;i++)
 		{
-			[runloop addEvent: (void *)c->sock type: ET_RDESC watcher: self
+		  [runloop addEvent: (void *)(intptr_t)c->sock type: ET_RDESC watcher: self
 				forMode: [runmodes objectAtIndex: i]];
-			[runloop addEvent: (void *)c->sock type: ET_EDESC watcher: self
+		  [runloop addEvent: (void *)(intptr_t)c->sock type: ET_EDESC watcher: self
 				forMode: [runmodes objectAtIndex: i]];
 		}
 	}
@@ -611,7 +611,7 @@
 	if (c->reg_write && !c->write_pending && c->sock>=0)
 	{
 		for (i=0;i<count;i++)
-			[runloop removeEvent: (void *)c->sock type: ET_WDESC
+		  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_WDESC
 				forMode: [runmodes objectAtIndex: i] all: YES];
 		c->reg_write=0;
 	}
@@ -619,7 +619,7 @@
 	if (!c->reg_write && c->write_pending && c->sock>=0)
 	{
 		for (i=0;i<count;i++)
-			[runloop addEvent: (void *)c->sock type: ET_WDESC watcher: self
+		  [runloop addEvent: (void *)(intptr_t)c->sock type: ET_WDESC watcher: self
 				forMode: [runmodes objectAtIndex: i]];
 		c->reg_write=1;
 	}
@@ -684,11 +684,11 @@
 		int i,count=[runmodes count];
 		for (i=0;i<count;i++)
 		{
-			[runloop removeEvent: (void *)c->sock type: ET_RDESC
+		  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_RDESC
 				forMode: [runmodes objectAtIndex: i] all: YES];
-			[runloop removeEvent: (void *)c->sock type: ET_WDESC
+		  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_WDESC
 				forMode: [runmodes objectAtIndex: i] all: YES];
-			[runloop removeEvent: (void *)c->sock type: ET_EDESC
+		  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_EDESC
 				forMode: [runmodes objectAtIndex: i] all: YES];
 		}
 	}
@@ -956,11 +956,11 @@
 			close(c->sock);
 			for (i=0;i<count;i++)
 			{
-				[runloop removeEvent: (void *)c->sock type: ET_RDESC
+			  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_RDESC
 					forMode: [runmodes objectAtIndex: i] all: YES];
-				[runloop removeEvent: (void *)c->sock type: ET_EDESC
+			  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_EDESC
 					forMode: [runmodes objectAtIndex: i] all: YES];
-				[runloop removeEvent: (void *)c->sock type: ET_WDESC
+			  [runloop removeEvent: (void *)(intptr_t)c->sock type: ET_WDESC
 					forMode: [runmodes objectAtIndex: i] all: YES];
 			}
 			c->sock=-1;
@@ -1067,7 +1067,7 @@
 	con_t *c;
 	int i,j;
 //	printf("--- got event %i type %i extra %p\n",(int)data,type,extra);
-	j=(int)data;
+	j=(intptr_t)data;
 	for (i=0,c=cons;i<num_cons;i++,c++)
 		if (c->sock==j)
 			break;
--- lusernet.app.orig/NNTPSource.m
+++ lusernet.app/NNTPSource.m
@@ -16,6 +16,7 @@
 #import <Foundation/NSException.h>
 #import <Foundation/NSDictionary.h>
 #import <Foundation/NSBundle.h>
+#import <AppKit/NSWindowController.h>
 
 #import "MsgDB.h"
 
@@ -24,6 +25,7 @@
 #import "NNTPSourceGUI.h"
 
 #import "NNTPServer.h"
+#import "ComposeWindowController.h"
 
 
 typedef struct nntpsource_group_s group_t;
@@ -351,7 +353,7 @@
 -(void) nntp_postArticle: (BOOL)success  qid: (unsigned int)qid
 {
 	NSNumber *n=[[NSNumber alloc] initWithInt: qid];
-	NSObject *w;
+	id w;
 
 	w=[request_map objectForKey: n];
 	if (!w)
--- lusernet.app.orig/MsgDB.m
+++ lusernet.app/MsgDB.m
@@ -26,7 +26,14 @@
 
 #define HASH_SIZE (1031*5)
 
-
+/* Convenience macro to print information if errors occur when parsing
+   the database.  It is necessary to abort, otherwise a broken file is
+   going to be saved by -syncToDisk when the app exits normally.  */
+#define READFAIL(function,what) \
+  { \
+    NSLog(@"%@ failed while reading %@", function, what); \
+    abort(); \
+  }
 
 NSString
 	*MsgDB_MsgDStatusNotification=@"MsgDB_MsgDStatusNotification",
@@ -139,7 +146,7 @@
 	msg_id_t hash_next;
 
 	int dstatus;
-	char *data;
+	unsigned char *data;
 	int data_length;
 
 	unsigned int src_get_id;
@@ -726,36 +733,43 @@
 		mhidx[i]=-1;
 	for (i=0;i<nmh;i++)
 	{
-		fscanf(f,"%i ",&j);
+	  if (fscanf(f,"%i ",&j) < 1)
+	    READFAIL(@"fscanf", @"length of metaheaders");
 		mhname[i]=malloc(j+1);
-		fread(mhname[i],1,j,f);
+		if (fread(mhname[i],1,j,f) < 1)
+		  READFAIL(@"fread", @"metaheaders");
 		mhname[i][j]=0;
 		fgetc(f);
 	}
-	fscanf(f,"%i\n",&num_messages);
+	if (fscanf(f,"%i\n",&num_messages) != 1)
+	  READFAIL(@"fscanf", @"total number of messages");
 	messages=malloc(sizeof(message_t)*num_messages);
 	memset(messages,0,sizeof(message_t)*num_messages);
 	if (!messages) abort();
 	for (i=1,m=messages+1;i<num_messages;i++,m++)
 	{
-		fscanf(f,"%i %i ",&m->num_mhs,&l);
+	  if (fscanf(f,"%i %i ",&m->num_mhs,&l) < 1)
+	    READFAIL(@"fscanf", @"length of message-ids");
 		m->message_id=malloc(l+1);
 		if (!m->message_id) abort();
-		fread(m->message_id,1,l,f);
+		if (fread(m->message_id,1,l,f) < 1)
+		  READFAIL(@"fread", @"message-ids");
 		m->message_id[l]=0;
 		fgetc(f);
 		m->mhs=malloc(sizeof(meta_header_t)*m->num_mhs);
 		if (!m->mhs) abort();
 		for (j=0;j<m->num_mhs;j++)
 		{
-			fscanf(f,"%i %i",&k,&l);
+		  if (fscanf(f,"%i %i",&k,&l) < 1)
+		    READFAIL(@"fscanf", @"length of all headers");
 			fgetc(f);
 			if (mhidx[k]==-1)
 				mhidx[k]=[self getMetaHeaderNum: mhname[k]];
 			m->mhs[j].mhid=mhidx[k];
 			m->mhs[j].value=malloc(l+1);
 			if (!m->mhs[j].value) abort();
-			fread(m->mhs[j].value,1,l,f);
+			if (fread(m->mhs[j].value,1,l,f) == 0)
+			  NSLog(@"All headers read");
 			m->mhs[j].value[l]=0;
 			fgetc(f);
 		}
--- lusernet.app.orig/MessageViewController.m
+++ lusernet.app/MessageViewController.m
@@ -232,7 +232,7 @@
 	{
 		int disp;
 
-		if (cur_options && (disp=(int)NSMapGet(cur_options,mp)))
+		if (cur_options && (disp=(intptr_t)NSMapGet(cur_options,mp)))
 			disp--;
 		else
 			disp=[mp count]-1;
@@ -418,7 +418,7 @@
 	if (d)
 	{
 		append(str,nil,@"   ");
-		if (cur_options && ((int)NSMapGet(cur_options,p))==1)
+		if (cur_options && ((intptr_t)NSMapGet(cur_options,p))==1)
 		{
 			appendLink(str,LINK_DATA_SHOW,p,0,_(@"Hide raw data"));
 			dbytes=[d length];
@@ -433,7 +433,7 @@
 
 	append(str,nil,@"   ");
 
-	if (cur_options && ((int)NSMapGet(cur_options,p))==2)
+	if (cur_options && ((intptr_t)NSMapGet(cur_options,p))==2)
 	{
 		appendLink(str,LINK_DATA_SHOW_TEXT,p,0,_(@"Hide text"));
 	}
@@ -478,7 +478,7 @@
 				append(str,fd,@".\n");
 			return;
 		}
-		else if (((int)NSMapGet(cur_options,p))==2)
+		else if (((intptr_t)NSMapGet(cur_options,p))==2)
 		{ /* TODO: do this cleaner? automatically? */
 			if (d)
 			{ /* TODO? if it's data, pretend it's ASCII and try to handle again? */
@@ -813,7 +813,7 @@
 	{
 		if (!cur_options)
 			return YES; /* shouldn't happen */
-		NSMapInsert(cur_options,l->object,(void *)l->value);
+		NSMapInsert(cur_options,l->object,(void *)(intptr_t)l->value);
 		[self displayMessage];
 		return YES;
 	}
@@ -822,7 +822,7 @@
 	{
 		if (!cur_options)
 			return YES;
-		if (((int)NSMapGet(cur_options,l->object))==1)
+		if (((intptr_t)NSMapGet(cur_options,l->object))==1)
 			NSMapRemove(cur_options,l->object);
 		else
 			NSMapInsert(cur_options,l->object,(void *)1);
@@ -833,7 +833,7 @@
 	{
 		if (!cur_options)
 			return YES;
-		if (((int)NSMapGet(cur_options,l->object))==2)
+		if (((intptr_t)NSMapGet(cur_options,l->object))==2)
 			NSMapRemove(cur_options,l->object);
 		else
 			NSMapInsert(cur_options,l->object,(void *)2);
--- lusernet.app.orig/main.m
+++ lusernet.app/main.m
@@ -27,6 +27,7 @@
 #import "FolderWindowController.h"
 #import "FolderListController.h"
 #import "ComposeWindowController.h"
+#import "NNTPSource.h"
 
 
 #import "main.h"
@@ -88,9 +89,9 @@
 }
 
 
--(void) postArticleFrom: (id)sender : (const unsigned char *)data : (int)length
+-(void) postArticleFrom: (id)sender : (unsigned char *)data : (int)length
 { /* TODO */
-	NSObject<Msg_Source> *src;
+	id src;
 
 //	fprintf(stderr,"post article %@\n",sender);
 	src=[[mdb sources] objectAtIndex: 0];
--- lusernet.app.orig/FolderWindowController.m
+++ lusernet.app/FolderWindowController.m
@@ -56,7 +56,7 @@
 #define SORT_R_ORDER         9
 #define SORT_MAX             9
 
-static int sort_subject(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_subject(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	NSString *s1,*s2;
 	s1=[ft subjectForMessage: [n1 unsignedIntValue]];
@@ -64,7 +64,7 @@
 	return [s1 localizedCaseInsensitiveCompare: s2];
 }
 
-static int sort_from(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_from(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	NSString *s1,*s2;
 	s1=[ft fromForMessage: [n1 unsignedIntValue]];
@@ -72,7 +72,7 @@
 	return [s1 localizedCaseInsensitiveCompare: s2];
 }
 
-static int sort_date(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_date(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	NSDate *d1,*d2;
 	d1=[ft dateForMessage: [n1 unsignedIntValue]];
@@ -82,23 +82,23 @@
 }
 
 
-static int sort_r_subject(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_r_subject(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	return -sort_subject(n1,n2,ft);
 }
 
-static int sort_r_from(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_r_from(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	return -sort_from(n1,n2,ft);
 }
 
-static int sort_r_date(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_r_date(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	return -sort_date(n1,n2,ft);
 }
 
 
-static int sort_order(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_order(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	if (ft->msgs[[n1 unsignedIntValue]].mid<ft->msgs[[n2 unsignedIntValue]].mid)
 		return NSOrderedAscending;
@@ -106,7 +106,7 @@
 		return NSOrderedDescending;
 }
 
-static int sort_r_order(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
+static NSComparisonResult sort_r_order(NSNumber *n1,NSNumber *n2,FolderThreader *ft)
 {
 	if (ft->msgs[[n1 unsignedIntValue]].mid>ft->msgs[[n2 unsignedIntValue]].mid)
 		return NSOrderedAscending;
@@ -115,7 +115,7 @@
 }
 
 
-static int (*(sort_funcs[SORT_MAX+1]))(NSNumber *,NSNumber *,FolderThreader *ft)=
+static NSComparisonResult (*(sort_funcs[SORT_MAX+1]))(NSNumber *,NSNumber *,FolderThreader *ft)=
 {NULL,NULL,
 sort_subject,sort_from,sort_date,sort_order,
 sort_r_subject,sort_r_from,sort_r_date,sort_r_order};
@@ -424,7 +424,7 @@
 				[idx release];
 			}
 		}
-		[sorted_msgs sortUsingFunction: (int(*)(id,id,void *))sort_funcs[sort_mode] context: ft];
+		[sorted_msgs sortUsingFunction: (NSComparisonResult(*)(id,id,void *))sort_funcs[sort_mode] context: ft];
 	}
 
 	[list reloadData];