Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
efd7ec7b
Commit
efd7ec7b
authored
Jan 16, 2017
by
Thomas Jahns
🤸
Browse files
Fix pointer aliasing.
parent
f2483736
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/stream_cdf_i.c
View file @
efd7ec7b
...
...
@@ -203,48 +203,48 @@ int setBaseTime(const char *timeunits, taxis_t *taxis)
int
rdate
=
-
1
,
rtime
=
-
1
;
size_t
len
=
strlen
(
timeunits
);
char
*
tu
=
(
char
*
)
Malloc
((
len
+
1
)
*
sizeof
(
char
));
memcpy
(
tu
,
timeunits
,
(
len
+
1
)
*
sizeof
(
char
));
char
*
ptu
=
tu
;
char
*
restrict
tu
=
(
char
*
)
Malloc
((
len
+
1
)
*
sizeof
(
char
));
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
ptu
[
i
]
=
(
char
)
tolower
((
int
)
ptu
[
i
]);
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
tu
[
i
]
=
(
char
)
tolower
((
int
)
timeunits
[
i
]);
tu
[
len
]
=
0
;
int
timeunit
=
get_timeunit
(
len
,
p
tu
);
int
timeunit
=
get_timeunit
(
len
,
tu
);
if
(
timeunit
==
-
1
)
{
Message
(
"Unsupported TIMEUNIT: %s!"
,
timeunits
);
return
1
;
}
while
(
!
isspace
(
*
ptu
)
&&
*
ptu
!=
0
)
ptu
++
;
if
(
*
ptu
)
size_t
pos
=
0
;
while
(
!
isspace
(
tu
[
pos
])
&&
tu
[
pos
]
!=
0
)
++
pos
;
if
(
tu
[
pos
]
)
{
while
(
isspace
(
*
ptu
)
)
ptu
++
;
while
(
isspace
(
tu
[
pos
])
)
++
pos
;
if
(
str_is_equal
(
p
tu
,
"since"
)
)
if
(
str_is_equal
(
tu
+
pos
,
"since"
)
)
timetype
=
TAXIS_RELATIVE
;
while
(
!
isspace
(
*
ptu
)
&&
*
ptu
!=
0
)
ptu
++
;
if
(
*
p
tu
)
while
(
!
isspace
(
tu
[
pos
])
&&
tu
[
pos
]
!=
0
)
++
pos
;
if
(
tu
[
pos
]
)
{
while
(
isspace
(
*
ptu
)
)
ptu
++
;
while
(
isspace
(
tu
[
pos
])
)
++
pos
;
if
(
timetype
==
TAXIS_ABSOLUTE
)
{
if
(
!
str_is_equal
(
p
tu
,
"%y%m%d.%f"
)
&&
timeunit
==
TUNIT_DAY
)
if
(
!
str_is_equal
(
tu
+
pos
,
"%y%m%d.%f"
)
&&
timeunit
==
TUNIT_DAY
)
{
Message
(
"Unsupported format %s for TIMEUNIT day!"
,
p
tu
);
Message
(
"Unsupported format %s for TIMEUNIT day!"
,
tu
+
pos
);
timeunit
=
-
1
;
}
else
if
(
!
str_is_equal
(
p
tu
,
"%y%m.%f"
)
&&
timeunit
==
TUNIT_MONTH
)
else
if
(
!
str_is_equal
(
tu
+
pos
,
"%y%m.%f"
)
&&
timeunit
==
TUNIT_MONTH
)
{
Message
(
"Unsupported format %s for TIMEUNIT month!"
,
p
tu
);
Message
(
"Unsupported format %s for TIMEUNIT month!"
,
tu
+
pos
);
timeunit
=
-
1
;
}
}
else
if
(
timetype
==
TAXIS_RELATIVE
)
{
scanTimeString
(
p
tu
,
&
rdate
,
&
rtime
);
scanTimeString
(
tu
+
pos
,
&
rdate
,
&
rtime
);
(
*
taxis
).
rdate
=
rdate
;
(
*
taxis
).
rtime
=
rtime
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment