commit
9cad8cea82
@ -1803,8 +1803,7 @@ int renameFile(std::string& newPath, const struct tm* tm) {
|
||||
replace(format, ":parentname:", p.parent_path().parent_path().filename().string());
|
||||
|
||||
const size_t max = 1024;
|
||||
char basename[max];
|
||||
std::memset(basename, 0x0, max);
|
||||
char basename[max] = {};
|
||||
if (strftime(basename, max, format.c_str(), tm) == 0) {
|
||||
std::cerr << _("Filename format yields empty filename for the file") << " " << path << "\n";
|
||||
return 1;
|
||||
|
||||
@ -214,8 +214,7 @@ void fileSystemPush(const char* path, Jzon::Node& nfs) {
|
||||
fs.Add("path", path);
|
||||
fs.Add("realpath", std::filesystem::absolute(std::filesystem::path(path)).string());
|
||||
|
||||
struct stat buf;
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
struct stat buf = {};
|
||||
stat(path, &buf);
|
||||
|
||||
fs.Add("st_dev", static_cast<int>(buf.st_dev)); /* ID of device containing file */
|
||||
|
||||
@ -366,8 +366,7 @@ time_t parseTime(const char* arg, bool bAdjust) {
|
||||
char a = 0, b = 0, c = 0, d = 0, e = 0;
|
||||
sscanf(arg, "%d%c%d%c%d%c%d%c%d%c%d", &YY, &a, &MM, &b, &DD, &c, &HH, &d, &mm, &e, &SS1);
|
||||
|
||||
struct tm T;
|
||||
memset(&T, 0, sizeof(T));
|
||||
struct tm T = {};
|
||||
T.tm_min = mm;
|
||||
T.tm_hour = HH;
|
||||
T.tm_sec = SS1;
|
||||
@ -720,8 +719,7 @@ int main(int argc, const char* argv[]) {
|
||||
types[typeCode] = "code";
|
||||
types[typeFile] = "file";
|
||||
|
||||
char const* keywords[kwMAX];
|
||||
memset(keywords, 0, sizeof(keywords));
|
||||
char const* keywords[kwMAX] = {};
|
||||
keywords[kwHELP] = "help";
|
||||
keywords[kwVERSION] = "version";
|
||||
keywords[kwVERBOSE] = "verbose";
|
||||
|
||||
@ -949,8 +949,7 @@ void CrwMap::encode0x180e(const Image& image, const CrwMapping* pCrwMapping, Cif
|
||||
const ExifKey key(pCrwMapping->tag_, Internal::groupName(pCrwMapping->ifdId_));
|
||||
const auto ed = image.exifData().findKey(key);
|
||||
if (ed != image.exifData().end()) {
|
||||
struct tm tm;
|
||||
std::memset(&tm, 0x0, sizeof(tm));
|
||||
struct tm tm = {};
|
||||
if (exifTime(ed->toString().c_str(), &tm) == 0) {
|
||||
t = ::mktime(&tm);
|
||||
}
|
||||
|
||||
@ -228,12 +228,10 @@ std::string strError() {
|
||||
const size_t n = 1024;
|
||||
#ifdef EXV_STRERROR_R_CHAR_P
|
||||
char* buf = nullptr;
|
||||
char buf2[n];
|
||||
std::memset(buf2, 0x0, n);
|
||||
char buf2[n] = {};
|
||||
buf = strerror_r(error, buf2, n);
|
||||
#else
|
||||
char buf[n];
|
||||
std::memset(buf, 0x0, n);
|
||||
char buf[n] = {};
|
||||
const int ret = strerror_r(error, buf, n);
|
||||
enforce(ret != ERANGE, Exiv2::ErrorCode::kerCallFailed);
|
||||
#endif
|
||||
|
||||
@ -90,8 +90,7 @@ static int forgive(int n, int& err) {
|
||||
|
||||
static int error(std::string& errors, const char* msg, const char* x = nullptr, const char* y = nullptr, int z = 0) {
|
||||
static const size_t buffer_size = 512;
|
||||
char buffer[buffer_size];
|
||||
memset(buffer, 0, buffer_size);
|
||||
char buffer[buffer_size] = {};
|
||||
snprintf(buffer, buffer_size, msg, x, y, z);
|
||||
if (errno) {
|
||||
perror(buffer);
|
||||
@ -210,9 +209,8 @@ int Exiv2::http(Exiv2::Dictionary& request, Exiv2::Dictionary& response, std::st
|
||||
int server = -1;
|
||||
|
||||
// fill in the address
|
||||
struct sockaddr_in serv_addr;
|
||||
struct sockaddr_in serv_addr = {};
|
||||
int serv_len = sizeof(serv_addr);
|
||||
memset(reinterpret_cast<char*>(&serv_addr), 0, serv_len);
|
||||
|
||||
serv_addr.sin_addr.s_addr = inet_addr(servername_p);
|
||||
serv_addr.sin_family = AF_INET;
|
||||
|
||||
@ -876,8 +876,7 @@ std::ostream& DateValue::write(std::ostream& os) const {
|
||||
int64_t DateValue::toInt64(size_t /*n*/) const {
|
||||
// Range of tm struct is limited to about 1970 to 2038
|
||||
// This will return -1 if outside that range
|
||||
std::tm tms;
|
||||
std::memset(&tms, 0, sizeof(tms));
|
||||
std::tm tms = {};
|
||||
tms.tm_mday = date_.day;
|
||||
tms.tm_mon = date_.month - 1;
|
||||
tms.tm_year = date_.year - 1900;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user