/src/FreeRDP/libfreerdp/utils/warnings.c
Line | Count | Source |
1 | | /** |
2 | | * FreeRDP: A Remote Desktop Protocol Implementation |
3 | | * Warning log functions |
4 | | * |
5 | | * Copyright 2026 Armin Novak <anovak@thincast.com> |
6 | | * Copyright 2026 Thincast Technologies GmbH |
7 | | * |
8 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
9 | | * you may not use this file except in compliance with the License. |
10 | | * You may obtain a copy of the License at |
11 | | * |
12 | | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | | * |
14 | | * Unless required by applicable law or agreed to in writing, software |
15 | | * distributed under the License is distributed on an "AS IS" BASIS, |
16 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | | * See the License for the specific language governing permissions and |
18 | | * limitations under the License. |
19 | | */ |
20 | | |
21 | | #include <winpr/string.h> |
22 | | #include <freerdp/utils/warnings.h> |
23 | | |
24 | | static const DWORD level = WLOG_WARN; |
25 | | |
26 | | static void warn_contact_details(wLog* log) |
27 | 0 | { |
28 | 0 | WLog_Print_unchecked( |
29 | 0 | log, level, |
30 | 0 | " If problems occur please check https://github.com/FreeRDP/FreeRDP/issues for " |
31 | 0 | "known issues!"); |
32 | 0 | WLog_Print_unchecked( |
33 | 0 | log, level, |
34 | 0 | "Be prepared to fix issues yourself though as nobody is actively working on this."); |
35 | 0 | WLog_Print_unchecked( |
36 | 0 | log, level, |
37 | 0 | " Developers hang out in https://matrix.to/#/#FreeRDP:matrix.org?via=matrix.org " |
38 | 0 | "- don't hesitate to ask some questions. (replies might take some time depending " |
39 | 0 | "on your timezone) - if you intend using this component write us a message"); |
40 | 0 | } |
41 | | |
42 | | void freerdp_warn_unmaintained(wLog* log, const char* what, ...) |
43 | 0 | { |
44 | 0 | if (!WLog_IsLevelActive(log, level)) |
45 | 0 | return; |
46 | | |
47 | 0 | char* str = nullptr; |
48 | 0 | size_t slen = 0; |
49 | 0 | va_list ap; |
50 | 0 | va_start(ap, what); |
51 | 0 | winpr_vasprintf(&str, &slen, what, ap); |
52 | 0 | va_end(ap); |
53 | |
|
54 | 0 | WLog_Print_unchecked(log, level, "[unmaintained] %s is currently unmaintained!", str); |
55 | 0 | free(str); |
56 | 0 | warn_contact_details(log); |
57 | 0 | } |
58 | | |
59 | | void freerdp_warn_experimental(wLog* log, const char* what, ...) |
60 | 0 | { |
61 | 0 | if (!WLog_IsLevelActive(log, level)) |
62 | 0 | return; |
63 | | |
64 | 0 | char* str = nullptr; |
65 | 0 | size_t slen = 0; |
66 | 0 | va_list ap; |
67 | 0 | va_start(ap, what); |
68 | 0 | winpr_vasprintf(&str, &slen, what, ap); |
69 | 0 | va_end(ap); |
70 | |
|
71 | 0 | WLog_Print_unchecked(log, level, "[experimental] %s is currently experimental!", str); |
72 | 0 | free(str); |
73 | 0 | warn_contact_details(log); |
74 | 0 | } |
75 | | |
76 | | void freerdp_warn_deprecated(wLog* log, const char* what, const char* replacement, ...) |
77 | 0 | { |
78 | 0 | if (!WLog_IsLevelActive(log, level)) |
79 | 0 | return; |
80 | | |
81 | 0 | char* str = nullptr; |
82 | 0 | size_t slen = 0; |
83 | 0 | va_list ap; |
84 | 0 | va_start(ap, replacement); |
85 | 0 | winpr_vasprintf(&str, &slen, what, ap); |
86 | 0 | va_end(ap); |
87 | |
|
88 | 0 | WLog_Print_unchecked(log, level, "[deprecated] %s has been deprecated", str); |
89 | 0 | if (replacement) |
90 | 0 | WLog_Print_unchecked(log, level, "%s", replacement); |
91 | 0 | WLog_Print_unchecked( |
92 | 0 | log, level, "If you are interested in keeping %s alive get in touch with the developers", |
93 | 0 | str); |
94 | |
|
95 | 0 | free(str); |
96 | 0 | warn_contact_details(log); |
97 | 0 | } |