Skip to content

Commit 4da4bca

Browse files
committed
Run the C++ glue through clang-tidy
```sh clang-tidy '--checks=*,-llvmlibc-restrict-system-libc-headers,-fuchsia-trailing-return' haiku/src/implementation.cc ```
1 parent 185a25d commit 4da4bca

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

haiku/src/implementation.cc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
extern "C" {
1313

14-
size_t iana_time_zone_haiku_get_tz(char *buf, size_t buf_size) {
14+
auto iana_time_zone_haiku_get_tz(char *buf, const std::size_t buf_size) -> std::size_t {
1515
try {
1616
static_assert(sizeof(char) == sizeof(uint8_t), "Illegal char size");
1717

18-
if (!buf || buf_size == 0) {
18+
if (buf == nullptr || buf_size == 0) {
1919
return 0;
2020
}
2121

@@ -26,18 +26,18 @@ size_t iana_time_zone_haiku_get_tz(char *buf, size_t buf_size) {
2626
return 0;
2727
}
2828

29-
BTimeZone tz(NULL, NULL);
30-
if (locale_roster->GetDefaultTimeZone(&tz) != B_OK) {
29+
BTimeZone timezone(nullptr, nullptr);
30+
if (locale_roster->GetDefaultTimeZone(&timezone) != B_OK) {
3131
return 0;
3232
}
3333

34-
BString bname(tz.ID());
35-
auto raw_length = bname.Length();
34+
const BString bname = timezone.ID();
35+
const auto raw_length = bname.Length();
3636
if (raw_length <= 0) {
3737
return 0;
3838
}
3939

40-
size_t length = static_cast<size_t>(raw_length);
40+
const auto length = static_cast<std::size_t>(raw_length);
4141
if (length > buf_size) {
4242
return 0;
4343
}
@@ -54,13 +54,19 @@ size_t iana_time_zone_haiku_get_tz(char *buf, size_t buf_size) {
5454
return 0;
5555
}
5656
}
57+
5758
} // extern "C"
5859

5960
#else
6061

6162
extern "C" {
6263

63-
size_t iana_time_zone_haiku_get_tz(char *buf, size_t buf_size) { return 0; }
64+
// NOLINTBEGIN(misc-unused-parameters)
65+
66+
auto iana_time_zone_haiku_get_tz(char *buf, const std::size_t buf_size) -> std::size_t { return 0; }
67+
68+
// NOLINTEND(misc-unused-parameters)
69+
6470
} // extern "C"
6571

6672
#endif

0 commit comments

Comments
 (0)