Ticket #41890: patch-clang-compatibility.diff

File patch-clang-compatibility.diff, 7.3 KB (added by jgosmann (Jan Gosmann), 10 years ago)

Required patchfile for compilation with clang.

Line 
1diff -rupN dar-2.4.11/src/dar_suite/command_line.cpp dar-2.4.11-dev/src/dar_suite/command_line.cpp
2--- src/dar_suite/command_line.cpp      2013-08-26 00:02:14.000000000 +0200
3+++ src/dar_suite/command_line.cpp      2013-11-16 17:01:55.000000000 +0100
4@@ -778,7 +778,7 @@ static bool get_args_recursive(recursive
5                        try
6                        {
7                                // trying to read a simple integer
8-                           deci tmp = string(optarg);
9+                           libdar::deci tmp = string(optarg);
10                            p.fixed_date = tmp.computer();
11                        }
12                        catch(Edeci & e)
13@@ -865,7 +865,7 @@ static bool get_args_recursive(recursive
14             case 'p':
15                if(optarg != NULL)
16                {
17-                   deci conv = string(optarg);
18+                   libdar::deci conv = string(optarg);
19                    p.pause = conv.computer();
20                }
21                else
22@@ -1244,7 +1244,7 @@ static bool get_args_recursive(recursive
23                 {
24                     try
25                     {
26-                        p.hourshift = deci(string(optarg)).computer();
27+                        p.hourshift = libdar::deci(string(optarg)).computer();
28                     }
29                     catch(Edeci & e)
30                     {
31diff -rupN dar-2.4.11/src/dar_suite/crit_action_cmd_line.cpp dar-2.4.11-dev/src/dar_suite/crit_action_cmd_line.cpp
32--- src/dar_suite/crit_action_cmd_line.cpp      2013-08-25 19:09:49.000000000 +0200
33+++ src/dar_suite/crit_action_cmd_line.cpp      2013-11-16 17:03:59.000000000 +0100
34@@ -412,7 +412,7 @@ static const criterium * criterium_creat
35                case 'r':
36                    try
37                    {
38-                       deci tmp = sub_arg;
39+                       libdar::deci tmp = sub_arg;
40                        date = tmp.computer();
41                    }
42                    catch(Edeci & e)
43diff -rupN dar-2.4.11/src/dar_suite/dar_manager.cpp dar-2.4.11-dev/src/dar_suite/dar_manager.cpp
44--- src/dar_suite/dar_manager.cpp       2013-08-26 00:02:14.000000000 +0200
45+++ src/dar_suite/dar_manager.cpp       2013-11-16 17:13:39.000000000 +0100
46@@ -78,7 +78,7 @@ using namespace libdar;
47 #define INVALID_ARG "Invalid argument given to -%c (requires integer)"
48 #define OPT_STRING "C:B:A:lD:b:p:od:ru:f:shVm:vQjw:ie:c@:N;:ka:"
49 
50-enum operation { none_op, create, add, listing, del, chbase, where, options, dar, restore, used, files, stats, move, interactive, check, batch };
51+namespace libdar { enum operation { none_op, create, add, listing, del, chbase, where, options, dar, restore, used, files, stats, move, interactive, check, batch }; };
52 
53 static S_I little_main(user_interaction & dialog, S_I argc, char *const argv[], const char **env);
54 static bool command_line(user_interaction & dialog,
55@@ -197,7 +197,7 @@ S_I little_main(user_interaction & dialo
56     case used:
57     case files:
58     case stats:
59-    case move:
60+    case libdar::move:
61     case interactive:
62     case check:
63     case batch:
64@@ -404,7 +404,7 @@ static bool command_line(user_interactio
65                case 'm':
66                    if(op != none_op)
67                        throw Erange("command_line", tools_printf(gettext(ONLY_ONCE), char(lu)));
68-                   op = move;
69+                   op = libdar::move;
70                    if(optarg == NULL)
71                        throw Erange("command_line", tools_printf(gettext(MISSING_ARG), char(lu)));
72                    num = tools_str2int(optarg);
73@@ -466,7 +466,7 @@ static bool command_line(user_interactio
74                    {
75                        try
76                        {
77-                           deci tmp = string(optarg);
78+                           libdar::deci tmp = string(optarg);
79                            date = tmp.computer();
80                        }
81                        catch(Edeci & e)
82@@ -555,7 +555,7 @@ static bool command_line(user_interactio
83            break;
84        case options:
85            break;
86-       case move:
87+       case libdar::move:
88            if(rest.size() != 1)
89            {
90                dialog.warning(gettext("Missing argument to command line, aborting"));
91@@ -1321,7 +1321,7 @@ static void finalize(user_interaction &
92     case where:
93     case options:
94     case dar:
95-    case move:
96+    case libdar::move:
97     case batch:
98        if(info_details)
99            dialog.warning(gettext("Compressing and writing back database to file..."));
100@@ -1385,7 +1385,7 @@ static void action(user_interaction & di
101     case stats:
102        op_stats(dialog, dat, info_details);
103        break;
104-    case move:
105+    case libdar::move:
106        op_move(dialog, dat, num, num2, info_details);
107        break;
108     case interactive:
109diff -rupN dar-2.4.11/src/dar_suite/dar_xform.cpp dar-2.4.11-dev/src/dar_suite/dar_xform.cpp
110--- src/dar_suite/dar_xform.cpp 2013-08-26 00:02:14.000000000 +0200
111+++ src/dar_suite/dar_xform.cpp 2013-11-16 17:04:25.000000000 +0100
112@@ -342,7 +342,7 @@ static bool command_line(user_interactio
113             case 'p':
114                if(optarg != NULL)
115                {
116-                   deci conv = string(optarg);
117+                   libdar::deci conv = string(optarg);
118                    pause = conv.computer();
119                }
120                else
121diff -rupN dar-2.4.11/src/dar_suite/line_tools.cpp dar-2.4.11-dev/src/dar_suite/line_tools.cpp
122--- src/dar_suite/line_tools.cpp        2013-08-26 00:02:14.000000000 +0200
123+++ src/dar_suite/line_tools.cpp        2013-11-16 17:03:30.000000000 +0100
124@@ -221,8 +221,8 @@ void line_tools_repeat_param(const strin
125 
126     try
127     {
128-       deci x1 = tmp1;
129-       deci x2 = tmp2;
130+       libdar::deci x1 = tmp1;
131+       libdar::deci x2 = tmp2;
132 
133        repeat_count = x1.computer();
134        repeat_byte = x2.computer();
135@@ -520,14 +520,14 @@ void line_tools_get_min_digits(string th
136        it1 = tools_find_first_char_of(the_arg, ',');
137        if(it1 == the_arg.end()) // a single number is provided
138        {
139-           deci tmp = the_arg;
140+           libdar::deci tmp = the_arg;
141            num = tmp.computer();
142        }
143        else // at least two numbers are provided
144        {
145            if(the_arg.begin() != it1)
146            {
147-               deci convert = string(the_arg.begin(), it1);
148+               libdar::deci convert = string(the_arg.begin(), it1);
149                num = convert.computer();
150            }
151                // else we ignore the leading ','
152@@ -539,20 +539,20 @@ void line_tools_get_min_digits(string th
153            it2 = tools_find_first_char_of(tmp2, ',');
154            if(it2 == tmp2.end()) // just two number have been provided
155            {
156-               deci convert = tmp2;
157+               libdar::deci convert = tmp2;
158                ref_num = convert.computer();
159            }
160            else
161            {
162                if(tmp2.begin() != it2)
163                {
164-                   deci convert = string(tmp2.begin(), it2);
165+                   libdar::deci convert = string(tmp2.begin(), it2);
166                    ref_num = convert.computer();
167                }
168                ++it2;
169                if(it2 != tmp2.end())
170                {
171-                   deci convert = string(it2, tmp2.end());
172+                   libdar::deci convert = string(it2, tmp2.end());
173                    aux_num = convert.computer();
174                }
175            }
176diff -rupN dar-2.4.11/src/libdar/generic_file.cpp dar-2.4.11-dev/src/libdar/generic_file.cpp
177--- src/libdar/generic_file.cpp 2013-08-25 19:09:49.000000000 +0200
178+++ src/libdar/generic_file.cpp 2013-11-03 09:15:46.000000000 +0100
179@@ -470,7 +470,7 @@ namespace libdar
180 
181     const char * generic_file_get_name(gf_mode mode)
182     {
183-        char *ret = NULL;
184+        const char *ret = NULL;
185 
186         switch(mode)
187         {
188diff -rupN dar-2.4.11/src/libdar/mask_list.hpp dar-2.4.11-dev/src/libdar/mask_list.hpp
189--- src/libdar/mask_list.hpp    2013-08-25 19:09:49.000000000 +0200
190+++ src/libdar/mask_list.hpp    2013-11-16 16:56:09.000000000 +0100
191@@ -77,8 +77,8 @@ namespace libdar
192        class my_char
193        {
194        public:
195-           my_char() { val = 0; };
196+           my_char() = default;
197            my_char(const char x) : val(x) {};
198            bool operator < (const my_char & x) const
199            {
200                if(val == '/')
201diff -rupN dar-2.4.11/src/libdar/tools.cpp dar-2.4.11-dev/src/libdar/tools.cpp
202--- src/libdar/tools.cpp        2013-08-26 00:02:14.000000000 +0200
203+++ src/libdar/tools.cpp        2013-11-03 18:57:49.000000000 +0100
204@@ -1048,7 +1048,7 @@ namespace libdar
205 
206     void tools_display_features(user_interaction & dialog)
207     {
208-       char *endy = NULL;
209+       const char *endy = NULL;
210 
211        tools_display_features(dialog,
212                               compile_time::ea(),