From 2c2fe2504a443100119314eac6b254233c1a6240 Mon Sep 17 00:00:00 2001 From: Arnaud Blanchard <arnaud.blanchard@ensea.fr> Date: Thu, 3 Jun 2021 15:21:02 +0200 Subject: [PATCH] modernise to C++14 --- include/blc_channel.h | 12 ++--- include/blc_mem.h | 10 ++-- src/channel/blc_channel.cpp | 92 ++++++++++++++++++------------------- 3 files changed, 55 insertions(+), 59 deletions(-) diff --git a/include/blc_channel.h b/include/blc_channel.h index 938c623..8143f34 100644 --- a/include/blc_channel.h +++ b/include/blc_channel.h @@ -7,12 +7,12 @@ This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - Â users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. - Â In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, - Â that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. + users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. + In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured - Â and, more generally, to use and operate it in the same conditions as regards security. - Â The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. */ + and, more generally, to use and operate it in the same conditions as regards security. + The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. */ @@ -127,7 +127,7 @@ typedef struct blc_channel You can use conflict function to check before if there is incompatibility. Return 1 if it has been created*/ int create_or_open(char const *new_name, int mode); - int create_or_open(char const *new_name, int mode, uint32_t type, uint32_t format, std::vector<size_t>lengths); + int create_or_open(char const *new_name, int mode, uint32_t type, uint32_t format, std::vector<size_t> const &lengths); int create_or_open(char const *new_name, int mode, uint32_t type, uint32_t format, int dims_nb, blc_dim const *dims); int create_or_open(char const *new_name, int mode, uint32_t type, uint32_t format, char const *size_string); diff --git a/include/blc_mem.h b/include/blc_mem.h index 95f1ed1..a0d65df 100644 --- a/include/blc_mem.h +++ b/include/blc_mem.h @@ -7,12 +7,12 @@ This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - Â users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. - Â In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, - Â that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. + users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. + In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured - Â and, more generally, to use and operate it in the same conditions as regards security. - Â The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. */ + and, more generally, to use and operate it in the same conditions as regards security. + The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. */ diff --git a/src/channel/blc_channel.cpp b/src/channel/blc_channel.cpp index 9bb8e15..6509f60 100644 --- a/src/channel/blc_channel.cpp +++ b/src/channel/blc_channel.cpp @@ -7,12 +7,12 @@ This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, - Â users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. - Â In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, - Â that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. + users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. + In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured - Â and, more generally, to use and operate it in the same conditions as regards security. - Â The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. * + and, more generally, to use and operate it in the same conditions as regards security. + The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. * Created on: Oct 9, 2014 @@ -210,9 +210,9 @@ void blc_channel::map_memory(int access_mode){ this->access_mode=access_mode; switch (access_mode & O_ACCMODE){ - case O_RDONLY:prot=PROT_READ;break; - case O_RDWR:prot=PROT_WRITE | PROT_READ; break; - default: EXIT_ON_CHANNEL_ERROR(this, "Unknown mode '%d'.", access_mode); + case O_RDONLY:prot=PROT_READ;break; + case O_RDWR:prot=PROT_WRITE | PROT_READ; break; + default: EXIT_ON_CHANNEL_ERROR(this, "Unknown mode '%d'.", access_mode); } SYSTEM_ERROR_CHECK(data = mmap(0, size, prot, MAP_SHARED, fd, 0), MAP_FAILED, "Mapping memory of %s (size %ld bytes), fd(%d), prot(%d).", name, size, fd, prot); @@ -241,20 +241,20 @@ void blc_channel::create(int access_mode){ strcpy(parameter, "NDEF"); switch (name[0]){ - case '/': - break; - case '.': - sync_new_data=1; - break; - case '^': - sync_ack_data=1; - break; - case ':': - sync_new_data=1; - sync_ack_data=1; - break; - default:EXIT_ON_ERROR("Blc channel names must start with '/' for asynchrone mode or with '.',';',':' for synchrone mode. But it is '%s'", name); - break; + case '/': + break; + case '.': + sync_new_data=1; + break; + case '^': + sync_ack_data=1; + break; + case ':': + sync_new_data=1; + sync_ack_data=1; + break; + default:EXIT_ON_ERROR("Blc channel names must start with '/' for asynchrone mode or with '.',';',':' for synchrone mode. But it is '%s'", name); + break; } name[0]='/'; //In any case the name start with '/' @@ -374,20 +374,20 @@ void blc_channel::open(int access_mode){ int sync_new_data=0, sync_ack_data=0; switch (name[0]){ - case '/': - break; - case '.': - sync_new_data=1; - break; - case '^': - sync_ack_data=1; - break; - case ':': - sync_new_data=1; - sync_ack_data=1; - break; - default:EXIT_ON_ERROR("Blc channel names must start with '/' for asynchrone mode or with '.','^',':' for synchrone mode. But it is '%s'", this->name); - break; + case '/': + break; + case '.': + sync_new_data=1; + break; + case '^': + sync_ack_data=1; + break; + case ':': + sync_new_data=1; + sync_ack_data=1; + break; + default:EXIT_ON_ERROR("Blc channel names must start with '/' for asynchrone mode or with '.','^',':' for synchrone mode. But it is '%s'", this->name); + break; } this->name[0]='/'; //In any case the nale start with '/' id = blc_channel_get_info_with_name(this, name); @@ -453,18 +453,14 @@ int blc_channel::create_or_open(char const *new_name, int access_mode, uint32_t } ///Create a blc channel -/*int blc_channel::create_or_open(char const *new_name, int access_mode, uint32_t type, uint32_t format, vector<size_t> lengths){ - int dims_nb; - blc_dim dims[BLC_ARRAY_DIMS_MAX]; - - size_t size= - dims_nb = lengths.size(); - for (int i; i!=dims_nb; i++) { - dims[i].step=; - dims[i].length=lengths[i]; - } - return create_or_open(new_name, access_mode, type, format, dims_nb, dims); - }*/ +int blc_channel::create_or_open(char const *new_name, int access_mode, uint32_t type, uint32_t format, vector<size_t> const &lengths){ + int dims_nb = lengths.size(); + blc_dim dims[BLC_ARRAY_DIMS_MAX]; + for (int i; i!=dims_nb; i++) { + dims[i].length=lengths[i]; + } + return create_or_open(new_name, access_mode, type, format, dims_nb, dims); +} int blc_channel::create_or_open(char const *new_name, int mode, uint32_t type, uint32_t format, char const *dims_string){ int created=1; -- GitLab