On Tue, 17 Mar 2015, [email protected] wrote:
On 2015-03-07 23:21, Martin Storsjö wrote:
The str variable is a char ** here.
---
libavformat/mxfdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 2b8bd89..563f0ed 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1736,7 +1736,7 @@ static int mxf_timestamp_to_str(uint64_t
timestamp, char **str)
if (!*str)
return AVERROR(ENOMEM);
if (!strftime(*str, 32, "%Y-%m-%d %H:%M:%S", &time))
- str[0] = '\0';
+ (*str)[0] = '\0';
return 0;
}
Shouldn't the compiler complain about something like this?
In fact, this prompted me to do a little test:
int main() {
char *bar = "temp";
char **foo = &bar;
foo[0] = '\0';
return 0;
}
"gcc -Wall -pedantic temp.c" gives no complaints, but clang has this to
say:
$ clang-3.5 -Wall -pedantic temp.c
temp.c:4:11: warning: expression which evaluates to zero treated as
a null
pointer constant of type 'char *'
[-Wnon-literal-null-conversion]
foo[0] = '\0';
^~~~
1 warning generated.
Actually, yes, clang did complain about this already - that's why I found
it. (I'm not sure if the clang warning was present when I introduced the
bug though, or if I just happened to overlook it at the time.)
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel