1#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
9pub const EAGAIN: i32 = -35;
10#[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")))]
11pub const EAGAIN: i32 = -11;
12
13pub const EOF: i32 = -541_478_725; pub const ENOMEM: i32 = -12;
18
19pub const EINVAL: i32 = -22;
21
22#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
35pub const ETIMEDOUT: i32 = -60;
36#[cfg(windows)]
37pub const ETIMEDOUT: i32 = -138; #[cfg(not(any(
39 windows,
40 target_os = "macos",
41 target_os = "freebsd",
42 target_os = "openbsd"
43)))]
44pub const ETIMEDOUT: i32 = -110;
45
46#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
48pub const ECONNREFUSED: i32 = -61;
49#[cfg(windows)]
50pub const ECONNREFUSED: i32 = -107; #[cfg(not(any(
52 windows,
53 target_os = "macos",
54 target_os = "freebsd",
55 target_os = "openbsd"
56)))]
57pub const ECONNREFUSED: i32 = -111;
58
59#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
61pub const EHOSTUNREACH: i32 = -65;
62#[cfg(windows)]
63pub const EHOSTUNREACH: i32 = -110; #[cfg(not(any(
65 windows,
66 target_os = "macos",
67 target_os = "freebsd",
68 target_os = "openbsd"
69)))]
70pub const EHOSTUNREACH: i32 = -113;
71
72#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))]
74pub const ENETUNREACH: i32 = -51;
75#[cfg(windows)]
76pub const ENETUNREACH: i32 = -118; #[cfg(not(any(
78 windows,
79 target_os = "macos",
80 target_os = "freebsd",
81 target_os = "openbsd"
82)))]
83pub const ENETUNREACH: i32 = -101;
84
85pub const EIO: i32 = -5;
87
88pub const AVERROR_INVALIDDATA: i32 = -1_447_971_320;
93
94#[cfg(test)]
95mod tests {
96 use super::*;
97
98 #[test]
99 fn error_codes_should_all_be_negative() {
100 assert!(EAGAIN < 0);
101 assert!(EOF < 0);
102 assert!(ENOMEM < 0);
103 assert!(EINVAL < 0);
104 }
105
106 #[test]
107 fn averror_invaliddata_should_be_negative_and_distinct_from_einval() {
108 assert!(AVERROR_INVALIDDATA < 0);
109 assert_ne!(AVERROR_INVALIDDATA, EINVAL);
110 }
111
112 #[test]
113 fn averror_invaliddata_should_have_expected_value() {
114 assert_eq!(AVERROR_INVALIDDATA, -1_447_971_320);
116 }
117}