diff --git a/src/fileutils.cpp b/src/fileutils.cpp index 66eb87106c43aa0f9420ebeb10db43e0a7938121..f9e25a3decfa30f319628b98446b579364eff6d1 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -1,7 +1,5 @@ /* * Copyright (C) 2004-2020 Savoir-faire Linux Inc. - * Copyright (C) 2010 Michael Kerrisk - * Copyright (C) 2007-2009 Rémi Denis-Courmont * * Author: Rafaël Carré <rafael.carre@savoirfairelinux.com> * @@ -131,73 +129,6 @@ check_dir(const char* path, mode_t UNUSED dirmode, mode_t parentmode) return true; } -#ifndef _WIN32 -/* Lock a file region */ -static int -lockReg(int fd, int cmd, int type, int whence, int start, off_t len) -{ - struct flock fl; - - fl.l_type = type; - fl.l_whence = whence; - fl.l_start = start; - fl.l_len = len; - - return fcntl(fd, cmd, &fl); -} - -static int /* Lock a file region using nonblocking F_SETLK */ -lockRegion(int fd, int type, int whence, int start, int len) -{ - return lockReg(fd, F_SETLK, type, whence, start, len); -} - -FileHandle -create_pidfile() -{ - const std::string name(get_home_dir() + DIR_SEPARATOR_STR PIDFILE); - FileHandle f(name); - char buf[100]; - f.fd = open(f.name.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (f.fd == -1) { - JAMI_ERR("Could not open PID file %s", f.name.c_str()); - return f; - } - - if (lockRegion(f.fd, F_WRLCK, SEEK_SET, 0, 0) == -1) { - if (errno == EAGAIN or errno == EACCES) - JAMI_ERR("PID file '%s' is locked; probably " - "'%s' is already running", - f.name.c_str(), - PACKAGE_NAME); - else - JAMI_ERR("Unable to lock PID file '%s'", f.name.c_str()); - close(f.fd); - f.fd = -1; - return f; - } - - if (ftruncate(f.fd, 0) == -1) { - JAMI_ERR("Could not truncate PID file '%s'", f.name.c_str()); - close(f.fd); - f.fd = -1; - return f; - } - - snprintf(buf, sizeof(buf), "%ld\n", (long) getpid()); - - const int buf_strlen = strlen(buf); - if (write(f.fd, buf, buf_strlen) != buf_strlen) { - JAMI_ERR("Problem writing to PID file '%s'", f.name.c_str()); - close(f.fd); - f.fd = -1; - return f; - } - - return f; -} -#endif // !_WIN32 - std::string expand_path(const std::string& path) { @@ -572,21 +503,6 @@ writeArchive(const std::string& archive_str, const std::string& path, const std: } } -FileHandle::FileHandle(const std::string& n) - : fd(-1) - , name(n) -{} - -FileHandle::~FileHandle() -{ - // we will only delete the file if it was created by this process - if (fd != -1) { - close(fd); - if (unlink(name.c_str()) == -1) - JAMI_ERR("%s", strerror(errno)); - } -} - #if defined(__ANDROID__) || defined(RING_UWP) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS) #else static char* program_dir = NULL; diff --git a/src/fileutils.h b/src/fileutils.h index 5506135e06dfd4182bc13018853077ebb5c4422a..28c68eb08b5274f08c4cf1b232a92d12930d5f4b 100644 --- a/src/fileutils.h +++ b/src/fileutils.h @@ -117,15 +117,6 @@ void writeArchive(const std::string& data, std::mutex& getFileLock(const std::string& path); -struct FileHandle -{ - int fd; - const std::string name; - FileHandle(const std::string& name); - ~FileHandle(); -}; -FileHandle create_pidfile(); - /** * Remove a file with optional erasing of content. * Return the same value as std::remove(). diff --git a/src/media/audio/sound/dtmf.cpp b/src/media/audio/sound/dtmf.cpp index 6a7d538970d063584596fe43ac19bfe7ca20eb74..83f999b0d0051cc315c845d092e496b83a34bc7a 100644 --- a/src/media/audio/sound/dtmf.cpp +++ b/src/media/audio/sound/dtmf.cpp @@ -4,9 +4,6 @@ * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -38,10 +35,8 @@ DTMF::startTone(char code) newTone_ = code; } -using std::vector; - bool -DTMF::generateDTMF(vector<AudioSample>& buffer) +DTMF::generateDTMF(std::vector<AudioSample>& buffer) { try { if (currentTone_ != 0) { diff --git a/src/media/audio/sound/dtmf.h b/src/media/audio/sound/dtmf.h index 44abf0d2d92bb757b270b075a49370b4fef5ebb4..17fde87c9dd92d5de7235fe691581a158b539706 100644 --- a/src/media/audio/sound/dtmf.h +++ b/src/media/audio/sound/dtmf.h @@ -4,9 +4,6 @@ * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -22,8 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __DTMF_H_ -#define __DTMF_H_ +#pragma once #include "dtmfgenerator.h" @@ -31,7 +27,6 @@ * @file dtmf.h * @brief DMTF library to generate a dtmf sample */ - namespace jami { class DTMF @@ -63,5 +58,3 @@ private: }; } // namespace jami - -#endif // __KEY_DTMF_H_ diff --git a/src/media/audio/sound/dtmfgenerator.cpp b/src/media/audio/sound/dtmfgenerator.cpp index 23a936cf652285a353e9ae71f40b0f603ac9e60a..f2737294764b3b6d86f29dd6b8dca610982fcf11 100644 --- a/src/media/audio/sound/dtmfgenerator.cpp +++ b/src/media/audio/sound/dtmfgenerator.cpp @@ -4,8 +4,6 @@ * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * - * Portions (c) 2003 iptel.org - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or diff --git a/src/media/socket_pair.cpp b/src/media/socket_pair.cpp index 2847ae0cedbbeb1ea3d815be3807d30002e11fe9..953391778ce3c24a8712ea544a1da24a74d488a7 100644 --- a/src/media/socket_pair.cpp +++ b/src/media/socket_pair.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004-2020 Savoir-faire Linux Inc. - * Copyright (c) 2002 Fabrice Bellard + * Copyright (c) 2007 The FFmpeg Project * * Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com> * Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>