]> git.tdb.fi Git - libs/core.git/commitdiff
Variable length arrays on stack are not valid C++
authorMikko Rasa <tdb@tdb.fi>
Mon, 16 Jul 2012 23:24:52 +0000 (02:24 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 16 Jul 2012 23:24:52 +0000 (02:24 +0300)
source/time/timezone.cpp

index a755954b43628c9f66fb407f46b527fb7a54314f..a2cd7a3f772743c7fe9ac06fde3042fd6ab28d98 100644 (file)
@@ -61,7 +61,7 @@ TimeZone get_local_timezone()
                        long typecnt = get_long(ptr);
                        long charcnt = get_long(ptr);
                        int size = timecnt*5+typecnt*6+isgmtcnt+isstdcnt+leapcnt*8+charcnt;
                        long typecnt = get_long(ptr);
                        long charcnt = get_long(ptr);
                        int size = timecnt*5+typecnt*6+isgmtcnt+isstdcnt+leapcnt*8+charcnt;
-                       char buf[size];
+                       char *buf = new char[size];
                        len = read(fd, buf, size);
                        if(len==size)
                        {
                        len = read(fd, buf, size);
                        if(len==size)
                        {
@@ -91,6 +91,7 @@ TimeZone get_local_timezone()
 
                                name = ptr+abbrind;
                        }
 
                                name = ptr+abbrind;
                        }
+                       delete[] buf;
                }
                close(fd);
 
                }
                close(fd);