aboutsummaryrefslogtreecommitdiffstats
path: root/main/snownews/openssl-1.1.patch
blob: c0fb5e86cec5545909dd93a1977101d17d850ac7 (plain) (blame)
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
From cff110ac98012042c58694169d5722eb55f60635 Mon Sep 17 00:00:00 2001
From: Mike Sharov <msharov@users.sourceforge.net>
Date: Wed, 25 Apr 2018 11:17:06 -0400
Subject: [PATCH] Make it compile cleanly 	Fix openssl MD5 hash
 calculations; context struct is private 		and must be created
 with helper functions. 	Add -Wextra to compile flags and fix all
 warnings.

---
 about.c          | 125 +++++++++++++-------------
 configure        |   2 +-
 conversions.c    | 222 ++++++++++++++++++++++-------------------------
 conversions.h    |   4 +-
 digcalc.c        | 189 ++++++++++++++--------------------------
 digcalc.h        |  39 +++------
 interface.c      |   2 +-
 main.c           |  10 +--
 netio.c          |   2 +-
 os-support.c     |  26 ++----
 os-support.h     |   6 +-
 ui-support.c     |   2 +-
 updatecheck.c    |   2 -
 xmlparse.c       |   8 +-
 zlib_interface.c |  41 ++++-----
 zlib_interface.h |   2 -
 16 files changed, 284 insertions(+), 398 deletions(-)

diff --git a/about.c b/about.c
index 2bff040..753e7db 100644
--- a/about.c
+++ b/about.c
@@ -117,15 +117,15 @@ void Snowfall (int christmastree) {
 	int wind = 1;			/* 1: wind active, 0: inactive 
 							   set to 1 here so the first loop run clears it. */
 	int newflake = 0;		/* Time until a new flake appears. */
-	
+
 	/* Set ncurses halfdelay mode. */
 	halfdelay (3);
-	
+
 	/* White snowflakes! */
 	/* Doesn't work on white terminal background... obviously.
 	attron (COLOR_PAIR(16));
 	attron (WA_BOLD); */
-	
+
 	while (1) {
 		/* Set up the storm. */
 		if (windtimer == 0) {
@@ -161,7 +161,7 @@ void Snowfall (int christmastree) {
 			new->oldchar = new->oldchar2 = ' ';
 			new->vspeed = 1+(float)rand() / (float)RAND_MAX * 2;
 			new->hspeed = (1+(float)rand() / (float)RAND_MAX * 7)-4;
-			
+
 			/* Add our new snowflake to the pointer chain. */
 			new->next = NULL;
 			if (first == NULL) {
@@ -173,7 +173,7 @@ void Snowfall (int christmastree) {
 					new->prev = new->prev->next;
 				new->prev->next = new;
 			}
-			
+
 			/* Set new counter until next snowflake. */
 			newflake = 1+(float)rand() / (float)RAND_MAX * 2;
 			/*
@@ -181,7 +181,7 @@ void Snowfall (int christmastree) {
 			mvprintw (1,1,"New flake in %d rounds.", newflake);
 			*/
 		}
-		
+
 		for (cur = first; cur != NULL; cur = curnext) {
 			curnext = cur->next;
 			/* Draw every snowflake at its coordinates to the screen. */
@@ -204,7 +204,7 @@ void Snowfall (int christmastree) {
 					if ((cur->oldx < 14) && (cur->oldx > 9) && (cur->oldy < 24) && (cur->oldy > 20)) {
 						attroff (COLOR_PAIR(12));
 					}
-					
+
 					if (christmastree)
 						ChristmasTree();
 				}
@@ -214,7 +214,7 @@ void Snowfall (int christmastree) {
 			}
 			/* Set new hspeed for flake */
 			cur->hspeed = (1+(float)rand() / (float)RAND_MAX * 7)-4;
-			
+
 			/* Advance every flake downwards by a random amount and to
 			   the left or right.
 			   Check if the next position would obscure a character on the screen
@@ -223,7 +223,7 @@ void Snowfall (int christmastree) {
 			if (wind)
 				cur->hspeed += windspeed;
 			cur->x += cur->hspeed;
-			
+
 			if (cur->y > LINES) {
 				if (cur == first) {
 					first = first->next;
@@ -237,7 +237,7 @@ void Snowfall (int christmastree) {
 				free (cur);
 				continue;
 			}
-			
+
 			/* Only draw if we're still inside the window. */
 			if (cur->y <= LINES) {
 				/*
@@ -254,12 +254,12 @@ void Snowfall (int christmastree) {
 					cur->oldchar = ' ';
 			}
 		}
-	
+
 		windtimer--;
 		newflake--;
-		
+
 		refresh();
-		
+
 		/* Leave loop if anykey(tm) was pressed. */
 		if (getch() != ERR)
 			break;
@@ -319,7 +319,7 @@ void xmasAbout (void) {
 	mvaddstr (19, 29, "Fernando J. Pereda, Marco Cova");
 	mvaddstr (20, 29, "Cheng-Lung Sung, Dmitry Petukhov");
 	mvaddstr (21, 29, "Douglas Campos");
-	
+
 	Snowfall(1);
 }
 
@@ -331,7 +331,7 @@ void SHDrawGun (int gun_pos) {
 	clrtoeol();
 	move (LINES-2, 0);
 	clrtoeol();
-	
+
 	attron (WA_BOLD);
 	mvaddstr (LINES-3, gun_pos-3, "___/\\___");
 	mvaddstr (LINES-2, gun_pos-3, "|######|");
@@ -350,27 +350,27 @@ void SHDrawScore (int score, int level) {
 	int i, len;
 	char scorestr[16];
 	char levelstr[16];
-	
+
 	attron (WA_REVERSE);
 	for (i = 0; i < COLS; i++) {
 		mvaddch (0, i, ' ');
 	}
 	mvaddstr (0, 1, "Santa Hunta!");
-	
+
 	snprintf (scorestr, sizeof(scorestr), _("Score: %d"), score);
 	len = strlen (scorestr);
 	mvaddstr (0, COLS-1-len, scorestr);
-	
+
 	snprintf (levelstr, sizeof(levelstr), _("Level: %d"), level);
 	len = strlen (levelstr);
 	mvaddstr (0, COLS/2-len/2, levelstr);
-	
+
 	attroff (WA_REVERSE);
 }
 
 void SHClearScreen (void) {
 	int i;
-	
+
 	for (i = 0; i < LINES; i++) {
 		move (i, 0);
 		clrtoeol();
@@ -386,9 +386,9 @@ void SHDrawProjectile (shot shot) {
 void SHDrawSanta (santa santa) {
 	int len;
 	char *draw_string;
-	
+
 	len = COLS - santa.x;
-	
+
 	if (santa.anim == 0) {
 		if (santa.x < 0) {
 			draw_string = santa.gfx+abs(santa.x);
@@ -412,7 +412,7 @@ void SHDrawSanta (santa santa) {
 		} else
 			mvaddnstr (santa.y+1, santa.x, santa.altgfx_line2, len);
 	}
-	
+
 	attron (COLOR_PAIR(10));
 	mvaddch (santa.y, santa.x + santa.length - 1, '*');
 	attroff (COLOR_PAIR(10));
@@ -445,9 +445,9 @@ int SHAddScore (santa santa) {
 
 void SHDrawHitScore (scoreDisplay score) {
 	int rand_color;
-	
+
 	rand_color = 10 + ((float)rand() / (float)RAND_MAX * 6);
-	
+
 	attron (WA_BOLD);
 	attron (COLOR_PAIR(rand_color));
 	mvprintw (score.y, score.x, "%d", score.score);
@@ -472,15 +472,15 @@ void printFinalScore (int score) {
 	int y;
 	int divisor;
 	int digit;
-	
+
 	if (score == 0)
 		number_count = 1;
 	else
 		number_count = log10(score) + 1;
-	
-	
+
+
 	pos = COLS/2 - ((number_count * 8) / 2);
-	
+
 	for (i = 0; i < number_count; i++) {
 		y = 12;
 		divisor = pow (10, number_count-1-i);
@@ -491,30 +491,30 @@ void printFinalScore (int score) {
 			mvaddstr (y, pos + (i * 8), numbers[digit][j]);
 			y++;
 		}
-	}	
+	}
 	refresh();
 }
 
 void SHFinalScore (int score) {
 	int rand_color;
 
-	attron (WA_BOLD);	
+	attron (WA_BOLD);
 	mvaddstr (9, COLS/2-6, "Final score:");
 	refresh();
 	sleep(1);
-	
-	
+
+
 	for (;;) {
 		if (getch() == 'q')
 			break;
-		
+
 		rand_color = 10 + ((float)rand() / (float)RAND_MAX * 6);
 		attron (WA_BOLD);
 		attron (COLOR_PAIR(rand_color));
 		printFinalScore(score);
 		attroff (COLOR_PAIR(rand_color));
 		attroff (WA_BOLD);
-		
+
 		move (LINES-1, COLS-1);
 		refresh();
 	}
@@ -530,7 +530,6 @@ void santaHunta (void) {
 	int level = 1;
 	struct timeval before;
 	struct timeval after;
-	struct timeval delay;
 	int draw_loop = 0;
 	long draw_delay = 0;
 	shot shot;
@@ -538,31 +537,27 @@ void santaHunta (void) {
 	int targets = 0;
 	int hitcount = 0;
 	scoreDisplay scoreDisplay;
-	
+
 	shot.fired = 0;
 	shot.x = 0;
 	shot.y = 0;
-	
+
 	scoreDisplay.rounds = 0;
-	
+
 	/* Set ncurses halfdelay mode.
 	 * Max resolution is 1/10sec */
 	halfdelay (1);
-	
-	for (;;) {	
+
+	for (;;) {
 		gettimeofday (&before, NULL);
 		input = getch();
 		gettimeofday (&after, NULL);
 
 		if (after.tv_sec > before.tv_sec)
 			after.tv_usec += 1000000;
-		
-		delay.tv_sec = 0;
-		delay.tv_usec = abs(100000 - (after.tv_usec - before.tv_usec));
 
 		if (!targets) {
 			newSanta(&santa, level);
-			
 			targets = 1;
 		}
 
@@ -576,41 +571,41 @@ void santaHunta (void) {
 
 			if (targets)
 				SHDrawSanta(santa);
-			
+
 			if (santa.anim == 0)
 				santa.anim = 1;
 			else
 				santa.anim = 0;
-				
+
 			if (santa.x >= COLS)
 				targets = 0;
-			
+
 			if (shot.fired)
 				SHDrawProjectile(shot);
-				
+
 			if (scoreDisplay.rounds > 0)
 				SHDrawHitScore(scoreDisplay);
-			
+
 			if (SHHit(shot, santa)) {
 				targets = 0;
 				hitcount++;
 				last_score = SHAddScore(santa);
 				score += last_score;
-				
+
 				scoreDisplay.x = shot.x;
 				scoreDisplay.y = shot.y;
 				scoreDisplay.score = last_score;
 				scoreDisplay.rounds = 20;
 			}
-			
+
 			santa.x += santa.speed;
-			
+
 			scoreDisplay.rounds--;
-			
+
 			shot.y--;
 			if (shot.y == 0)
 				shot.fired = 0;
-			
+
 			if (hitcount == 10) {
 				hitcount = 0;
 				level++;
@@ -618,7 +613,7 @@ void santaHunta (void) {
 		}
 
 		count++;
-		
+
 		if ((input == KEY_RIGHT) || (input == keybindings.next)) {
 			if (gun_pos < COLS-5)
 				gun_pos++;
@@ -632,7 +627,7 @@ void santaHunta (void) {
 				mvaddstr (LINES-4, gun_pos-2, "\\***/");
 				attroff (COLOR_PAIR(12));
 				attroff (WA_BOLD);
-				
+
 				shot.x = gun_pos;
 				shot.y = LINES-4;
 				shot.fired = 1;
@@ -641,33 +636,33 @@ void santaHunta (void) {
 			SHFinalScore(score);
 			break;
 		}
-			
+
 		SHDrawGun(gun_pos);
 		SHDrawScore(score, level);
 		SHDrawStatus();
-		
+
 		refresh();
 	}
-	
+
 	/* Leave halfdelay mode. */
 	cbreak();
 }
 
 void UIAbout (void) {
 	int xpos;
-	
+
 	clear();				/* Get the crap off the screen to make room
 							   for our wonderful ASCII logo. :) */
 
 	xpos = COLS/2 - 40;
-	
+
 	if (COLS < 80) {
 		mvprintw (0, 0, _("Need at least 80 COLS terminal, sorry!"));
 		refresh();
 		getch();
 		return;
 	}
-	
+
 	if (easterEgg()) {
 		santaHunta();
 	} else {
@@ -679,7 +674,7 @@ void UIAbout (void) {
 		mvaddstr (6, xpos, "/______  / / ___|___/ \\____/  /__|__/  / ___|___/ \\____ \\   /__|__/  /______  /");
 		mvaddstr (7, xpos, "       \\/  \\/                          \\/              \\/                   \\/");
 		mvprintw (9, COLS/2-(strlen("Version")+strlen(VERSION)+1)/2, "Version %s", VERSION);
-		
+
 		mvaddstr (11, COLS/2-(strlen(_("Brought to you by:")))/2, _("Brought to you by:"));
 		mvaddstr (13, COLS/2-(strlen(_("Main code")))/2, _("Main code"));
 		mvaddstr (14, COLS/2-6, "Oliver Feiler");
@@ -690,7 +685,7 @@ void UIAbout (void) {
 		mvaddstr (21, COLS/2-32, "Fernando J. Pereda, Marco Cova, Cheng-Lung Sung, Dmitry Petukhov");
 		mvaddstr (22, COLS/2-26, "Douglas Campos, Ray Iwata, Piotr Ozarowski, Yang Huan");
 		mvaddstr (23, COLS/2-15, "Ihar Hrachyshka, Mats Berglund");
-		
+
 		refresh();
 		getch();
 	}
diff --git a/conversions.c b/conversions.c
index a6155a1..b17348a 100644
--- a/conversions.c
+++ b/conversions.c
@@ -1,6 +1,6 @@
 /* Snownews - A lightweight console RSS newsreader
  * $Id: conversions.c 1173 2006-10-14 21:41:42Z kiza $
- * 
+ *
  * Copyright 2003-2009 Oliver Feiler <kiza@kcore.de> and
  *                     Rene Puls <rpuls@gmx.net>
  *
@@ -20,8 +20,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
- 
-#include <sys/types.h> 
+
+#define _GNU_SOURCE
+#include <sys/types.h>
 #include <string.h>
 #include <iconv.h>
 #include <stdio.h>
@@ -29,22 +30,12 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
+#include <time.h>
 #include <libxml/HTMLparser.h>
 #include <langinfo.h>
 #include <openssl/evp.h>
-
+#include <openssl/md5.h>
 #include "os-support.h"
-
-/* I have no idea what needs to be defined to get strptime() on glibc.
- * This is stolen from somewhere else and it works for me(tm).
- * If you know how it's supposed to work, tell me. Manpage says
- * define _XOPEN_SOURCE for glibc2, but that doesn't work. */
-#define _XOPEN_SOURCE 500		/* Needed for glibc2 strptime(). What's the 500 for? */
-#define __USE_XOPEN
-#include <time.h>
-#undef __USE_XOPEN
-#undef _XOPEN_SOURCE
-
 #include "conversions.h"
 #include "config.h"
 #include "interface.h"
@@ -57,7 +48,7 @@ extern struct entity *first_entity;
 
 extern char *forced_target_charset;
 
-int calcAgeInDays (struct tm * t);
+static int calcAgeInDays (const struct tm* t);
 
 #ifdef STATIC_CONST_ICONV
 char * iconvert (const char * inbuf) {
@@ -72,11 +63,11 @@ char * iconvert (char * inbuf) {
 
 	/*(void)strlcpy(target_charset, nl_langinfo(CODESET), sizeof(target_charset));*/
 	strncpy(target_charset, nl_langinfo(CODESET), sizeof(target_charset));
-		
+
 	/* Take a shortcut. */
 	if (strcasecmp (target_charset, "UTF-8") == 0)
 		return strdup(inbuf);
-	
+
 	inbytesleft = strlen(inbuf);
 	outbytesleft = strlen(inbuf);
 
@@ -92,20 +83,20 @@ char * iconvert (char * inbuf) {
 	if (cd == (iconv_t) -1) {
 		return NULL;
 	}
-	
+
 	outbuf = malloc (outbytesleft+1);
 	outbuf_first = outbuf;
 
-	if (iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft) == -1) {
+	if (iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft) == (size_t)-1) {
 		free(outbuf_first);
 		iconv_close(cd);
 		return NULL;
 	}
 
 	*outbuf = 0;
-	
+
 	iconv_close (cd);
-	
+
 	return outbuf_first;
 }
 
@@ -135,18 +126,18 @@ char * UIDejunk (char * feed_description) {
 	unsigned long ch;			/* Decoded numeric entity */
 #endif
 	const htmlEntityDesc *ep;	/* For looking up HTML entities */
-	
+
 	/* Gracefully handle passed NULL ptr. */
 	if (feed_description == NULL) {
 		newtext = strdup("(null)");
 		return newtext;
 	}
-	
+
 	/* Make a copy and point *start to it so we can free the stuff again! */
 	text = strdup (feed_description);
 	start = text;
-	
-	
+
+
 	/* If text begins with a tag, discard all of them. */
 	while (1) {
 		if (text[0] == '<') {
@@ -162,14 +153,14 @@ char * UIDejunk (char * feed_description) {
 	}
 	newtext = malloc (1);
 	newtext[0] = '\0';
-	
+
 	while (1) {
 		/* Strip tags... tagsoup mode. */
 		/* strsep puts everything before "<" into detagged. */
 		detagged = strsep (&text, "<");
 		if (detagged == NULL)
 			break;
-		
+
 		/* Replace <p> and <br> (in all incarnations) with newlines, but only
 		   if there isn't already a following newline. */
 		if (text != NULL) {
@@ -188,12 +179,12 @@ char * UIDejunk (char * feed_description) {
 
 		/* Now append detagged to newtext. */
 		strcat (newtext, detagged);
-		
+
 		/* Advance *text to next position after the closed tag. */
 		htmltag = strsep (&text, ">");
 		if (htmltag == NULL)
 			break;
-		
+
 		if (s_strcasestr(htmltag, "img src") != NULL) {
 /*			attribute = s_strcasestr(htmltag, "alt=");
 			if (attribute == NULL)
@@ -216,25 +207,25 @@ char * UIDejunk (char * feed_description) {
 		}*/
 	}
 	free (start);
-	
+
 	CleanupString (newtext, 0);
-	
+
 	/* See if there are any entities in the string at all. */
 	if (strchr(newtext, '&') != NULL) {
 		text = strdup (newtext);
 		start = text;
 		free (newtext);
-	
+
 		newtext = malloc (1);
 		newtext[0] = '\0';
-		
+
 		while (1) {
 			/* Strip HTML entities. */
 			detagged = strsep (&text, "&");
 			if (detagged == NULL)
 				break;
-			
-			if (detagged != '\0') {
+
+			if (*detagged) {
 				newtext = realloc (newtext, strlen(newtext)+strlen(detagged)+1);
 				strcat (newtext, detagged);
 			}
@@ -260,29 +251,29 @@ char * UIDejunk (char * feed_description) {
 					strcat (newtext, "'");
 					continue;
 				}
-				
+
 				/* Decode user defined entities. */
 				found = 0;
 				for (cur_entity = first_entity; cur_entity != NULL; cur_entity = cur_entity->next_ptr) {
 					if (strcmp (entity, cur_entity->entity) == 0) {
 						/* We have found a matching entity. */
-						
+
 						/* If entity_length is more than 1 char we need to realloc
 						   more space in newtext. */
 						if (cur_entity->entity_length > 1)
 							newtext = realloc (newtext,  strlen(newtext)+cur_entity->entity_length+1);
-						
+
 						/* Append new entity. */
 						strcat (newtext, cur_entity->converted_entity);
-						
+
 						/* Set found flag. */
 						found = 1;
-						
+
 						/* We can now leave the for loop. */
 						break;
 					}
 				}
-								
+
 				/* Try to parse some standard entities. */
 				if (!found) {
 					/* See if it was a numeric entity. */
@@ -330,7 +321,7 @@ char * UIDejunk (char * feed_description) {
 				break;
 		}
 		free (start);
-	}	
+	}
 	return newtext;
 }
 
@@ -340,7 +331,7 @@ char * UIDejunk (char * feed_description) {
  * the 4th version which corrupted some random memory unfortunately...
  * but this one works. Heureka!
  */
-char * WrapText (char * text, int width) {
+char* WrapText (const char* text, unsigned width) {
 	char *newtext;
 	char *textblob;			/* Working copy of text. */
 	char *chapter;
@@ -352,14 +343,14 @@ char * WrapText (char * text, int width) {
 	char *p;
 	int lena, lenb;
 	*/
-	
+
 	textblob = strdup (text);
 	start = textblob;
-	
+
 
 	line = malloc (1);
 	line[0] = '\0';
-	
+
 	newtext = malloc(1);
 	memset (newtext, 0, 1);
 
@@ -371,14 +362,14 @@ char * WrapText (char * text, int width) {
 		while (1) {
 			savepos = chapter;
 			chunk = strsep (&chapter, " ");
-			
+
 			/* Last chunk. */
 			if (chunk == NULL) {
 				if (line != NULL) {
 					newtext = realloc (newtext, strlen(newtext)+strlen(line)+2);
 					strcat (newtext, line);
 					strcat (newtext, "\n");
-					
+
 					/* Faster replacement with memcpy.
 					 * Overkill, overcomplicated and smelling of bugs all over.
 					 */
@@ -393,22 +384,22 @@ char * WrapText (char * text, int width) {
 					p++;
 					*p=0;
 					*/
-					
+
 					line[0] = '\0';
 				}
 				break;
 			}
-			
+
 			if (strlen(chunk) > width) {
 				/* First copy remaining stuff in line to newtext. */
 				newtext = realloc (newtext, strlen(newtext)+strlen(line)+2);
 				strcat (newtext, line);
 				strcat (newtext, "\n");
-				
+
 				free (line);
 				line = malloc (1);
 				line[0] = '\0';
-				
+
 				/* Then copy chunk with max length of line to newtext. */
 				line = realloc (line, width+1);
 				strncat (line, chunk, width-5);
@@ -442,10 +433,10 @@ char * WrapText (char * text, int width) {
 			}
 		}
 	}
-	
-	free (line);	
-	free (start);	
-	
+
+	free (line);
+	free (start);
+
 	return newtext;
 }
 
@@ -458,14 +449,14 @@ char *base64encode(char const *inbuf, unsigned int inbuf_size) {
 	unsigned int outbuf_size = 0;
 	int bits = 0;
 	int char_count = 0;
-	
+
 	outbuf = malloc(1);
-	
+
 	while (inbuf_pos < inbuf_size) {
-	
+
 		bits |= *inbuf;
 		char_count++;
-		
+
 		if (char_count == 3) {
 			outbuf = realloc(outbuf, outbuf_size+4);
 			outbuf_size += 4;
@@ -477,12 +468,12 @@ char *base64encode(char const *inbuf, unsigned int inbuf_size) {
 			bits = 0;
 			char_count = 0;
 		}
-		
+
 		inbuf++;
 		inbuf_pos++;
 		bits <<= 8;
 	}
-	
+
 	if (char_count > 0) {
 		bits <<= 16 - (8 * char_count);
 		outbuf = realloc(outbuf, outbuf_size+4);
@@ -498,10 +489,10 @@ char *base64encode(char const *inbuf, unsigned int inbuf_size) {
 		}
 		outbuf_pos += 4;
 	}
-	
+
 	outbuf = realloc(outbuf, outbuf_size+1);
 	outbuf[outbuf_pos] = 0;
-	
+
 	return outbuf;
 }
 
@@ -531,7 +522,7 @@ char* decodechunked(char * chunked, unsigned int *inputlen) {
 	}
 	*dest = '\0';
 	*inputlen = dest - chunked;
-	
+
 	return chunked;
 }
 #endif
@@ -543,13 +534,13 @@ char* decodechunked(char * chunked, unsigned int *inputlen) {
  */
 void CleanupString (char * string, int tidyness) {
 	int len, i;
-	
+
 	/* If we are passed a NULL pointer, leave it alone and return. */
 	if (string == NULL)
 		return;
-	
+
 	len = strlen(string);
-	
+
 	while ((string[0] == '\n' || string [0] == ' ' || string [0] == '\t') &&
 			(len > 0)) {
 		/* len=strlen(string) does not include \0 of string.
@@ -558,13 +549,13 @@ void CleanupString (char * string, int tidyness) {
 		memmove (string, string+1, len);
 		len--;
 	}
-	
+
 	/* Remove trailing spaces. */
 	while ((len > 1) && (string[len-1] == ' ')) {
 		string[len-1] = 0;
 		len--;
 	}
-	
+
 	len = strlen(string);
 	/* Eat newlines and tabs along the whole string. */
 	for (i = 0; i < len; i++) {
@@ -574,18 +565,18 @@ void CleanupString (char * string, int tidyness) {
 		if (tidyness == 1 && string[i] == '\n') {
 			string[i] = ' ';
 		}
-	}	
+	}
 }
 
 /* http://foo.bar/address.rdf -> http:__foo.bar_address.rdf */
 char * Hashify (const char * url) {
 	int i, len;
 	char *hashed_url;
-	
+
 	hashed_url = strdup(url);
-	
+
 	len = strlen(hashed_url);
-	
+
 	/* Don't allow filenames > 128 chars for teeny weeny
 	 * operating systems.
 	 */
@@ -593,7 +584,7 @@ char * Hashify (const char * url) {
 		len = 128;
 		hashed_url[128] = '\0';
 	}
-	
+
 	for (i = 0; i < len; i++) {
 		if (((hashed_url[i] < 32) || (hashed_url[i] > 38)) &&
 			((hashed_url[i] < 43) || (hashed_url[i] > 46)) &&
@@ -601,7 +592,7 @@ char * Hashify (const char * url) {
 			((hashed_url[i] < 97) || (hashed_url[i] > 122)) &&
 			(hashed_url[i] != 0))
 			hashed_url[i] = '_';
-		
+
 		/* Cygwin doesn't seem to like anything besides a-z0-9 in filenames.
 		   Zap'em! */
 #ifdef __CYGWIN__
@@ -612,31 +603,26 @@ char * Hashify (const char * url) {
 			hashed_url[i] = '_';
 #endif
 	}
-	
+
 	return hashed_url;
 }
 
-char * genItemHash (char ** hashitems, int items) {
-	int i;
-	EVP_MD_CTX mdctx;
-	unsigned char md_value[EVP_MAX_MD_SIZE];
-	unsigned int md_len;
-	char md5_hex[33];
-
-	EVP_DigestInit(&mdctx, EVP_md5());
-	
-	for (i = 0; i < items; i++) {
-		if (hashitems[i] != NULL)
-			EVP_DigestUpdate(&mdctx, hashitems[i], (size_t) strlen(hashitems[i]));
-	}
-	
-	EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
-	EVP_MD_CTX_cleanup(&mdctx);
-	
-	for (i = 0; i < md_len; i++) {
-		sprintf(&md5_hex[2*i], "%02x", md_value[i]);
-	}
-	
+char * genItemHash (const char* const* hashitems, int items) {
+	EVP_MD_CTX* mdctx = EVP_MD_CTX_new();
+	EVP_DigestInit(mdctx, EVP_md5());
+
+	for (int i = 0; i < items; ++i)
+		if (hashitems[i])
+			EVP_DigestUpdate (mdctx, hashitems[i], strlen(hashitems[i]));
+
+	unsigned char md_value [EVP_MAX_MD_SIZE];
+	unsigned md_len = 0;
+	EVP_DigestFinal_ex (mdctx, md_value, &md_len);
+	EVP_MD_CTX_free (mdctx);
+
+	char md5_hex [MD5_DIGEST_LENGTH*2+1];
+	for (unsigned i = 0; i < md_len; ++i)
+		sprintf (&md5_hex[2*i], "%02x", md_value[i]);
 	return strdup(md5_hex);
 }
 
@@ -646,14 +632,14 @@ int ISODateToUnix (char const * const ISODate) {
 	struct tm *t;
 	time_t tt = 0;
 	int time_unix = 0;
-	
+
 	/* Do not crash with an empty tag */
 	if (ISODate == NULL)
 		return 0;
-	
+
 	t = malloc(sizeof(struct tm));
 	gmtime_r(&tt, t);
-	
+
 	/* OpenBSD does not know %F == %Y-%m-%d
 	 * <insert inflamatory comment here> */
 	if (strptime(ISODate, "%Y-%m-%dT%T", t)) {
@@ -669,7 +655,7 @@ int ISODateToUnix (char const * const ISODate) {
 		time_unix = timegm(t);
 #endif
 	}
-	
+
 	free (t);
 	return time_unix;
 }
@@ -680,17 +666,17 @@ int pubDateToUnix (char const * const pubDate) {
 	time_t tt = 0;
 	int time_unix = 0;
 	char *oldlocale;
-	
+
 	/* Do not crash with an empty Tag */
 	if (pubDate == NULL)
 		return 0;
-	
+
 	start_here = pubDate;
 	start_here += 5;
-	
+
 	t = malloc(sizeof(struct tm));
 	gmtime_r(&tt, t);
-	
+
 #ifdef LOCALEPATH
 	/* Cruft!
 	 * Save old locale so we can parse the stupid pubDate format.
@@ -708,7 +694,7 @@ int pubDateToUnix (char const * const pubDate) {
 		setlocale(LC_TIME, "C");
 	}
 #endif
-	
+
 	if (strptime(start_here, "%d %b %Y %T", t)) {
 #ifdef __CYGWIN__
 		time_unix = mktime(t);
@@ -723,7 +709,7 @@ int pubDateToUnix (char const * const pubDate) {
 		free (oldlocale);
 	}
 #endif
-	
+
 	free (t);
 	return time_unix;
 }
@@ -736,21 +722,21 @@ char * unixToPostDateString (int unixDate) {
 	int strfstr_len = 32;
 	char tmpstr[32];
 	int age;
-	
+
 	time_str = malloc(len);
 	time_strfstr = malloc(strfstr_len);
-	
+
 	unix_t = unixDate;
 	gmtime_r(&unix_t, &t);
-	
+
 	age = calcAgeInDays(&t);
-	
+
 	strftime(time_strfstr, strfstr_len, _(", %H:%M"), &t);
 	strcpy(time_str, _("Posted "));
 	len -= strlen(_("Posted "));
 	if (len <= 0)
 		return NULL;
-	
+
 	if (age == 0) {
 		strncat(time_str, _("today"), len-1);
 		len -= strlen(_("today"));
@@ -796,15 +782,13 @@ char * unixToPostDateString (int unixDate) {
 		strncat(time_str, time_strfstr, len-1);
 	}
 	free (time_strfstr);
-	
+
 	return time_str;
 }
 
-int calcAgeInDays (struct tm * t) {
-	time_t unix_t;
+static int calcAgeInDays (const struct tm* t) {
+	time_t unix_t = time(NULL);
 	struct tm current_t;
-	
-	unix_t = time(NULL);
 	gmtime_r(&unix_t, &current_t);
 
 	/* (((current year - passed year) * 365) + current year day) - passed year day */
diff --git a/conversions.h b/conversions.h
index 6816df4..148becc 100644
--- a/conversions.h
+++ b/conversions.h
@@ -30,11 +30,11 @@ char * iconvert (const char * inbuf);
 char * iconvert (char * inbuf);
 #endif
 char * UIDejunk (char * feed_description);
-char * WrapText (char * text, int width);
+char* WrapText (const char* text, unsigned width);
 char *base64encode(char const *inbuf, unsigned int inbuf_size);
 void CleanupString (char * string, int tidyness);
 char * Hashify (const char * url);
-char * genItemHash (char ** hashitems, int items);
+char* genItemHash (const char* const* hashitems, int items);
 int ISODateToUnix (char const * const ISODate);
 int pubDateToUnix (char const * const pubDate);
 char * unixToPostDateString (int unixDate);
diff --git a/digcalc.c b/digcalc.c
index fef39a2..7a99b26 100644
--- a/digcalc.c
+++ b/digcalc.c
@@ -15,144 +15,87 @@
 #include "digcalc.h"
 #include <openssl/evp.h>
 
-
 /* calculate H(A1) as per spec */
-void DigestCalcHA1(
-    IN char * pszAlg,
-    IN char * pszUserName,
-    IN char * pszRealm,
-    IN char * pszPassword,
-    IN char * pszNonce,
-    IN char * pszCNonce,
-    OUT HASHHEX SessionKey
-    )
+void DigestCalcHA1 (const char* pszAlg, const char* pszUserName, const char* pszRealm,
+	const char* pszPassword, const char* pszNonce, const char* pszCNonce,
+	HASHHEX SessionKey)
 {
-	EVP_MD_CTX mdctx;
-	unsigned char md_value[EVP_MAX_MD_SIZE];
-	unsigned int md_len;
-	int i;
-	HASH HA1;
-	
-	EVP_DigestInit(&mdctx, EVP_md5());
-	EVP_DigestUpdate(&mdctx, pszUserName, strlen(pszUserName));
-	EVP_DigestUpdate(&mdctx, ":", 1);
-	EVP_DigestUpdate(&mdctx, pszRealm, strlen(pszRealm));
-	EVP_DigestUpdate(&mdctx, ":", 1);
-	EVP_DigestUpdate(&mdctx, pszPassword, strlen(pszPassword));
-	EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
-	EVP_MD_CTX_cleanup(&mdctx);
-	
+	EVP_MD_CTX* mdctx = EVP_MD_CTX_new();
+	EVP_DigestInit (mdctx, EVP_md5());
+	EVP_DigestUpdate (mdctx, pszUserName, strlen(pszUserName));
+	EVP_DigestUpdate (mdctx, ":", 1);
+	EVP_DigestUpdate (mdctx, pszRealm, strlen(pszRealm));
+	EVP_DigestUpdate (mdctx, ":", 1);
+	EVP_DigestUpdate (mdctx, pszPassword, strlen(pszPassword));
+	unsigned char md_value [EVP_MAX_MD_SIZE];
+	unsigned md_len;
+	EVP_DigestFinal_ex (mdctx, md_value, &md_len);
+
 	if (strcmp(pszAlg, "md5-sess") == 0) {
-		EVP_DigestInit(&mdctx, EVP_md5());
-		EVP_DigestUpdate(&mdctx, HA1, HASHLEN);
-		EVP_DigestUpdate(&mdctx, ":", 1);
-		EVP_DigestUpdate(&mdctx, pszNonce, strlen(pszNonce));
-		EVP_DigestUpdate(&mdctx, ":", 1);
-		EVP_DigestUpdate(&mdctx, pszCNonce, strlen(pszCNonce));
-		EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
-		EVP_MD_CTX_cleanup(&mdctx);
-	};
-	
-	for (i = 0; i < md_len; i++) {
-		sprintf(&SessionKey[2*i], "%02x", md_value[i]);
+		EVP_DigestInit (mdctx, EVP_md5());
+		HASH HA1;
+		EVP_DigestUpdate (mdctx, HA1, HASHLEN);
+		EVP_DigestUpdate (mdctx, ":", 1);
+		EVP_DigestUpdate (mdctx, pszNonce, strlen(pszNonce));
+		EVP_DigestUpdate (mdctx, ":", 1);
+		EVP_DigestUpdate (mdctx, pszCNonce, strlen(pszCNonce));
+		EVP_DigestFinal_ex (mdctx, md_value, &md_len);
 	}
+	EVP_MD_CTX_free (mdctx);
+
+	for (unsigned i = 0; i < md_len; ++i)
+		sprintf (&SessionKey[2*i], "%02x", md_value[i]);
 };
 
 /* calculate request-digest/response-digest as per HTTP Digest spec */
 void DigestCalcResponse(
-    IN HASHHEX HA1,           /* H(A1) */
-    IN char * pszNonce,       /* nonce from server */
-    IN char * pszNonceCount,  /* 8 hex digits */
-    IN char * pszCNonce,      /* client nonce */
-    IN char * pszQop,         /* qop-value: "", "auth", "auth-int" */
-    IN char * pszMethod,      /* method from the request */
-    IN char * pszDigestUri,   /* requested URL */
-    IN HASHHEX HEntity,       /* H(entity body) if qop="auth-int" */
-    OUT HASHHEX Response      /* request-digest or response-digest */
+    const HASHHEX HA1,		/* H(A1) */
+    const char* pszNonce,	/* nonce from server */
+    const char* pszNonceCount,	/* 8 hex digits */
+    const char* pszCNonce,	/* client nonce */
+    const char* pszQop,		/* qop-value: "", "auth", "auth-int" */
+    const char* pszMethod,	/* method from the request */
+    const char* pszDigestUri,	/* requested URL */
+    const HASHHEX HEntity,	/* H(entity body) if qop="auth-int" */
+    HASHHEX Response		/* request-digest or response-digest */
     )
 {
-	EVP_MD_CTX mdctx;
-	HASHHEX HA2Hex;
-	unsigned char md_value[EVP_MAX_MD_SIZE];
-	unsigned int md_len;
-	int i;
-	
 	/* calculate H(A2) */
-	EVP_DigestInit(&mdctx, EVP_md5());
-	EVP_DigestUpdate(&mdctx, pszMethod, strlen(pszMethod));
-	EVP_DigestUpdate(&mdctx, ":", 1);
-	EVP_DigestUpdate(&mdctx, pszDigestUri, strlen(pszDigestUri));
+	EVP_MD_CTX* mdctx = EVP_MD_CTX_new();
+	EVP_DigestInit (mdctx, EVP_md5());
+	EVP_DigestUpdate (mdctx, pszMethod, strlen(pszMethod));
+	EVP_DigestUpdate (mdctx, ":", 1);
+	EVP_DigestUpdate (mdctx, pszDigestUri, strlen(pszDigestUri));
 	if (strcmp(pszQop, "auth-int") == 0) {
-		EVP_DigestUpdate(&mdctx, ":", 1);
-		EVP_DigestUpdate(&mdctx, HEntity, HASHHEXLEN);
-	};
-	EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
-	EVP_MD_CTX_cleanup(&mdctx);
-	
-	for (i = 0; i < md_len; i++) {
-		sprintf(&HA2Hex[2*i], "%02x", md_value[i]);
+		EVP_DigestUpdate (mdctx, ":", 1);
+		EVP_DigestUpdate (mdctx, HEntity, HASHHEXLEN);
 	}
-	
+	unsigned char md_value [EVP_MAX_MD_SIZE];
+	unsigned md_len = 0;
+	EVP_DigestFinal_ex (mdctx, md_value, &md_len);
+
+	HASHHEX HA2Hex;
+	for (unsigned i = 0; i < md_len; ++i)
+		sprintf (&HA2Hex[2*i], "%02x", md_value[i]);
+
 	/* calculate response */
-	EVP_DigestInit(&mdctx, EVP_md5());
-	EVP_DigestUpdate(&mdctx, HA1, HASHHEXLEN);
-	EVP_DigestUpdate(&mdctx, ":", 1);
-	EVP_DigestUpdate(&mdctx, pszNonce, strlen(pszNonce));
-	EVP_DigestUpdate(&mdctx, ":", 1);
+	EVP_DigestInit (mdctx, EVP_md5());
+	EVP_DigestUpdate (mdctx, HA1, HASHHEXLEN);
+	EVP_DigestUpdate (mdctx, ":", 1);
+	EVP_DigestUpdate (mdctx, pszNonce, strlen(pszNonce));
+	EVP_DigestUpdate (mdctx, ":", 1);
 	if (*pszQop) {
-		EVP_DigestUpdate(&mdctx, pszNonceCount, strlen(pszNonceCount));
-		EVP_DigestUpdate(&mdctx, ":", 1);
-		EVP_DigestUpdate(&mdctx, pszCNonce, strlen(pszCNonce));
-		EVP_DigestUpdate(&mdctx, ":", 1);
-		EVP_DigestUpdate(&mdctx, pszQop, strlen(pszQop));
-		EVP_DigestUpdate(&mdctx, ":", 1);
+		EVP_DigestUpdate (mdctx, pszNonceCount, strlen(pszNonceCount));
+		EVP_DigestUpdate (mdctx, ":", 1);
+		EVP_DigestUpdate (mdctx, pszCNonce, strlen(pszCNonce));
+		EVP_DigestUpdate (mdctx, ":", 1);
+		EVP_DigestUpdate (mdctx, pszQop, strlen(pszQop));
+		EVP_DigestUpdate (mdctx, ":", 1);
 	};
-	EVP_DigestUpdate(&mdctx, HA2Hex, HASHHEXLEN);
-	EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
-	EVP_MD_CTX_cleanup(&mdctx);
-	
-	for (i = 0; i < md_len; i++) {
-		sprintf(&Response[2*i], "%02x", md_value[i]);
-	}
-	
-#if 0
-	/* This is the old MD5 digest calculator for a reference until I am sure
-	 * the new code works for sure */
-	/* *************************** */
-      struct MD5Context Md5Ctx;
-      HASH HA2;
-      HASH RespHash;
-      HASHHEX HA2Hex;
-
-      /* calculate H(A2) */
-      MD5Init(&Md5Ctx);
-      MD5Update(&Md5Ctx, pszMethod, strlen(pszMethod));
-      MD5Update(&Md5Ctx, ":", 1);
-      MD5Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri));
-      if (strcmp(pszQop, "auth-int") == 0) {
-            MD5Update(&Md5Ctx, ":", 1);
-            MD5Update(&Md5Ctx, HEntity, HASHHEXLEN);
-      };
-      MD5Final(HA2, &Md5Ctx);
-       CvtHex(HA2, HA2Hex);
-
-      /* calculate response */
-      MD5Init(&Md5Ctx);
-      MD5Update(&Md5Ctx, HA1, HASHHEXLEN);
-      MD5Update(&Md5Ctx, ":", 1);
-      MD5Update(&Md5Ctx, pszNonce, strlen(pszNonce));
-      MD5Update(&Md5Ctx, ":", 1);
-      if (*pszQop) {
+	EVP_DigestUpdate (mdctx, HA2Hex, HASHHEXLEN);
+	EVP_DigestFinal_ex (mdctx, md_value, &md_len);
+	EVP_MD_CTX_free (mdctx);
 
-          MD5Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount));
-          MD5Update(&Md5Ctx, ":", 1);
-          MD5Update(&Md5Ctx, pszCNonce, strlen(pszCNonce));
-          MD5Update(&Md5Ctx, ":", 1);
-          MD5Update(&Md5Ctx, pszQop, strlen(pszQop));
-          MD5Update(&Md5Ctx, ":", 1);
-      };
-      MD5Update(&Md5Ctx, HA2Hex, HASHHEXLEN);
-      MD5Final(RespHash, &Md5Ctx);
-      CvtHex(RespHash, Response);
-#endif
+	for (unsigned i = 0; i < md_len; ++i)
+		sprintf (&Response[2*i], "%02x", md_value[i]);
 };
diff --git a/digcalc.h b/digcalc.h
index e17cdde..86d1cb2 100644
--- a/digcalc.h
+++ b/digcalc.h
@@ -18,36 +18,23 @@
 typedef char HASH[HASHLEN];
 #define HASHHEXLEN 32
 typedef char HASHHEX[HASHHEXLEN+1];
-#define IN
-#define OUT
 
 /* calculate H(A1) as per HTTP Digest spec */
-void DigestCalcHA1(
-    IN char * pszAlg,
-    IN char * pszUserName,
-    IN char * pszRealm,
-    IN char * pszPassword,
-    IN char * pszNonce,
-    IN char * pszCNonce,
-    OUT HASHHEX SessionKey
-    );
+void DigestCalcHA1 (const char* pszAlg, const char* pszUserName, const char* pszRealm,
+			const char* pszPassword, const char* pszNonce, const char* pszCNonce,
+			HASHHEX SessionKey);
 
 /* calculate request-digest/response-digest as per HTTP Digest spec */
-void DigestCalcResponse(
-    IN HASHHEX HA1,           /* H(A1) */
-    IN char * pszNonce,       /* nonce from server */
-    IN char * pszNonceCount,  /* 8 hex digits */
-    IN char * pszCNonce,      /* client nonce */
-    IN char * pszQop,         /* qop-value: "", "auth", "auth-int" */
-    IN char * pszMethod,      /* method from the request */
-    IN char * pszDigestUri,   /* requested URL */
-    IN HASHHEX HEntity,       /* H(entity body) if qop="auth-int" */
-    OUT HASHHEX Response      /* request-digest or response-digest */
-    );
-
-void CvtHex(
-    IN HASH Bin,
-    OUT HASHHEX Hex
+void DigestCalcResponse (
+    const HASHHEX HA1,		/* H(A1) */
+    const char* pszNonce,	/* nonce from server */
+    const char* pszNonceCount,	/* 8 hex digits */
+    const char* pszCNonce,	/* client nonce */
+    const char* pszQop,		/* qop-value: "", "auth", "auth-int" */
+    const char* pszMethod,	/* method from the request */
+    const char* pszDigestUri,	/* requested URL */
+    const HASHHEX HEntity,	/* H(entity body) if qop="auth-int" */
+    HASHHEX Response		/* request-digest or response-digest */
     );
 
 #endif
diff --git a/interface.c b/interface.c
index 1fa7a1e..5e798d3 100644
--- a/interface.c
+++ b/interface.c
@@ -67,7 +67,7 @@ struct scrolltext {
 };
 
 #ifdef SIGWINCH
-void sig_winch(int p)
+void sig_winch (int p __attribute__((unused)))
 {
 	resize_dirty = 1;
 }
diff --git a/main.c b/main.c
index c031912..0318178 100644
--- a/main.c
+++ b/main.c
@@ -155,15 +155,9 @@ void MainSignalHandler (int sig) {
 }
 
 /* Automatic child reaper. */
-void sigChildHandler (int sig) {
-	int status, child_val;
-
+static void sigChildHandler (int sig __attribute__((unused))) {
 	/* Wait for any child without blocking */
-	if (waitpid(-1, &status, WNOHANG) < 0)
-			return;
-
-	if (WIFEXITED(status))
-		child_val = WEXITSTATUS(status);
+	waitpid (-1, NULL, WNOHANG);
 }
 
 void printHelp (void) {
diff --git a/netio.c b/netio.c
index 5d3bae0..4a08e1e 100644
--- a/netio.c
+++ b/netio.c
@@ -129,7 +129,7 @@ int NetPoll (struct feed * cur_ptr, int * my_socket, int rw) {
  *	0	Connected
  *	-1	Error occured (netio_error is set)
  */
-int NetConnect (int * my_socket, char * host, struct feed * cur_ptr, int httpproto, int suppressoutput) {
+int NetConnect (int * my_socket, char * host, struct feed * cur_ptr, int httpproto __attribute__((unused)), int suppressoutput) {
 	char tmp[512];
 	struct sockaddr_in address;	
 	struct hostent *remotehost;
diff --git a/os-support.c b/os-support.c
index a590a58..8b61f35 100644
--- a/os-support.c
+++ b/os-support.c
@@ -39,7 +39,7 @@
  * The following function was written by François Gouget.
  */
 #ifdef SUN
-char* strsep(char** str, const char* delims)
+char* strsep (char** str, const char* delims)
 {
     char* token;
 
@@ -93,29 +93,21 @@ time_t timegm(struct tm *t)
 #endif
 
 /* strcasestr stolen from: http://www.unixpapa.com/incnote/string.html */
-char *s_strcasestr(char *a, char *b) {
-	size_t l;
+const char* s_strcasestr (const char* a, const char* b) {
+	const size_t lena = strlen(a), lenb = strlen(b);
 	char f[3];
-	int lena = strlen(a);
-	int lenb = strlen(b);
-	
 	snprintf(f, sizeof(f), "%c%c", tolower(*b), toupper(*b));
-	for (l = strcspn(a, f); l != lena; l += strcspn(a + l + 1, f) + 1)
+	for (size_t l = strcspn(a, f); l != lena; l += strcspn(a + l + 1, f) + 1)
 		if (strncasecmp(a + l, b, lenb) == 0)
-			return(a + l);
-	return(NULL);
+			return a + l;
+	return NULL;
 }
 
 
 /* Private malloc wrapper. Aborts program execution if malloc fails. */
-void * s_malloc (size_t size) {
-	void *newmem;
-	
-	newmem = malloc (size);
-	
-	if (newmem == NULL) {
+void* s_malloc (size_t size) {
+	void* newmem = malloc (size);
+	if (!newmem)
 		MainQuit ("Allocating memory", strerror(errno));
-	}
-	
 	return newmem;
 }
diff --git a/os-support.h b/os-support.h
index 3eb1068..d5ef6a1 100644
--- a/os-support.h
+++ b/os-support.h
@@ -27,10 +27,10 @@
 #define OS_SUPPORT_H
 
 #ifdef SUN
-char* strsep(char** str, const char* delims);
+char* strsep (char** str, const char* delims);
 #endif
 
-char *s_strcasestr(char *a, char *b);
-void * s_malloc (size_t size);
+const char* s_strcasestr (const char* a, const char* b);
+void* s_malloc (size_t size);
 
 #endif
diff --git a/ui-support.c b/ui-support.c
index cc56c8e..c498833 100644
--- a/ui-support.c
+++ b/ui-support.c
@@ -223,7 +223,7 @@ void UISupportDrawHeader (const char * headerstring) {
 	
 	mvprintw (0, 1, "* Snownews %s", VERSION);
 	if (headerstring != NULL) {
-		if (strlen(headerstring) > COLS-18)
+		if (strlen(headerstring) > COLS-18u)
 			mvaddnstr (0, 19, headerstring, COLS-20);
 		else
 			mvaddstr (0, COLS-strlen(headerstring)-1, headerstring);
diff --git a/updatecheck.c b/updatecheck.c
index e7b55a7..cf328eb 100644
--- a/updatecheck.c
+++ b/updatecheck.c
@@ -45,7 +45,6 @@ void AutoVersionCheck (void) {
 	int oldtime;
 	char *versionstring = NULL;
 	char *url;
-	char *freeme;
 	
 	update = newFeedStruct();
 	
@@ -77,7 +76,6 @@ void AutoVersionCheck (void) {
 	
 	url = strdup ("http://kiza.kcore.de/software/snownews/version");
 	update->feedurl = strdup(url);
-	freeme = url;
 	versionstring = DownloadFeed (url, update, 1);
 	free (url);
 	
diff --git a/xmlparse.c b/xmlparse.c
index ef93745..11241fb 100644
--- a/xmlparse.c
+++ b/xmlparse.c
@@ -183,7 +183,6 @@ void parse_rdf10_item(struct feed *feed, xmlDocPtr doc, xmlNodePtr node)
 {
 	xmlNodePtr cur;
 	xmlChar *readstatusstring;
-	char **hashitems = NULL;
 	char *guid = NULL;
 	char *date_str = NULL;
 	struct newsitem *item;
@@ -277,14 +276,9 @@ void parse_rdf10_item(struct feed *feed, xmlDocPtr doc, xmlNodePtr node)
 	   <guid> is not saved in the cache, thus we would generate a different
 	   hash than the one from the live feed. */
 	if (item->data->hash == NULL) {
-		hashitems = malloc (sizeof(char *) * 4);
-		hashitems[0] = item->data->title;
-		hashitems[1] = item->data->link;
-		hashitems[2] = guid;
-		hashitems[3] = NULL;
+		const char* hashitems[] = { item->data->title, item->data->link, guid, NULL };
 		item->data->hash = genItemHash (hashitems, 3);
 		xmlFree (guid);
-		free (hashitems);
 	}
 	
 	/* If saverestore == 1, restore readstatus. */
diff --git a/zlib_interface.c b/zlib_interface.c
index 9a9b325..12cdf45 100644
--- a/zlib_interface.c
+++ b/zlib_interface.c
@@ -26,7 +26,7 @@
 #include <zlib.h>
 #include <string.h>
 
-int JG_ZLIB_DEBUG = 0;
+static const int JG_ZLIB_DEBUG = 0;
 
 struct gzip_header {
 	unsigned char magic[2];
@@ -50,33 +50,33 @@ int jg_zlib_uncompress(void const *in_buf, int in_size,
 	z_stream stream;
 	char *out_buf = NULL;
 	int out_buf_bytes = 0;
-	char tmp_buf[4096];
+	unsigned char tmp_buf[4096];
 	int result;
 	int new_bytes;
-	
+
 	/* Prepare the stream structure. */
 	stream.zalloc = NULL;
 	stream.zfree = NULL;
 	stream.opaque = NULL;
-	stream.next_in = (void *)in_buf;	
+	stream.next_in = (void*) in_buf;
 	stream.avail_in = in_size;
 	stream.next_out = tmp_buf;
 	stream.avail_out = sizeof tmp_buf;
-	
+
 	if (out_size != NULL)
 		*out_size = 0;
-	
+
 	if (gzip)
 		result = inflateInit2(&stream, MAX_WBITS + 32); /* UNTESTED */
 	else
 		result = inflateInit2(&stream, -MAX_WBITS);
-	
+
 	if (result != 0) {
 		if (JG_ZLIB_DEBUG)
 			fprintf(stderr, "inflateInit2 failed: %d\n", result);
 		return JG_ZLIB_ERROR_OLDVERSION;
 	}
-	
+
 	do {
 		/* Should be Z_FINISH? */
 		result = inflate(&stream, Z_NO_FLUSH);
@@ -84,6 +84,7 @@ int jg_zlib_uncompress(void const *in_buf, int in_size,
 			case Z_BUF_ERROR:
 				if (stream.avail_in == 0)
 					goto DONE; /* zlib bug */
+				/* fallthrough */
 			case Z_ERRNO:
 			case Z_NEED_DICT:
 			case Z_MEM_ERROR:
@@ -114,19 +115,19 @@ int jg_zlib_uncompress(void const *in_buf, int in_size,
 			return JG_ZLIB_ERROR_NODATA;
 		}
 	} while (result != Z_STREAM_END);
-	
+
 DONE:
-	
+
 	inflateEnd(&stream);
-	
+
 	/* Null-terminate the output buffer so it can be handled like a string. */
 	out_buf = realloc(out_buf, out_buf_bytes + 1);
 	out_buf[out_buf_bytes] = 0;
-	
+
 	/* The returned size does NOT include the additionall null byte! */
 	if (out_size != NULL)
 		*out_size = out_buf_bytes;
-	
+
 	*out_buf_ptr = out_buf;
 
 	return 0;
@@ -141,24 +142,24 @@ int jg_gzip_uncompress(void const *in_buf, int in_size,
 	struct gzip_header const *header;
 	char *data_start;
 	int offset = sizeof *header;
-	
+
 	header = in_buf;
-	
+
 	if (out_size != NULL)
 		*out_size = 0;
-	
+
 	if ((header->magic[0] != 0x1F) || (header->magic[1] != 0x8B)) {
 		if (JG_ZLIB_DEBUG)
 			fprintf(stderr, "ERROR: Invalid magic bytes for GZIP data\n");
 		return JG_ZLIB_ERROR_BAD_MAGIC;
 	}
-	
+
 	if (header->method != 8) {
 		if (JG_ZLIB_DEBUG)
 			fprintf(stderr, "ERROR: Compression method is not deflate\n");
 		return JG_ZLIB_ERROR_BAD_METHOD;
 	}
-	
+
 	if (header->flags != 0 && header->flags != 8) {
 		if (JG_ZLIB_DEBUG) {
 			snprintf (tmpstring, sizeof(tmpstring), "ERROR: Unsupported flags %d", header->flags);
@@ -166,7 +167,7 @@ int jg_gzip_uncompress(void const *in_buf, int in_size,
 		}
 		return JG_ZLIB_ERROR_BAD_FLAGS;
 	}
-	
+
 	if (header->flags & 8) {
 		/* skip the file name */
 		while (offset < in_size) {
@@ -177,7 +178,7 @@ int jg_gzip_uncompress(void const *in_buf, int in_size,
 			offset++;
 		}
 	}
-	
+
 	data_start = (char *)in_buf + offset;
 
 	return jg_zlib_uncompress(data_start, in_size - offset - 8, 
diff --git a/zlib_interface.h b/zlib_interface.h
index 4644284..cc6f62d 100644
--- a/zlib_interface.h
+++ b/zlib_interface.h
@@ -32,8 +32,6 @@ enum JG_ZLIB_ERROR {
 	JG_ZLIB_ERROR_BAD_FLAGS = -6
 };
 
-extern int JG_ZLIB_DEBUG;
-
 int jg_zlib_uncompress(void const *in_buf, int in_size, 
                        void **out_buf_ptr, int *out_size,
                        int gzip);   
--- ./configure.orig	2018-10-30 09:16:43.691589791 +0000
+++ ./configure	2018-10-30 10:02:13.380306557 +0000
@@ -12,7 +12,7 @@
 chomp($xmlldflags);
 
 my $prefix = "/usr/local";
-my $cflags = "-Wall -Wno-format-y2k -O2 -DLOCALEPATH=\"\\\"\$(LOCALEPATH)\\\"\" -DOS=\\\"$os\\\" $xmlcflags \$(EXTRA_CFLAGS) ";
+my $cflags = "-Wall -O2 -DLOCALEPATH=\"\\\"\$(LOCALEPATH)\\\"\" -DOS=\\\"$os\\\" $xmlcflags \$(EXTRA_CFLAGS) ";
 my $ldflags = "-lintl -lncursesw -lcrypto $xmlldflags \$(EXTRA_LDFLAGS) ";
 
 my $use_nls = 1;