Skip to content

Commit 5305b03

Browse files
detulejimhester
andauthored
src/cctz: Fix warning about anonymous unions (CRAN) (#440)
* src/cctz: Fix warning about anonymous unions (CRAN) Addresses #438 Used: find src/ -type f | xargs -I {} sed -i 's/date\.\(m\|j\|n\)/date\.data\.\1/' {} * Add note to news Co-authored-by: Jim Hester <[email protected]>
1 parent 731b46f commit 5305b03

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# odbc (development version)
22

3+
* Fixed warnings about anonymous unions (@detule, #440)
34
* Fixed `invalid descriptor` issues when retrieving results from SQL Server +
45
Microsoft's ODBC driver, using parametrized queries. (@detule, #414)
56
* Fixed null handling in SQL Server / Azure result sets retrieved with

src/cctz/src/time_zone_info.cc

+7-7
Original file line numberDiff line numberDiff line change
@@ -230,24 +230,24 @@ int64_t TransOffset(bool leap_year, int jan1_weekday,
230230
int days = 0;
231231
switch (pt.date.fmt) {
232232
case PosixTransition::J: {
233-
days = pt.date.j.day;
233+
days = pt.date.data.j.day;
234234
if (!leap_year || days < kMonthOffsets[1][TM_MARCH + 1]) days -= 1;
235235
break;
236236
}
237237
case PosixTransition::N: {
238-
days = pt.date.n.day;
238+
days = pt.date.data.n.day;
239239
break;
240240
}
241241
case PosixTransition::M: {
242-
const bool last_week = (pt.date.m.week == 5);
243-
days = kMonthOffsets[leap_year][pt.date.m.month + last_week];
242+
const bool last_week = (pt.date.data.m.week == 5);
243+
days = kMonthOffsets[leap_year][pt.date.data.m.month + last_week];
244244
const int weekday = (jan1_weekday + days) % DAYSPERWEEK;
245245
if (last_week) {
246246
days -=
247-
(weekday + DAYSPERWEEK - 1 - pt.date.m.weekday) % DAYSPERWEEK + 1;
247+
(weekday + DAYSPERWEEK - 1 - pt.date.data.m.weekday) % DAYSPERWEEK + 1;
248248
} else {
249-
days += (pt.date.m.weekday + DAYSPERWEEK - weekday) % DAYSPERWEEK;
250-
days += (pt.date.m.week - 1) * DAYSPERWEEK;
249+
days += (pt.date.data.m.weekday + DAYSPERWEEK - weekday) % DAYSPERWEEK;
250+
days += (pt.date.data.m.week - 1) * DAYSPERWEEK;
251251
}
252252
break;
253253
}

src/cctz/src/time_zone_posix.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,23 @@ const char* ParseDateTime(const char* p, PosixTransition* res) {
9696
int weekday = 0;
9797
if ((p = ParseInt(p + 1, 0, 6, &weekday)) != nullptr) {
9898
res->date.fmt = PosixTransition::M;
99-
res->date.m.month = month;
100-
res->date.m.week = week;
101-
res->date.m.weekday = weekday;
99+
res->date.data.m.month = month;
100+
res->date.data.m.week = week;
101+
res->date.data.m.weekday = weekday;
102102
}
103103
}
104104
}
105105
} else if (*p == 'J') {
106106
int day = 0;
107107
if ((p = ParseInt(p + 1, 1, 365, &day)) != nullptr) {
108108
res->date.fmt = PosixTransition::J;
109-
res->date.j.day = day;
109+
res->date.data.j.day = day;
110110
}
111111
} else {
112112
int day = 0;
113113
if ((p = ParseInt(p, 0, 365, &day)) != nullptr) {
114114
res->date.fmt = PosixTransition::N;
115-
res->date.j.day = day;
115+
res->date.data.j.day = day;
116116
}
117117
}
118118
}

src/cctz/src/time_zone_posix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct PosixTransition {
8080
int8_t week; // week of month [1:5] (5==last)
8181
int8_t weekday; // 0==Sun, ..., 6=Sat
8282
} m;
83-
};
83+
} data;
8484
} date;
8585
struct {
8686
int offset; // seconds before/after 00:00:00

0 commit comments

Comments
 (0)