fix Coverity issues

This commit is contained in:
wmayer 2016-09-03 14:51:28 +02:00
parent 9ed53fea38
commit 3c88edd007
4 changed files with 17 additions and 15 deletions

View File

@ -507,7 +507,7 @@ public:
std::string string;
FunctionExpression::Function func;
ObjectIdentifier::String string_or_identifier;
semantic_type() {}
semantic_type() : expr(0), ivalue(0), fvalue(0), func(FunctionExpression::NONE) {}
};
#define YYSTYPE semantic_type

View File

@ -169,31 +169,31 @@ std::string FileInfo::getTempFileName(const char* FileName, const char* Path)
return std::string(ConvertFromWideString(std::wstring(buf)));
#else
char buf[PATH_MAX+1];
std::string buf;
// Path where the file is located
if (Path)
std::strncpy(buf, Path, PATH_MAX);
buf = Path;
else
std::strncpy(buf, getTempPath().c_str(), PATH_MAX);
buf[PATH_MAX] = 0; // null termination needed
buf = getTempPath();
// File name in the path
if (FileName) {
std::strcat(buf, "/");
std::strcat(buf, FileName);
std::strcat(buf, "XXXXXX");
buf += "/";
buf += FileName;
buf += "XXXXXX";
}
else {
buf += "/fileXXXXXX";
}
else
std::strcat(buf, "/fileXXXXXX");
int id = mkstemp(buf);
int id = mkstemp(static_cast<char*>(buf.c_str());
if (id > -1) {
FILE* file = fdopen(id, "w");
fclose(file);
unlink(buf.c_str());
}
return std::string(buf);
return buf;
#endif
}

View File

@ -40,8 +40,10 @@ PP_Run_Method(PyObject *pobject, const char *method,
Py_Initialize(); /* init if first time */
pmeth = PyObject_GetAttrString(pobject, method);
if (pmeth == NULL) /* get callable object */
if (pmeth == NULL) { /* get callable object */
va_end(argslist);
return -1; /* bound method? has self */
}
/* handle zero args different */
// if(resfmt == 0 || strcmp(resfmt,"") == 0)
// pargs = Py_BuildValue("()");

View File

@ -65,7 +65,7 @@ private:
int flush_buffer();
public:
gzstreambuf() : opened(0) {
gzstreambuf() : file(0), opened(0), mode(0) {
setp( buffer, buffer + (bufferSize-1));
setg( buffer + 4, // beginning of putback area
buffer + 4, // read position