comparison base/Debug.cpp @ 986:e8e6c4e7437b

Correct some really stupid fixed-length string stuff, including a genuine stack overflow that causes a crash on OS/X for certain colour 3d plot data.
author Chris Cannam
date Mon, 29 Sep 2014 13:27:13 +0100
parents d002827b5896
children c49d52386cde
comparison
equal deleted inserted replaced
985:f073d924a7c3 986:e8e6c4e7437b
41 41
42 QString pfx = ResourceFinder().getUserResourcePrefix(); 42 QString pfx = ResourceFinder().getUserResourcePrefix();
43 QDir logdir(QString("%1/%2").arg(pfx).arg("log")); 43 QDir logdir(QString("%1/%2").arg(pfx).arg("log"));
44 44
45 if (!prefix) { 45 if (!prefix) {
46 prefix = new char[20]; 46 prefix = strdup(QString("[%1]")
47 sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); 47 .arg(QCoreApplication::applicationPid())
48 .toLatin1().data());
48 //!!! what to do if mkpath fails? 49 //!!! what to do if mkpath fails?
49 if (!logdir.exists()) logdir.mkpath(logdir.path()); 50 if (!logdir.exists()) logdir.mkpath(logdir.path());
50 } 51 }
51 52
52 if (!debugs.hasLocalData()) { 53 if (!debugs.hasLocalData()) {