File: 10-build-on-R12B-5.patch

package info (click to toggle)
rabbitmq-server 3.3.5-1.1
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 12,004 kB
  • sloc: erlang: 78,203; python: 3,187; xml: 2,843; makefile: 903; sh: 831; java: 660; perl: 64; ruby: 63
file content (303 lines) | stat: -rw-r--r-- 12,017 bytes parent folder | download | duplicates (2)
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
diff --git a/src/mochiglobal.erl b/src/mochiglobal.erl
index ea645b0..6b20e41 100644
--- a/src/mochiglobal.erl
+++ b/src/mochiglobal.erl
@@ -6,12 +6,12 @@
 -author("Bob Ippolito <bob@mochimedia.com>").
 -export([get/1, get/2, put/2, delete/1]).
 
--spec get(atom()) -> any() | undefined.
+%% -spec get(atom()) -> any() | undefined.
 %% @equiv get(K, undefined)
 get(K) ->
     get(K, undefined).
 
--spec get(atom(), T) -> any() | T.
+%% -spec get(atom(), T) -> any() | T.
 %% @doc Get the term for K or return Default.
 get(K, Default) ->
     get(K, Default, key_to_module(K)).
@@ -22,7 +22,7 @@ get(_K, Default, Mod) ->
             Default
     end.
 
--spec put(atom(), any()) -> ok.
+%% -spec put(atom(), any()) -> ok.
 %% @doc Store term V at K, replaces an existing term if present.
 put(K, V) ->
     put(K, V, key_to_module(K)).
@@ -33,7 +33,7 @@ put(_K, V, Mod) ->
     {module, Mod} = code:load_binary(Mod, atom_to_list(Mod) ++ ".erl", Bin),
     ok.
 
--spec delete(atom()) -> boolean().
+%% -spec delete(atom()) -> boolean().
 %% @doc Delete term stored at K, no-op if non-existent.
 delete(K) ->
     delete(K, key_to_module(K)).
@@ -42,21 +42,21 @@ delete(_K, Mod) ->
     code:purge(Mod),
     code:delete(Mod).
 
--spec key_to_module(atom()) -> atom().
+%% -spec key_to_module(atom()) -> atom().
 key_to_module(K) ->
     list_to_atom("mochiglobal:" ++ atom_to_list(K)).
 
--spec compile(atom(), any()) -> binary().
+%% -spec compile(atom(), any()) -> binary().
 compile(Module, T) ->
     {ok, Module, Bin} = compile:forms(forms(Module, T),
                                       [verbose, report_errors]),
     Bin.
 
--spec forms(atom(), any()) -> [erl_syntax:syntaxTree()].
+%% -spec forms(atom(), any()) -> [erl_syntax:syntaxTree()].
 forms(Module, T) ->
     [erl_syntax:revert(X) || X <- term_to_abstract(Module, term, T)].
 
--spec term_to_abstract(atom(), atom(), any()) -> [erl_syntax:syntaxTree()].
+%% -spec term_to_abstract(atom(), atom(), any()) -> [erl_syntax:syntaxTree()].
 term_to_abstract(Module, Getter, T) ->
     [%% -module(Module).
      erl_syntax:attribute(
diff --git a/src/mochiutf8.erl b/src/mochiutf8.erl
index 28f28c1..c9d2751 100644
--- a/src/mochiutf8.erl
+++ b/src/mochiutf8.erl
@@ -11,11 +11,11 @@
 
 %% External API
 
--type unichar_low() :: 0..16#d7ff.
--type unichar_high() :: 16#e000..16#10ffff.
--type unichar() :: unichar_low() | unichar_high().
+%% -type unichar_low() :: 0..16#d7ff.
+%% -type unichar_high() :: 16#e000..16#10ffff.
+%% -type unichar() :: unichar_low() | unichar_high().
 
--spec codepoint_to_bytes(unichar()) -> binary().
+%% -spec codepoint_to_bytes(unichar()) -> binary().
 %% @doc Convert a unicode codepoint to UTF-8 bytes.
 codepoint_to_bytes(C) when (C >= 16#00 andalso C =< 16#7f) ->
     %% U+0000 - U+007F - 7 bits
@@ -40,12 +40,12 @@ codepoint_to_bytes(C) when (C >= 16#010000 andalso C =< 16#10FFFF) ->
       2#10:2, B1:6,
       2#10:2, B0:6>>.
 
--spec codepoints_to_bytes([unichar()]) -> binary().
+%% -spec codepoints_to_bytes([unichar()]) -> binary().
 %% @doc Convert a list of codepoints to a UTF-8 binary.
 codepoints_to_bytes(L) ->
     <<<<(codepoint_to_bytes(C))/binary>> || C <- L>>.
 
--spec read_codepoint(binary()) -> {unichar(), binary(), binary()}.
+%% -spec read_codepoint(binary()) -> {unichar(), binary(), binary()}.
 read_codepoint(Bin = <<2#0:1, C:7, Rest/binary>>) ->
     %% U+0000 - U+007F - 7 bits
     <<B:1/binary, _/binary>> = Bin,
@@ -82,32 +82,32 @@ read_codepoint(Bin = <<2#11110:5, B3:3,
             {C, B, Rest}
     end.
 
--spec codepoint_foldl(fun((unichar(), _) -> _), _, binary()) -> _.
+%% -spec codepoint_foldl(fun((unichar(), _) -> _), _, binary()) -> _.
 codepoint_foldl(F, Acc, <<>>) when is_function(F, 2) ->
     Acc;
 codepoint_foldl(F, Acc, Bin) ->
     {C, _, Rest} = read_codepoint(Bin),
     codepoint_foldl(F, F(C, Acc), Rest).
 
--spec bytes_foldl(fun((binary(), _) -> _), _, binary()) -> _.
+%% -spec bytes_foldl(fun((binary(), _) -> _), _, binary()) -> _.
 bytes_foldl(F, Acc, <<>>) when is_function(F, 2) ->
     Acc;
 bytes_foldl(F, Acc, Bin) ->
     {_, B, Rest} = read_codepoint(Bin),
     bytes_foldl(F, F(B, Acc), Rest).
 
--spec bytes_to_codepoints(binary()) -> [unichar()].
+%% -spec bytes_to_codepoints(binary()) -> [unichar()].
 bytes_to_codepoints(B) ->
     lists:reverse(codepoint_foldl(fun (C, Acc) -> [C | Acc] end, [], B)).
 
--spec len(binary()) -> non_neg_integer().
+%% -spec len(binary()) -> non_neg_integer().
 len(<<>>) ->
     0;
 len(B) ->
     {_, _, Rest} = read_codepoint(B),
     1 + len(Rest).
 
--spec valid_utf8_bytes(B::binary()) -> binary().
+%% -spec valid_utf8_bytes(B::binary()) -> binary().
 %% @doc Return only the bytes in B that represent valid UTF-8. Uses
 %%      the following recursive algorithm: skip one byte if B does not
 %%      follow UTF-8 syntax (a 1-4 byte encoding of some number),
@@ -118,7 +118,7 @@ valid_utf8_bytes(B) when is_binary(B) ->
 
 %% Internal API
 
--spec binary_skip_bytes(binary(), [non_neg_integer()]) -> binary().
+%% -spec binary_skip_bytes(binary(), [non_neg_integer()]) -> binary().
 %% @doc Return B, but skipping the 0-based indexes in L.
 binary_skip_bytes(B, []) ->
     B;
@@ -126,7 +126,7 @@ binary_skip_bytes(B, L) ->
     binary_skip_bytes(B, L, 0, []).
 
 %% @private
--spec binary_skip_bytes(binary(), [non_neg_integer()], non_neg_integer(), iolist()) -> binary().
+%% -spec binary_skip_bytes(binary(), [non_neg_integer()], non_neg_integer(), iolist()) -> binary().
 binary_skip_bytes(B, [], _N, Acc) ->
     iolist_to_binary(lists:reverse([B | Acc]));
 binary_skip_bytes(<<_, RestB/binary>>, [N | RestL], N, Acc) ->
@@ -134,13 +134,13 @@ binary_skip_bytes(<<_, RestB/binary>>, [N | RestL], N, Acc) ->
 binary_skip_bytes(<<C, RestB/binary>>, L, N, Acc) ->
     binary_skip_bytes(RestB, L, 1 + N, [C | Acc]).
 
--spec invalid_utf8_indexes(binary()) -> [non_neg_integer()].
+%% -spec invalid_utf8_indexes(binary()) -> [non_neg_integer()].
 %% @doc Return the 0-based indexes in B that are not valid UTF-8.
 invalid_utf8_indexes(B) ->
     invalid_utf8_indexes(B, 0, []).
 
 %% @private.
--spec invalid_utf8_indexes(binary(), non_neg_integer(), [non_neg_integer()]) -> [non_neg_integer()].
+%% -spec invalid_utf8_indexes(binary(), non_neg_integer(), [non_neg_integer()]) -> [non_neg_integer()].
 invalid_utf8_indexes(<<C, Rest/binary>>, N, Acc) when C < 16#80 ->
     %% U+0000 - U+007F - 7 bits
     invalid_utf8_indexes(Rest, 1 + N, Acc);
diff --git a/src/mochiweb_charref.erl b/src/mochiweb_charref.erl
index 193c7c7..665d0f9 100644
--- a/src/mochiweb_charref.erl
+++ b/src/mochiweb_charref.erl
@@ -11,7 +11,7 @@
 %%      codepoint, or return undefined on failure.
 %%      The input should not include an ampersand or semicolon.
 %%      charref("#38") = 38, charref("#x26") = 38, charref("amp") = 38.
--spec charref(binary() | string()) -> integer() | [integer()] | undefined.
+%% -spec charref(binary() | string()) -> integer() | [integer()] | undefined.
 charref(B) when is_binary(B) ->
     charref(binary_to_list(B));
 charref([$#, C | L]) when C =:= $x orelse C =:= $X ->
diff --git a/src/mochiweb_http.erl b/src/mochiweb_http.erl
index 931ecd0..ae6410f 100644
--- a/src/mochiweb_http.erl
+++ b/src/mochiweb_http.erl
@@ -121,12 +121,12 @@ call_body({M, F}, Req) ->
 call_body(Body, Req) ->
     Body(Req).
 
--spec handle_invalid_request(term()) -> no_return().
+%% -spec handle_invalid_request(term()) -> no_return().
 handle_invalid_request(Socket) ->
     handle_invalid_request(Socket, {'GET', {abs_path, "/"}, {0,9}}, []),
     exit(normal).
 
--spec handle_invalid_request(term(), term(), term()) -> no_return().
+%% -spec handle_invalid_request(term(), term(), term()) -> no_return().
 handle_invalid_request(Socket, Request, RevHeaders) ->
     Req = new_request(Socket, Request, RevHeaders),
     Req:respond({400, [], []}),
diff --git a/src/mochiweb_session.erl b/src/mochiweb_session.erl
index ac5d66b..ddf7c46 100644
--- a/src/mochiweb_session.erl
+++ b/src/mochiweb_session.erl
@@ -21,11 +21,11 @@
 
 %% @doc Generates a secure encrypted binary convining all the parameters. The
 %% expiration time must be a 32-bit integer.
--spec generate_session_data(
-        ExpirationTime :: expiration_time(),
-        Data :: iolist(),
-        FSessionKey :: key_fun(),
-        ServerKey :: iolist()) -> binary().
+%% -spec generate_session_data(
+%%        ExpirationTime :: expiration_time(),
+%%        Data :: iolist(),
+%%        FSessionKey :: key_fun(),
+%%        ServerKey :: iolist()) -> binary().
 generate_session_data(ExpirationTime, Data, FSessionKey, ServerKey)
   when is_integer(ExpirationTime), is_function(FSessionKey)->
     BData = ensure_binary(Data),
@@ -39,11 +39,11 @@ generate_session_data(ExpirationTime, Data, FSessionKey, ServerKey)
 %% @doc Convenience wrapper for generate_session_data that returns a
 %% mochiweb cookie with "id" as the key, a max_age of 20000 seconds,
 %% and the current local time as local time.
--spec generate_session_cookie(
-        ExpirationTime :: expiration_time(),
-        Data :: iolist(),
-        FSessionKey :: key_fun(),
-        ServerKey :: iolist()) -> header().
+%% -spec generate_session_cookie(
+%%        ExpirationTime :: expiration_time(),
+%%        Data :: iolist(),
+%%        FSessionKey :: key_fun(),
+%%        ServerKey :: iolist()) -> header().
 generate_session_cookie(ExpirationTime, Data, FSessionKey, ServerKey)
   when is_integer(ExpirationTime), is_function(FSessionKey)->
     CookieData = generate_session_data(ExpirationTime, Data,
@@ -55,13 +55,13 @@ generate_session_cookie(ExpirationTime, Data, FSessionKey, ServerKey)
                                 calendar:universal_time())}]).
 
 %% TODO: This return type is messy to express in the type system.
--spec check_session_cookie(
-        ECookie :: binary(),
-        ExpirationTime :: string(),
-        FSessionKey :: key_fun(),
-        ServerKey :: iolist()) ->
-    {Success :: boolean(),
-     ExpTimeAndData :: [integer() | binary()]}.
+%% -spec check_session_cookie(
+    %%     ECookie :: binary(),
+    %%     ExpirationTime :: string(),
+    %%     FSessionKey :: key_fun(),
+    %%     ServerKey :: iolist()) ->
+    %% {Success :: boolean(),
+    %%  ExpTimeAndData :: [integer() | binary()]}.
 check_session_cookie(ECookie, ExpirationTime, FSessionKey, ServerKey)
   when is_binary(ECookie), is_integer(ExpirationTime),
        is_function(FSessionKey) ->
@@ -83,7 +83,7 @@ check_session_cookie(_ECookie, _ExpirationTime, _FSessionKey, _ServerKey) ->
     {false, []}.
 
 %% 'Constant' time =:= operator for binary, to mitigate timing attacks.
--spec eq(binary(), binary()) -> boolean().
+%% -spec eq(binary(), binary()) -> boolean().
 eq(A, B) when is_binary(A) andalso is_binary(B) ->
     eq(A, B, 0).
 
@@ -94,27 +94,27 @@ eq(<<>>, <<>>, 0) ->
 eq(_As, _Bs, _Acc) ->
     false.
 
--spec ensure_binary(iolist()) -> binary().
+%% -spec ensure_binary(iolist()) -> binary().
 ensure_binary(B) when is_binary(B) ->
     B;
 ensure_binary(L) when is_list(L) ->
     iolist_to_binary(L).
 
--spec encrypt_data(binary(), binary()) -> binary().
+%% -spec encrypt_data(binary(), binary()) -> binary().
 encrypt_data(Data, Key) ->
     IV = crypto:rand_bytes(16),
     Crypt = crypto:aes_cfb_128_encrypt(Key, IV, Data),
     <<IV/binary, Crypt/binary>>.
 
--spec decrypt_data(binary(), binary()) -> binary().
+%% -spec decrypt_data(binary(), binary()) -> binary().
 decrypt_data(<<IV:16/binary, Crypt/binary>>, Key) ->
     crypto:aes_cfb_128_decrypt(Key, IV, Crypt).
 
--spec gen_key(iolist(), iolist()) -> binary().
+%% -spec gen_key(iolist(), iolist()) -> binary().
 gen_key(ExpirationTime, ServerKey)->
     crypto:md5_mac(ServerKey, [ExpirationTime]).
 
--spec gen_hmac(iolist(), binary(), iolist(), binary()) -> binary().
+%% -spec gen_hmac(iolist(), binary(), iolist(), binary()) -> binary().
 gen_hmac(ExpirationTime, Data, SessionKey, Key) ->
     crypto:sha_mac(Key, [ExpirationTime, Data, SessionKey]).