Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package bctoolbox for openSUSE:Factory 
checked in at 2021-07-18 23:44:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bctoolbox (Old)
 and      /work/SRC/openSUSE:Factory/.bctoolbox.new.2632 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bctoolbox"

Sun Jul 18 23:44:56 2021 rev:23 rq:906257 version:5.0.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/bctoolbox/bctoolbox.changes      2021-06-25 
15:01:08.464137168 +0200
+++ /work/SRC/openSUSE:Factory/.bctoolbox.new.2632/bctoolbox.changes    
2021-07-18 23:45:06.830970039 +0200
@@ -1,0 +2,7 @@
+Wed Jul 14 08:32:33 UTC 2021 - Paolo Stivanin <i...@paolostivanin.com>
+
+- Update to 5.0.0:
+  * Tester API: add API to set maximum number of failed tests.
+  * Few bugfixes
+
+-------------------------------------------------------------------

Old:
----
  bctoolbox-4.5.20.tar.gz

New:
----
  bctoolbox-5.0.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bctoolbox.spec ++++++
--- /var/tmp/diff_new_pack.q2dt7D/_old  2021-07-18 23:45:07.390965732 +0200
+++ /var/tmp/diff_new_pack.q2dt7D/_new  2021-07-18 23:45:07.394965700 +0200
@@ -18,7 +18,7 @@
 
 %define sover   1
 Name:           bctoolbox
-Version:        4.5.20
+Version:        5.0.0
 Release:        0
 Summary:        Utility library for software from Belledonne Communications
 License:        GPL-2.0-or-later

++++++ bctoolbox-4.5.20.tar.gz -> bctoolbox-5.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/CMakeLists.txt 
new/bctoolbox-5.0.0/CMakeLists.txt
--- old/bctoolbox-4.5.20/CMakeLists.txt 2021-06-10 14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/CMakeLists.txt  2021-07-07 13:05:29.000000000 +0200
@@ -23,7 +23,7 @@
 cmake_minimum_required(VERSION 3.2)
 set(CMAKE_MACOSX_RPATH ON) # Before cmake 3.0.0, MACOSX_RPATH was not set to 
ON by default - however this is no good reason to not enable it by default
 
-project(bctoolbox VERSION 4.5.0)
+project(bctoolbox VERSION 5.0.0)
 
 set(BCTOOLBOX_VERSION "${PROJECT_VERSION}")
 set(BCTOOLBOX_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/cmake/BcToolboxCMakeUtils.cmake 
new/bctoolbox-5.0.0/cmake/BcToolboxCMakeUtils.cmake
--- old/bctoolbox-4.5.20/cmake/BcToolboxCMakeUtils.cmake        2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/cmake/BcToolboxCMakeUtils.cmake 2021-07-07 
13:05:29.000000000 +0200
@@ -202,7 +202,28 @@
                        endif()
                endif()
 
-               set(${OUTPUT_VERSION} "${full_version}" CACHE STRING "" FORCE)
+               set(${OUTPUT_VERSION} "${full_version}" PARENT_SCOPE)
+       endif()
+endfunction()
+
+function(bc_compute_snapshots_or_releases_state OUTPUT_VERSION)
+       find_program(GIT_EXECUTABLE git NAMES Git CMAKE_FIND_ROOT_PATH_BOTH)
+       if(GIT_EXECUTABLE)
+               execute_process(
+                       COMMAND "${GIT_EXECUTABLE}" "describe"
+                       OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
+                       OUTPUT_STRIP_TRAILING_WHITESPACE
+                       ERROR_QUIET
+                       WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+               )
+
+               # Check git describe to see if we are on a release or not
+               set(snapshots_or_releases_state "snapshots")
+               if(NOT GIT_DESC MATCHES ".*(alpha|beta).*")
+                       set(snapshots_or_release_state "releases")
+               endif()
+
+               set(${OUTPUT_VERSION} "${snapshots_or_releases_state}" 
PARENT_SCOPE)
        endif()
 endfunction()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/include/CMakeLists.txt 
new/bctoolbox-5.0.0/include/CMakeLists.txt
--- old/bctoolbox-4.5.20/include/CMakeLists.txt 2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/include/CMakeLists.txt  2021-07-07 13:05:29.000000000 
+0200
@@ -25,6 +25,7 @@
        compiler.h
        defs.h
        exception.hh
+       utils.hh
        list.h
        logging.h
        map.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/include/bctoolbox/charconv.h 
new/bctoolbox-5.0.0/include/bctoolbox/charconv.h
--- old/bctoolbox-4.5.20/include/bctoolbox/charconv.h   2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/include/bctoolbox/charconv.h    2021-07-07 
13:05:29.000000000 +0200
@@ -74,6 +74,16 @@
  */
 BCTBX_PUBLIC char *bctbx_convert_any_to_utf8 (const char *str, const char 
*encoding);
 
+/**
+ * @brief Convert the char string to wide char string. Only available for 
Windows platform
+ *
+ * @param[in] str string to convert
+ *
+ * @return a pointer to a null-terminated string containing the converted 
string. This buffer must then be freed
+ * by caller. NULL on failure.
+ */
+BCTBX_PUBLIC wchar_t* bctbx_string_to_wide_string(const char* s);
+
 #ifdef __cplusplus
 }
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/include/bctoolbox/port.h 
new/bctoolbox-5.0.0/include/bctoolbox/port.h
--- old/bctoolbox-4.5.20/include/bctoolbox/port.h       2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/include/bctoolbox/port.h        2021-07-07 
13:05:29.000000000 +0200
@@ -141,13 +141,107 @@
 #if defined(__MINGW32__) || !defined(WINAPI_FAMILY_PARTITION) || 
!defined(WINAPI_PARTITION_DESKTOP)
 #define BCTBX_WINDOWS_DESKTOP 1
 #elif defined(WINAPI_FAMILY_PARTITION)
+//WINAPI_PARTITION_PC_APP => UWP
+//WINAPI_PARTITION_DESKTOP => Win32 Only
+//WINAPI_PARTITION_PHONE_APP => Windows Phone Store
+//WINAPI_PARTITION_APP => UWP+Windows Phone Store
+// On UWP, we have : 1001
+// On Desktop : we have : 1101
+// Uncomment line below to check combination
+//#define BCTBX_CHECK_FAMILY
+#ifdef BCTBX_CHECK_FAMILY
+        #if defined (WINAPI_PARTITION_PC_APP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP)
+        #define FAMILY1
+        #endif
+        #if defined (WINAPI_PARTITION_DESKTOP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+        #define FAMILY2
+        #endif
+        #if defined (WINAPI_PARTITION_PHONE_APP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
+        #define FAMILY3
+        #endif
+        #if defined (WINAPI_PARTITION_APP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+        #define FAMILY4
+        #endif
+
+        #ifdef FAMILY1
+                #ifdef FAMILY2
+                        #ifdef FAMILY3
+                                #ifdef FAMILY4
+                                        #error 1111
+                                #else
+                                        #error 1110
+                                #endif
+                        #else
+                                #ifdef FAMILY4
+                                        #error 1101
+                                #else
+                                        #error 1100
+                                #endif
+
+                        #endif
+                #else
+                        #ifdef FAMILY3
+                                #ifdef FAMILY4
+                                        #error 1011
+                                #else
+                                        #error 1010
+                                #endif
+                        #else
+                                #ifdef FAMILY4
+                                        #error 1001
+                                #else
+                                        #error 1000
+                                #endif
+
+                        #endif
+                #endif
+        #else
+                #ifdef FAMILY2
+                        #ifdef FAMILY3
+                                #ifdef FAMILY4
+                                        #error 0111
+                                #else
+                                        #error 0110
+                                #endif
+                        #else
+                                #ifdef FAMILY4
+                                        #error 0101
+                                #else
+                                        #error 0100
+                                #endif
+
+                        #endif
+                #else
+                        #ifdef FAMILY3
+                                #ifdef FAMILY4
+                                        #error 0011
+                                #else
+                                        #error 0010
+                                #endif
+                        #else
+                                #ifdef FAMILY4
+                                        #error 0001
+                                #else
+                                        #error 0000
+                                #endif
+
+                        #endif
+                #endif
+        #endif
+#endif
+
 #if defined(WINAPI_PARTITION_DESKTOP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 #define BCTBX_WINDOWS_DESKTOP 1
+#elif defined (WINAPI_PARTITION_PC_APP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP)
+#define BCTBX_WINDOWS_DESKTOP 1
+#define BCTBX_WINDOWS_UWP 1
 #elif defined(WINAPI_PARTITION_PHONE_APP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
 #define BCTBX_WINDOWS_PHONE 1
 #elif defined(WINAPI_PARTITION_APP) && 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
 #define BCTBX_WINDOWS_UNIVERSAL 1
 #endif
+
+
 #endif
 
 #ifndef BCTBX_DEPRECATED
@@ -657,7 +751,7 @@
  *
  * Note : there is no check on the length or validity as an hexa string on the 
input, incorrect byte is silently mapped to 0
  */
-BCTBX_PUBLIC uint32_t bctbx_str_to_uint32(const uint8_t input_string[9]);
+BCTBX_PUBLIC uint32_t bctbx_str_to_uint32(const uint8_t *input_string);
 
 /**
  * @brief Convert an unsigned 64 bits integer into the corresponding 
hexadecimal string(including null termination character)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/include/bctoolbox/tester.h 
new/bctoolbox-5.0.0/include/bctoolbox/tester.h
--- old/bctoolbox-4.5.20/include/bctoolbox/tester.h     2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/include/bctoolbox/tester.h      2021-07-07 
13:05:29.000000000 +0200
@@ -79,6 +79,8 @@
 BCTBX_PUBLIC int bc_tester_register_suite_by_name(const char *suite_name);
 BCTBX_PUBLIC void bc_tester_add_suite(test_suite_t *suite);
 BCTBX_PUBLIC void bc_tester_set_max_parallel_suites(int max_parallel_suites);
+BCTBX_PUBLIC void bc_tester_set_max_failed_tests_threshold(int 
max_failed_tests_threshold);
+BCTBX_PUBLIC void bc_tester_set_global_timeout(int seconds);
 BCTBX_PUBLIC void bc_tester_uninit(void);
 BCTBX_PUBLIC void bc_tester_printf(int level, const char *fmt, ...);
 BCTBX_PUBLIC const char * bc_tester_get_resource_dir_prefix(void);
@@ -89,6 +91,8 @@
 BCTBX_PUBLIC void bc_tester_set_silent_func(int (*func)(const char*));
 BCTBX_PUBLIC void bc_tester_set_verbose_func(int (*func)(const char*));
 BCTBX_PUBLIC void bc_tester_set_logfile_func(int (*func)(const char*));
+BCTBX_PUBLIC void bc_tester_set_process_events_func(void (*func)(void));
+BCTBX_PUBLIC void bc_tester_process_events(void);
 
 BCTBX_PUBLIC int bc_tester_nb_suites(void);
 BCTBX_PUBLIC int bc_tester_nb_tests(const char* name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/include/bctoolbox/utils.hh 
new/bctoolbox-5.0.0/include/bctoolbox/utils.hh
--- old/bctoolbox-4.5.20/include/bctoolbox/utils.hh     1970-01-01 
01:00:00.000000000 +0100
+++ new/bctoolbox-5.0.0/include/bctoolbox/utils.hh      2021-07-07 
13:05:29.000000000 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016-2021 Belledonne Communications SARL.
+ *
+ * This file is part of bctoolbox.
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BCTBX_UTILS_H
+#define BCTBX_UTILS_H
+
+#include <string>
+#include <vector>
+
+#include "bctoolbox/port.h"
+
+namespace bctoolbox {
+
+       namespace Utils {
+               BCTBX_PUBLIC std::vector<std::string> split (const std::string 
&str, const std::string &delimiter);
+
+               BCTBX_PUBLIC inline std::vector<std::string> split (const 
std::string &str, char delimiter) {
+                       return split(str, std::string(1, delimiter));
+               }
+
+               template<typename T>
+               inline const T &getEmptyConstRefObject () {
+                       static const T object{};
+                       return object; 
+               }
+
+       }
+
+}
+
+#endif /* BCTBX_UTILS_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/CMakeLists.txt 
new/bctoolbox-5.0.0/src/CMakeLists.txt
--- old/bctoolbox-4.5.20/src/CMakeLists.txt     2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/src/CMakeLists.txt      2021-07-07 13:05:29.000000000 
+0200
@@ -36,6 +36,7 @@
        conversion/charconv_encoding.cc
        utils/exception.cc
        utils/regex.cc
+       utils/utils.cc
 )
 
 set(BCTOOLBOX_PRIVATE_HEADER_FILES
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/conversion/charconv.cc 
new/bctoolbox-5.0.0/src/conversion/charconv.cc
--- old/bctoolbox-4.5.20/src/conversion/charconv.cc     2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/src/conversion/charconv.cc      2021-07-07 
13:05:29.000000000 +0200
@@ -109,3 +109,9 @@
 char *bctbx_convert_any_to_utf8 (const char *str, const char *encoding) {
        return convert_from_to(str, encoding, "UTF-8");
 }
+
+wchar_t* bctbx_string_to_wide_string(const char* str){
+// TODO        
+       bctbx_error("Conversion from string to wide string is not implemented");
+    return NULL;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/conversion/charconv_android.cc 
new/bctoolbox-5.0.0/src/conversion/charconv_android.cc
--- old/bctoolbox-4.5.20/src/conversion/charconv_android.cc     2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/src/conversion/charconv_android.cc      2021-07-07 
13:05:29.000000000 +0200
@@ -42,3 +42,9 @@
        // TODO change this part when the NDK will contain a usable iconv
        return bctbx_strdup(str);
 }
+
+wchar_t* bctbx_string_to_wide_string(const char* str){
+// TODO        
+       bctbx_error("Conversion from string to wide string is not implemented");
+    return NULL;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/conversion/charconv_windows.cc 
new/bctoolbox-5.0.0/src/conversion/charconv_windows.cc
--- old/bctoolbox-4.5.20/src/conversion/charconv_windows.cc     2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/src/conversion/charconv_windows.cc      2021-07-07 
13:05:29.000000000 +0200
@@ -179,3 +179,13 @@
 char *bctbx_convert_any_to_utf8 (const char *str, const char *encoding) {
        return convertFromTo(str, encoding, "UTF-8");
 }
+
+wchar_t* bctbx_string_to_wide_string(const char* str){
+       std::string s(str);
+       int len;
+       int slength = (int)s.length() + 1;
+       len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
+       wchar_t* buf = (wchar_t *) bctbx_malloc(len*sizeof(wchar_t));
+       MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
+       return buf;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/crypto/mbedtls.c 
new/bctoolbox-5.0.0/src/crypto/mbedtls.c
--- old/bctoolbox-4.5.20/src/crypto/mbedtls.c   2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/src/crypto/mbedtls.c    2021-07-07 13:05:29.000000000 
+0200
@@ -236,7 +236,7 @@
                if( mbedtls_cert->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME 
) {
                        const mbedtls_x509_sequence *cur = 
&(mbedtls_cert->subject_alt_names);
                        while (cur != NULL) {
-                               ret = bctbx_list_append(ret, 
bctbx_strndup((const char*)cur->buf.p, cur->buf.len));
+                               ret = bctbx_list_append(ret, 
bctbx_strndup((const char*)cur->buf.p, (int)cur->buf.len));
                                cur = cur->next;
                        }
                }
@@ -245,7 +245,7 @@
                const mbedtls_x509_name *subject = &(mbedtls_cert->subject);
                while (subject != NULL) { // Certificate should hold only one 
CN, but be permissive and parse several if they are in the certificate
                        if( MBEDTLS_OID_CMP( MBEDTLS_OID_AT_CN, &subject->oid ) 
== 0 ) { // subject holds all the distinguished name in asn1 format, get the CN 
only
-                               ret = bctbx_list_append(ret, 
bctbx_strndup((const char*)subject->val.p, subject->val.len));
+                               ret = bctbx_list_append(ret, 
bctbx_strndup((const char*)subject->val.p, (int)subject->val.len));
                        }
                        subject = subject->next;
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/crypto/mbedtls.cc 
new/bctoolbox-5.0.0/src/crypto/mbedtls.cc
--- old/bctoolbox-4.5.20/src/crypto/mbedtls.cc  2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/src/crypto/mbedtls.cc   2021-07-07 13:05:29.000000000 
+0200
@@ -289,7 +289,7 @@
        mbedtls_gcm_context gcmContext;
        mbedtls_gcm_init(&gcmContext);
 
-       auto ret = mbedtls_gcm_setkey(&gcmContext, MBEDTLS_CIPHER_ID_AES, 
key.data(), key.size()*8); // key size in bits
+       auto ret = mbedtls_gcm_setkey(&gcmContext, MBEDTLS_CIPHER_ID_AES, 
key.data(), (unsigned int)key.size()*8); // key size in bits
        if (ret != 0) {
                mbedtls_gcm_free(&gcmContext);
                throw BCTBX_EXCEPTION<<"Unable to set key in AES_GCM context : 
return value "<<ret;
@@ -317,7 +317,7 @@
 
        mbedtls_gcm_context gcmContext;
        mbedtls_gcm_init(&gcmContext);
-       auto ret = mbedtls_gcm_setkey(&gcmContext, MBEDTLS_CIPHER_ID_AES, 
key.data(), key.size()*8); // key size in bits
+       auto ret = mbedtls_gcm_setkey(&gcmContext, MBEDTLS_CIPHER_ID_AES, 
key.data(), (unsigned int)key.size()*8); // key size in bits
        if (ret != 0) {
                mbedtls_gcm_free(&gcmContext);
                throw BCTBX_EXCEPTION<<"Unable to set key in AES_GCM context : 
return value "<<ret;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/logging/logging.c 
new/bctoolbox-5.0.0/src/logging/logging.c
--- old/bctoolbox-4.5.20/src/logging/logging.c  2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/src/logging/logging.c   2021-07-07 13:05:29.000000000 
+0200
@@ -663,39 +663,31 @@
 static void _rotate_log_collection_files(bctbx_file_log_handler_t 
*filehandler) {
        char *log_filename;
        char *log_filename2;
-       char *file_no_extension = bctbx_strdup(filehandler->name);
-       char *extension = strrchr(file_no_extension, '.');
-       char *extension2 = bctbx_strdup(extension);
        int n = 1;
-       file_no_extension[extension - file_no_extension] = '\0';
 
-       log_filename = bctbx_strdup_printf("%s/%s_1%s",
+       log_filename = bctbx_strdup_printf("%s/%s_1",
                filehandler->path,
-               file_no_extension,
-               extension2);
+               filehandler->name);
        while(access(log_filename, F_OK) != -1) {
                // file exists
                n++;
                bctbx_free(log_filename);
-               log_filename = bctbx_strdup_printf("%s/%s_%d%s",
+               log_filename = bctbx_strdup_printf("%s/%s_%d",
                filehandler->path,
-               file_no_extension,
-               n,
-               extension2);
+               filehandler->name,
+               n);
        }
        
        while(n > 1) {
                bctbx_free(log_filename);
-               log_filename = bctbx_strdup_printf("%s/%s_%d%s",
+               log_filename = bctbx_strdup_printf("%s/%s_%d",
                filehandler->path,
-               file_no_extension,
-               n-1,
-               extension2);
-               log_filename2 = bctbx_strdup_printf("%s/%s_%d%s",
-               filehandler->path,
-               file_no_extension,
-               n,
-               extension2);
+               filehandler->name,
+               n-1);
+               log_filename2 = bctbx_strdup_printf("%s/%s_%d",
+               filehandler->path,
+               filehandler->name,
+               n);
 
                n--;
                rename(log_filename, log_filename2);
@@ -703,17 +695,14 @@
        }
        bctbx_free(log_filename);
        log_filename = bctbx_strdup_printf("%s/%s",
-       filehandler->path,
-       filehandler->name);
-       log_filename2 = bctbx_strdup_printf("%s/%s_1%s",
-       filehandler->path,
-       file_no_extension,
-       extension2);
+               filehandler->path,
+               filehandler->name);
+       log_filename2 = bctbx_strdup_printf("%s/%s_1",
+               filehandler->path,
+               filehandler->name);
        rename(log_filename, log_filename2);
        bctbx_free(log_filename);
        bctbx_free(log_filename2);
-       bctbx_free(extension2);
-       bctbx_free(file_no_extension);
 }
 
 static void _open_log_collection_file(bctbx_file_log_handler_t *filehandler) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/tester.c 
new/bctoolbox-5.0.0/src/tester.c
--- old/bctoolbox-4.5.20/src/tester.c   2021-06-10 14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/src/tester.c    2021-07-07 13:05:29.000000000 +0200
@@ -106,6 +106,7 @@
 static int max_parallel_suites = 0; /*if 0, but parallel is requested, an 
arbitrary value is determined.*/
 static int run_in_parallel = 0;
 static uint64_t globalTimeout = 0;
+static int max_failed_tests_threshold = 0;
 
 //To keep record of the process name who started and args
 static char **origin_argv = NULL;
@@ -116,6 +117,9 @@
 static int (*silent_arg_func)(const char *arg) = NULL;
 static int (*logfile_arg_func)(const char *arg) = NULL;
 
+//Processing custom native events for processing events (like PeekMessage for 
Windows) that is not implemented by Linphone 
+static void (*process_events)(void) = NULL;
+
 void bc_tester_set_silent_func(int (*func)(const char*)) {
        if (func) {
                silent_arg_func = func;
@@ -134,6 +138,15 @@
        }
 }
 
+void bc_tester_set_process_events_func(void (*func)(void)) {
+       process_events = func;
+}
+
+void bc_tester_process_events(){
+       if( process_events)
+               process_events();
+}
+
 static void (*tester_printf_va)(int level, const char *format, va_list 
args)=NULL;
 
 void bc_tester_printf(int level, const char *format, ...) {
@@ -314,20 +327,6 @@
        return buffer;
 }
 
-#ifdef _WIN32
-
-void write_suite_result_file(char *suite_name, char *results_string) {
-       (void)suite_name;
-       (void)results_string;
-       //TODO Windows support
-}
-
-void merge_and_print_results_files(void) {
-       //TODO Windows support
-}
-
-#else
-
 void write_suite_result_file(char *suite_name, char *results_string) {
        bctbx_vfs_file_t* bctbx_file;
        char *suite_name_wo_spaces, *file_name;
@@ -359,7 +358,7 @@
                bctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), 
file_name, O_RDONLY);
 
                if (bctbx_file) {
-                       file_size = (int64_t) bctbx_file_size(bctbx_file);
+                       file_size = (ssize_t) bctbx_file_size(bctbx_file);
                        if (file_size > 0) {
                                buffer = malloc(file_size + 1);
                                read_bytes = bctbx_file_read(bctbx_file, (void 
*)buffer, file_size, 0);
@@ -401,8 +400,6 @@
        }
 }
 
-#endif
-
 static void all_complete_message_handler(const CU_pFailureRecord pFailure) {
 #ifdef HAVE_CU_GET_SUITE
        if (run_in_parallel != 0) {
@@ -556,31 +553,36 @@
                        if (read_bytes == file_size) {
                                total_size += file_size;
                                suite_junit_xml_results[i][file_size] = '\0';
+                               //Also remove the file
+                               bctbx_file_close(bctbx_file);
+                               remove(file_name);
                        } else {
                                bc_tester_printf(bc_printf_verbosity_error, 
"Could not read JUnit XML file '%s' to merge", file_name);
                                bctbx_free(suite_junit_xml_results[i]);
                                suite_junit_xml_results[i] = NULL;
+                               bctbx_file_close(bctbx_file);
                        }
                } else {
                        bc_tester_printf(bc_printf_verbosity_error, "Could not 
open JUnit XML file '%s' to merge", file_name);
+                       suite_junit_xml_results[i] = NULL;
+                       bctbx_file_close(bctbx_file);
                }
-               bctbx_file_close(bctbx_file);
-               //Also remove the file
-               remove(file_name);
                bctbx_free(file_name);
        }
        //Empty the destination file
        bctbx_file = bctbx_file_open(bctbx_vfs_get_default(), dst_file_name, 
"w+");
-       bctbx_file_truncate(bctbx_file, 0);
-       offset = bctbx_file_fprintf(bctbx_file, 0, "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>\n<testsuites>\n");
-       for (i = 0; i < nb_test_suites; i++) {
-               if (suite_junit_xml_results[i] != NULL) {
-                       offset += bctbx_file_fprintf(bctbx_file, offset, 
suite_junit_xml_results[i]);
-                       bctbx_free(suite_junit_xml_results[i]);
+       if(bctbx_file){
+               bctbx_file_truncate(bctbx_file, 0);
+               offset = bctbx_file_fprintf(bctbx_file, 0, "<?xml 
version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites>\n");
+               for (i = 0; i < nb_test_suites; i++) {
+                       if (suite_junit_xml_results[i] != NULL) {
+                               offset += bctbx_file_fprintf(bctbx_file, 
offset, suite_junit_xml_results[i]);
+                               bctbx_free(suite_junit_xml_results[i]);
+                       }
                }
+               bctbx_file_fprintf(bctbx_file, offset, "</testsuites>\n");
+               bctbx_file_close(bctbx_file);
        }
-       bctbx_file_fprintf(bctbx_file, offset, "</testsuites>\n");
-       bctbx_file_close(bctbx_file);
        bctbx_free(suite_junit_xml_results);
 }
 
@@ -601,7 +603,7 @@
        for (i = 0; i < nb_test_suites; ++i) {
                char *suite_logfile_name = get_logfile_name(log_file_name, 
test_suite[i]->name);
                bctbx_file = bctbx_file_open2(bctbx_vfs_get_default(), 
suite_logfile_name, O_RDONLY);
-
+               
                if (!bctbx_file) {
                        bc_tester_printf(bc_printf_verbosity_error, "Could not 
open log file '%s' to merge into '%s'", suite_logfile_name, base_logfile_name);
                        continue;
@@ -632,6 +634,14 @@
        max_parallel_suites = nb_suites;
 }
 
+void bc_tester_set_max_failed_tests_threshold(int threshold){
+       max_failed_tests_threshold = threshold;
+}
+
+void bc_tester_set_global_timeout(int seconds){
+       globalTimeout = seconds;
+}
+
 #ifdef _WIN32
 
 void kill_sub_processes(int *pids) {
@@ -653,8 +663,72 @@
 #endif
 
 #ifdef _WIN32
-int start_sub_process(const char *suite_name) {
-       //TODO Windows support
+
+//Start        test subprocess for the given suite
+int start_sub_process(const char *suite_name, PROCESS_INFORMATION * pi) {
+       int argc = 0;
+       int i;
+       //const char *argv[origin_argc + 10]; //Assume safey 10 more parameters
+       char * commandLine = bctbx_strdup(origin_argv[0]);
+       char * commandLineTemp = NULL;
+       bool_t propagateXmlFileSetter = TRUE;
+       bool_t propagateLogFileSetter = log_file_name!=NULL;// Log file has not 
been set : Don't propagate it
+
+       for (i = 1; origin_argv[i]; ++i) {
+               if (strcmp(origin_argv[i], "--xml-file") == 0) {
+                       propagateXmlFileSetter = FALSE;
+               }
+               if (strcmp(origin_argv[i], "--log-file") == 0) {
+                       //Create a specific log file for this suite
+                       commandLineTemp = commandLine;
+                       commandLine = bc_sprintf("%s %s \"%s\"", 
commandLineTemp, origin_argv[i], get_logfile_name(log_file_name, suite_name) );
+                       bctbx_free(commandLineTemp);
+                       propagateLogFileSetter = FALSE;
+                       ++i;
+               } else {
+                       //Keep other parameters
+                       commandLineTemp = commandLine;
+                       commandLine = bc_sprintf("%s %s", commandLineTemp, 
origin_argv[i] );
+                       bctbx_free(commandLineTemp);
+               }
+       }
+       commandLineTemp = commandLine;
+       commandLine = bc_sprintf("%s --xml --child --suite \"%s\"", 
commandLineTemp, suite_name);
+       bctbx_free(commandLineTemp);
+       if( propagateXmlFileSetter){// Add current xml_file to child commands
+               commandLineTemp = commandLine;
+               commandLine = bc_sprintf("%s --xml-file \"%s\"", 
commandLineTemp, xml_file);
+               bctbx_free(commandLineTemp);
+       }
+       if(propagateLogFileSetter){
+               commandLineTemp = commandLine;
+               commandLine = bc_sprintf("%s --log-file \"%s\"", 
commandLineTemp, get_logfile_name(log_file_name, suite_name) );
+               bctbx_free(commandLineTemp);
+       }
+       
+       // Start the child process.
+       STARTUPINFOA si;
+
+       ZeroMemory( &si, sizeof(si) );
+       si.cb = sizeof(si);
+       ZeroMemory( pi, sizeof(*pi) );
+       if( !CreateProcessA( NULL,   // No module name (use command line)
+               commandLine,        // Command line
+               NULL,           // Process handle not inheritable
+               NULL,           // Thread handle not inheritable
+               FALSE,          // Set handle inheritance to FALSE
+               0,//CREATE_NEW_CONSOLE,              // No creation flags
+               NULL,           // Use parent's environment block
+               NULL,           // Use parent's starting directory
+               &si,            // Pointer to STARTUPINFO structure
+               pi )           // Pointer to PROCESS_INFORMATION structure
+    )
+    {
+        printf( "CreateProcess failed (%d).\n", GetLastError() );
+        return GetLastError();
+    }
+       bctbx_free(commandLine);
+
        return 0;
 }
 
@@ -698,49 +772,125 @@
 //For parallel tests only - handle anormally exited test suites
 //Remove previously generated XML suite file if exited anormally (could cause 
unusable final JUnit XML)
 //And mark all tests for the suite as failed
-int handle_sub_process_error(int pid, int exitStatus, int *suitesPids) {
-       if (abs(exitStatus) > 1) {
-               int i, j;
-               for (i = 0; i < nb_test_suites; ++i) {
-                       if (suitesPids[i] == pid) {
-                               ssize_t offset;
-                               char *suite_file_name = 
get_junit_xml_file_name(test_suite[i]->name, "-Results.xml");
-                               bctbx_vfs_file_t* bctbx_file = 
bctbx_file_open(bctbx_vfs_get_default(), suite_file_name, "w+");
-                               bctbx_file_truncate(bctbx_file, 0);
-
-                               offset = bctbx_file_fprintf(bctbx_file, 0, 
"\n<testsuite name=\"%s\" tests=\"%d\" time=\"0\" failures=\"%d\" errors=\"0\" 
skipped=\"0\">\n", test_suite[i]->name, test_suite[i]->nb_tests, 
test_suite[i]->nb_tests);
-                               for (j=0; j < test_suite[i]->nb_tests; ++j) {
-                                       offset += 
bctbx_file_fprintf(bctbx_file, offset, "\t<testcase classname=\"%s\" 
name=\"%s\">\n", test_suite[i]->name, test_suite[i]->tests[j].name);
-                                       offset += 
bctbx_file_fprintf(bctbx_file, offset, "\t\t<failure message=\"\" 
type=\"Failure\">\n\t\tGlobal suite failure\n");
-                                       offset += 
bctbx_file_fprintf(bctbx_file, offset, "\t\t</failure>\n\t</testcase>\n");
-                               }
-                               bctbx_file_fprintf(bctbx_file, offset, 
"\n</testsuite>\n");
-                               bc_tester_printf(bc_printf_verbosity_info, 
"Suite '%s' ended in error. Marking all tests as failed", test_suite[i]->name);
-                               bctbx_file_close(bctbx_file);
-                               bctbx_free(suite_file_name);
+int handle_sub_process_error(int pid, int *suitesPids) {
+       int failed_tests = 0;
+       int i, j;
+       for (i = 0; i < nb_test_suites; ++i) {
+               if (suitesPids[i] == pid) {
+                       ssize_t offset;
+                       char *suite_file_name = 
get_junit_xml_file_name(test_suite[i]->name, "-Results.xml");
+                       bctbx_vfs_file_t* bctbx_file = 
bctbx_file_open(bctbx_vfs_get_default(), suite_file_name, "w+");
+                       bctbx_file_truncate(bctbx_file, 0);
+
+                       offset = bctbx_file_fprintf(bctbx_file, 0, 
"\n<testsuite name=\"%s\" tests=\"%d\" time=\"0\" failures=\"%d\" errors=\"0\" 
skipped=\"0\">\n", test_suite[i]->name, test_suite[i]->nb_tests, 
test_suite[i]->nb_tests);
+                       failed_tests = test_suite[i]->nb_tests;
+                       for (j=0; j < test_suite[i]->nb_tests; ++j) {
+                               offset += bctbx_file_fprintf(bctbx_file, 
offset, "\t<testcase classname=\"%s\" name=\"%s\">\n", test_suite[i]->name, 
test_suite[i]->tests[j].name);
+                               offset += bctbx_file_fprintf(bctbx_file, 
offset, "\t\t<failure message=\"\" type=\"Failure\">\n\t\tGlobal suite 
failure\n");
+                               offset += bctbx_file_fprintf(bctbx_file, 
offset, "\t\t</failure>\n\t</testcase>\n");
                        }
+                       bctbx_file_fprintf(bctbx_file, offset, 
"\n</testsuite>\n");
+                       bc_tester_printf(bc_printf_verbosity_info, "Suite '%s' 
ended in error. Marking all tests as failed", test_suite[i]->name);
+                       bctbx_file_close(bctbx_file);
+                       bctbx_free(suite_file_name);
+                       break;
                }
        }
-       return exitStatus;
+       return failed_tests;
 }
 
 #ifdef _WIN32
-//TODO Windows support
 int bc_tester_run_parallel(void) {
-       return 0;
+       int ret = 0; //Global return status;
+       if( nb_test_suites > 0){
+               PROCESS_INFORMATION * suitesPids = malloc(nb_test_suites * 
sizeof( PROCESS_INFORMATION));
+               int *processed = malloc(nb_test_suites * sizeof(int));
+               uint64_t time_start = bctbx_get_cur_time_ms(), elapsed = 
time_start, print_timer = time_start;
+
+               //Assume there is a problem if a suite is still running 60mn 
after the start of the tester. TODO make timeout   a cli parameter ?
+               uint64_t timeout = 0;
+               if (globalTimeout <= 0) {
+                               globalTimeout = 60 * 60;
+               }
+               timeout = time_start + (globalTimeout * 1000);
+
+
+               int maxProcess = bc_tester_get_max_parallel_processes();
+               int nextSuite = 0; //Next suite id to be exec'd
+               int runningSuites = 0; //Number of currently running suites
+               int testsFinished = 0;
+
+               memset(suitesPids, 0, 
nb_test_suites*sizeof(PROCESS_INFORMATION));
+               memset(processed, 0, nb_test_suites*sizeof(int));
+               do {
+                       if (nextSuite < nb_test_suites && runningSuites < 
maxProcess) {
+                               PROCESS_INFORMATION pi;
+
+                               if 
(start_sub_process(test_suite[nextSuite]->name, &pi) != 0) {
+                                       
bc_tester_printf(bc_printf_verbosity_error, "Error while starting suite 
sub-process. Aborting.");
+                                       return -1;
+                               }
+                               suitesPids[nextSuite] = pi;
+                               runningSuites++;
+                               nextSuite++;
+                       }else{
+                               for(int i = 0 ;  i < nextSuite ; ++i){
+                                       if( processed[i] == 0){
+                                               int returnCode = 
WaitForSingleObject( suitesPids[i].hProcess, 1000 );
+                                               if( ( returnCode != 
WAIT_TIMEOUT)){
+                                                       --runningSuites;
+                                                       ++testsFinished;
+                                                       
bc_tester_printf(bc_printf_verbosity_error, "Suite sub process (ID %d) 
terminated with return code %d.", i, returnCode);
+                                                       processed[i] = 1;
+                                                       ret += returnCode;
+                                               }
+                                       }
+                               }
+                       }
+                       bctbx_sleep_ms(50);
+                       if (elapsed - print_timer > 10000) { //print message 
only every ~10s...
+                               bc_tester_printf(bc_printf_verbosity_error, 
"Waiting for test suites to finish... Total Suites(%d). Suites running(%d), 
Finished(%d)", nb_test_suites, runningSuites, testsFinished);
+                               print_timer = bctbx_get_cur_time_ms();
+                       }
+                       elapsed = bctbx_get_cur_time_ms();
+               } while (testsFinished < nb_test_suites && elapsed < timeout);
+
+               if (elapsed >= timeout) {
+                       bc_tester_printf(bc_printf_verbosity_error, "Stopped 
waiting for all test suites to execute as we reach timeout. Killing running 
suites.");
+                       for(int i = 0 ;  i < nextSuite ; ++i){
+                               if( processed[i] == 0)
+                                       
TerminateProcess(suitesPids[i].hProcess, -1);
+                       }
+                       bc_tester_printf(bc_printf_verbosity_error, "*** Test 
suite took too much time. Please check errors or split longest test suites to 
benefit from parallel execution. ***");
+                       ret = -1;
+               }
+               for(int i = 0 ;  i < nextSuite ; ++i){
+                       CloseHandle( suitesPids[i].hProcess );
+                       CloseHandle( suitesPids[i].hThread );
+               }
+               bc_tester_printf(bc_printf_verbosity_info, "All suites ended.");
+               
+               if (ret != -1){
+                       int seconds = (int)(elapsed - time_start)/1000;
+                       all_complete_message_handler(NULL);
+                       bc_tester_printf(bc_printf_verbosity_info, "Full 
parallel run completed in %2i mn %2i s.\n", seconds/60, seconds % 60);
+               }
+               free( suitesPids);
+               free( processed);
+       }
+       return ret == -1 ?  ret : (ret > max_failed_tests_threshold);
 }
 #else
 
 int bc_tester_run_parallel(void) {
        int suitesPids[nb_test_suites];
        uint64_t time_start = bctbx_get_cur_time_ms(), elapsed = time_start, 
print_timer = time_start;
-
-       //Assume there is a problem if a suite is still running 60mn after the 
start of the tester. TODO make timeout   a cli parameter ?
        uint64_t timeout = 0;
+       
        if (globalTimeout <= 0) {
-                       globalTimeout = 60;
+                       globalTimeout = 60 * 60;
        }
-       timeout = time_start + (globalTimeout * 60 * 1000);
+       timeout = time_start + (globalTimeout * 1000);
 
 
        int maxProcess = bc_tester_get_max_parallel_processes();
@@ -780,14 +930,11 @@
                                        ++testsFinished;
                                }
                                if (WIFSIGNALED(wstatus)) {
-                                       childRet = WTERMSIG(wstatus);
+                                       childRet = 
handle_sub_process_error(childPid, suitesPids);
                                } else {
                                        childRet = WEXITSTATUS(wstatus);
                                }
-                               handle_sub_process_error(childPid, childRet, 
suitesPids);
-                               if (ret == 0 && childRet != 0) {
-                                       ret = childRet;
-                               }
+                               ret += childRet;
                                bc_tester_printf(bc_printf_verbosity_error, 
"Suite sub process (pid %d) terminated with return code %d.", childPid, 
childRet);
                        }
                }
@@ -801,16 +948,19 @@
 
        if (elapsed >= timeout) {
                bc_tester_printf(bc_printf_verbosity_error, "Stopped waiting 
for all test suites to execute as we reach timeout. Killing running suites.");
+               bc_tester_printf(bc_printf_verbosity_error, "*** Test suite 
took too much time. Please check errors or split longest test suites to benefit 
from parallel execution. ***");
                kill_sub_processes(suitesPids);
+               ret = -1;
        }
        bc_tester_printf(bc_printf_verbosity_info, "All suites ended.");
-       all_complete_message_handler(NULL);
-       {
+       
+       if (ret != -1){
                int seconds = (int)(elapsed - time_start)/1000;
-               
+               all_complete_message_handler(NULL);
                bc_tester_printf(bc_printf_verbosity_info, "Full parallel run 
completed in %2i mn %2i s.\n", seconds/60, seconds % 60);
+               return ret > max_failed_tests_threshold;
        }
-       return ret;
+       return -1;
 }
 
 #endif
@@ -833,7 +983,7 @@
        
CU_set_suite_cleanup_failure_handler(suite_cleanup_failure_message_handler);
 
        if (xml_enabled == 1) {
-               char *xml_file_name;
+               char *xml_file_name;//, *xml_file_name_tmp;
                CU_automated_enable_junit_xml(TRUE); /* this requires 3.0.1 
because previous versions crash automated.c */
 
                if (run_in_parallel != 0) {
@@ -846,11 +996,14 @@
                                CU_automated_run_tests();
                        } else { //Starting registered suites in parallel
                                ret = bc_tester_run_parallel();
-                               xml_file_name = get_junit_xml_file_name(NULL, 
"-Results.xml");
-                               merge_junit_xml_files(xml_file_name);
-                               bctbx_free(xml_file_name);
-                               if (log_file_name) {
-                                       merge_log_files(log_file_name);
+                               if (ret != -1){
+                                       /* -1 means timeout, in this case don't 
generate junit report. */
+                                       xml_file_name = 
get_junit_xml_file_name(NULL, "-Results.xml");
+                                       merge_junit_xml_files(xml_file_name);
+                                       bctbx_free(xml_file_name);
+                                       if (log_file_name) {
+                                               merge_log_files(log_file_name);
+                                       }
                                }
                                return ret;
                        }
@@ -917,8 +1070,17 @@
        bc_tester_printf(bc_printf_verbosity_info, "Still %i kilobytes 
allocated when all tests are finished.",
                         mallinfo().uordblks / 1024);
 #endif
-
-       return CU_get_number_of_tests_failed()!=0;
+       if (run_in_parallel){
+               // We are a child process, return the number of test failed.
+               int failed_tests = CU_get_number_of_tests_failed();
+               if (failed_tests >= 255) {
+                       bc_tester_printf(bc_printf_verbosity_error, "The number 
of tests exceeded 255, the maximum value for an exit status !");
+                       failed_tests = 255;
+               }
+               return failed_tests;
+       }
+       /* Otherwise it is serialized execution.*/
+       return (int)CU_get_number_of_tests_failed() > 
(int)max_failed_tests_threshold;
 
 }
 
@@ -1115,6 +1277,7 @@
                         "\t\t\t--max-alloc <size in ko> (maximum amount of 
memory obtained via malloc allocator)\n"
                         "\t\t\t--max-alloc <size in ko> (maximum amount of 
memory obtained via malloc allocator)\n"
                         "\t\t\t--parallel (Execute tests concurrently and with 
JUnit report)\n"
+                        "\t\t\t--parallel-max (Number Max of parallel 
processes)\n"
                         "\t\t\t--timeout <timeout in minutes> (sets the global 
timeout when used alongside to the parallel option, the default value is 60)\n"
                         "And additionally:\n"
                         "%s",
@@ -1174,9 +1337,12 @@
                //Defaults to JUnit report if parallel is enabled
                xml_enabled = 1;
                run_in_parallel = 1;
+       } else if (strcmp(argv[i], "--parallel-max") == 0) {
+               CHECK_ARG("--parallel-max", ++i, argc);
+               bc_tester_set_max_parallel_suites(atoi(argv[i]));
        } else if (strcmp(argv[i], "--timeout") == 0) {
                CHECK_ARG("--timeout", ++i, argc);
-               globalTimeout = atoi(argv[i]);
+               globalTimeout = atoi(argv[i]) * 60;
        } else if (strcmp(argv[i], "--max-alloc") == 0) {
                CHECK_ARG("--max-alloc", ++i, argc);
                max_vm_kb = atol(argv[i]);
@@ -1186,6 +1352,7 @@
        } else if (strcmp(argv[i], "--writable-dir") == 0) {
                CHECK_ARG("--writable-dir", ++i, argc);
                bc_tester_writable_dir_prefix = strdup(argv[i]);
+       }else if(strcmp(argv[i],"--child")==0){//Switch off this parameter as 
it is used for external processing
        } else {
                bc_tester_printf(bc_printf_verbosity_error, "Unknown option 
\"%s\"", argv[i]);
                return -1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/utils/port.c 
new/bctoolbox-5.0.0/src/utils/port.c
--- old/bctoolbox-4.5.20/src/utils/port.c       2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/src/utils/port.c        2021-07-07 13:05:29.000000000 
+0200
@@ -26,6 +26,7 @@
 #include "bctoolbox/port.h"
 #include "bctoolbox/vconnect.h"
 #include "bctoolbox/list.h"
+#include "bctoolbox/charconv.h"
 #include "utils.h"
 
 #if    defined(_WIN32) && !defined(_WIN32_WCE)
@@ -110,7 +111,7 @@
 char * bctbx_dirname(const char *path) {
        char *ptr = strrchr(path, '/');
        if (ptr == NULL) ptr = strrchr(path, '\\');
-       return ptr ? bctbx_strndup(path, ptr-path) : bctbx_strdup(".");
+       return ptr ? bctbx_strndup(path, (int) (ptr-path)) : bctbx_strdup(".");
 }
 
 char * bctbx_basename(const char *path) {
@@ -513,13 +514,20 @@
 
 static HANDLE event=NULL;
 
-/* portable named pipes */
+
 bctbx_pipe_t bctbx_server_pipe_create(const char *name){
 #ifdef BCTBX_WINDOWS_DESKTOP
        bctbx_pipe_t h;
        char *pipename=make_pipe_name(name);
+#ifdef BCTBX_WINDOWS_UWP
+       wchar_t * wPipename = bctbx_string_to_wide_string(pipename);
+       
h=CreateNamedPipe(wPipename,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_MESSAGE|PIPE_WAIT,1,
+                                               32768,32768,0,NULL);
+       bctbx_free(wPipename);
+#else
        
h=CreateNamedPipe(pipename,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_MESSAGE|PIPE_WAIT,1,
                                                32768,32768,0,NULL);
+#endif 
        bctbx_free(pipename);
        if (h==INVALID_HANDLE_VALUE){
                bctbx_error("Fail to create named pipe %s",pipename);
@@ -581,7 +589,7 @@
 }
 
 bctbx_pipe_t bctbx_client_pipe_connect(const char *name){
-#ifdef BCTBX_WINDOWS_DESKTOP
+#if defined(BCTBX_WINDOWS_DESKTOP)  && !defined(BCTBX_WINDOWS_UWP)
        char *pipename=make_pipe_name(name);
        bctbx_pipe_t hpipe = CreateFile(
                 pipename,   // pipe name
@@ -631,11 +639,17 @@
 
 void *bctbx_shm_open(unsigned int keyid, int size, int create){
 #ifdef BCTBX_WINDOWS_DESKTOP
-       HANDLE h;
-       char name[64];
+       HANDLE h;       
        void *buf;
-
+#ifdef BCTBX_WINDOWS_UWP
+       char nameBuf[64];
+       snprintf(nameBuf,sizeof(nameBuf),"%x",keyid);
+       wchar_t * name = bctbx_string_to_wide_string(nameBuf);
+#else
+       char name[64];
        snprintf(name,sizeof(name),"%x",keyid);
+#endif
+
        if (create){
                h = CreateFileMapping(
                        INVALID_HANDLE_VALUE,    // use paging file
@@ -668,6 +682,9 @@
                CloseHandle(h);
                bctbx_error("MapViewOfFile failed");
        }
+#ifdef BCTBX_WINDOWS_UWP
+       bctbx_free(name);
+#endif
        return buf;
 #else
        bctbx_error("%s not supported!", __FUNCTION__);
@@ -705,7 +722,7 @@
 
 void _bctbx_get_cur_time(bctoolboxTimeSpec *ret, bool_t realtime){
 #if defined(_WIN32_WCE) || defined(WIN32)
-#if defined(BCTBX_WINDOWS_DESKTOP) && !defined(ENABLE_MICROSOFT_STORE_APP)
+#if defined(BCTBX_WINDOWS_DESKTOP) && !defined(ENABLE_MICROSOFT_STORE_APP) && 
!defined(BCTBX_WINDOWS_UWP)
        DWORD timemillis;
 #      if defined(_WIN32_WCE)
        timemillis=GetTickCount();
@@ -1728,7 +1745,7 @@
        output_string[8] = '\0';
 }
 
-uint32_t bctbx_str_to_uint32(const uint8_t input_string[9]) {
+uint32_t bctbx_str_to_uint32(const uint8_t *input_string) {
        return  (((uint32_t)bctbx_char_to_byte(input_string[0]))<<28)
                | (((uint32_t)bctbx_char_to_byte(input_string[1]))<<24)
                | (((uint32_t)bctbx_char_to_byte(input_string[2]))<<20)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/utils/utils.cc 
new/bctoolbox-5.0.0/src/utils/utils.cc
--- old/bctoolbox-4.5.20/src/utils/utils.cc     1970-01-01 01:00:00.000000000 
+0100
+++ new/bctoolbox-5.0.0/src/utils/utils.cc      2021-07-07 13:05:29.000000000 
+0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016-2021 Belledonne Communications SARL.
+ *
+ * This file is part of bctoolbox.
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "bctoolbox/utils.hh"
+
+using namespace std;
+
+vector<string> bctoolbox::Utils::split (const string &str, const string 
&delimiter) {
+       vector<string> out;
+
+       size_t pos = 0, oldPos = 0;
+       for (; (pos = str.find(delimiter, pos)) != string::npos; oldPos = pos + 
delimiter.length(), pos = oldPos)
+               out.push_back(str.substr(oldPos, pos - oldPos));
+       out.push_back(str.substr(oldPos));
+
+       return out;
+}
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/vfs/vfs.c 
new/bctoolbox-5.0.0/src/vfs/vfs.c
--- old/bctoolbox-4.5.20/src/vfs/vfs.c  2021-06-10 14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/src/vfs/vfs.c   2021-07-07 13:05:29.000000000 +0200
@@ -238,10 +238,10 @@
                                pFile->fPageOffset = pFile->offset;
                        }
                        bctbx_free(ret);
-                       pFile->offset += count;
+                       pFile->offset += (off_t)count;
                        pFile->fSize += count;
                        pFile->gSize = 0; // cancel get cache, as it might be 
dirty now
-                       return count;
+                       return (ssize_t)count;
                } else if (pFile->fSize > 0){ // There is a cache but the new 
data won't fit in : write the cache and the new data
                        char *buf = bctbx_malloc(count+pFile->fSize); // 
allocate a temporary buffer, to store the current cache and the data to be 
written
                        if (buf == NULL) {
@@ -257,9 +257,9 @@
                                return r;
                        }
                        pFile->fSize = 0; // f cache is now empty
-                       pFile->offset += count;
+                       pFile->offset += (off_t)count;
                        pFile->gSize = 0; // cancel get cache, as it might be 
dirty now
-                       return count;
+                       return (ssize_t)count;
                }
                // no cache and more than one page to write, just write it
                r = bctbx_file_write(pFile, ret, count, pFile->offset);
@@ -362,7 +362,7 @@
                        return sizeofline; // return size including the 
termination, so an empty line returns 1 (0 is for EOF)
                } else { // No end of line found, did we reach the EOF?
                        if (pFile->gPage[pFile->gSize-1] == 0x04) { // 0x04 is 
EOT in ASCII, put in cache to signal the end of file
-                               sizeofline = pFile->gSize - (pFile->offset - 
pFile->gPageOffset) -1; // size does not include the EOT char(which is part of 
the page size). so -1
+                               sizeofline = (int)(pFile->gSize - 
(pFile->offset - pFile->gPageOffset) -1); // size does not include the EOT 
char(which is part of the page size). so -1
                                pFile->offset += sizeofline; // offset now 
points on the EOT char
                                memcpy(s,c,sizeofline); // copy everything 
before the EOT
                                s[sizeofline] = '\0';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/vfs/vfs_encrypted.cc 
new/bctoolbox-5.0.0/src/vfs/vfs_encrypted.cc
--- old/bctoolbox-4.5.20/src/vfs/vfs_encrypted.cc       2021-06-10 
14:56:37.000000000 +0200
+++ new/bctoolbox-5.0.0/src/vfs/vfs_encrypted.cc        2021-07-07 
13:05:29.000000000 +0200
@@ -183,7 +183,7 @@
                        // encrypt
                        auto rawChunk = 
m_module->encryptChunk(currentChunkIndex, std::vector<uint8_t>(readBuf, 
readBuf+readSize));
                        // write
-                       if (bctbx_file_write(stdFdTmp, rawChunk.data(), 
rawChunk.size(), getChunkOffset(currentChunkIndex)) - rawChunk.size() != 0 ){
+                       if (bctbx_file_write(stdFdTmp, rawChunk.data(), 
rawChunk.size(), (off_t)getChunkOffset(currentChunkIndex)) - rawChunk.size() != 
0 ){
                                bctbx_file_close(stdFdTmp);
                                bctbx_free(readBuf);
                                throw EVFS_EXCEPTION<<"Unable to migrate plain 
file "<<mFilename<<". Could not write to temporary file "<<tmpFilename;
@@ -215,7 +215,7 @@
                                if (mIntegrityFullCheck == true) { // file size 
in header is wrong, check each chunk and update header
                                        for (auto chunkIndex = 
getChunkIndex(mFileSize); chunkIndex >0; chunkIndex--) { // start from last 
chunk
                                                std::vector<uint8_t> 
rawData(rawChunkSizeGet());
-                                               ssize_t readSize = 
bctbx_file_read(pFileStd, rawData.data(), rawData.size(), 
getChunkOffset(chunkIndex));
+                                               ssize_t readSize = 
bctbx_file_read(pFileStd, rawData.data(), rawData.size(), 
(off_t)getChunkOffset(chunkIndex));
                                                if (readSize >= 0) {
                                                        
rawData.resize(readSize);
                                                } else {
@@ -442,7 +442,7 @@
        // read the data, the are at offset baseFileHeaderSize + 
mHeaderExtensionSize
        auto encryptionSuiteData = 
std::vector<uint8_t>(encryptionModuleDataSize);
        if (encryptionModuleDataSize != 0) {
-               if (bctbx_file_read(pFileStd, encryptionSuiteData.data(), 
encryptionModuleDataSize, baseFileHeaderSize+mHeaderExtensionSize) - 
encryptionModuleDataSize != 0) {
+               if (bctbx_file_read(pFileStd, encryptionSuiteData.data(), 
encryptionModuleDataSize, (off_t)(baseFileHeaderSize+mHeaderExtensionSize)) - 
encryptionModuleDataSize != 0) {
                        throw EVFS_EXCEPTION<<"Encrypted FS: unable to read 
encryption scheme data in file header";
                }
        }
@@ -549,7 +549,7 @@
        // plain file?
        if (m_module == nullptr) {
                std::vector<uint8_t> plain(count);
-               auto readSize = bctbx_file_read(pFileStd, plain.data(), 
plain.size(), offset);
+               auto readSize = bctbx_file_read(pFileStd, plain.data(), 
plain.size(), (off_t)offset);
                plain.resize(readSize);
                return plain;
        }
@@ -563,7 +563,7 @@
        std::vector<uint8_t> 
rawData((lastChunk-firstChunk+1)*rawChunkSizeGet());
 
        /* read all chunks from actual file */
-       ssize_t readSize = bctbx_file_read(pFileStd, rawData.data(), 
rawData.size(), getChunkOffset(firstChunk));
+       ssize_t readSize = bctbx_file_read(pFileStd, rawData.data(), 
rawData.size(), (off_t)getChunkOffset(firstChunk));
 
        /* resize rawData to the actual content size - last chunk may be 
incomplete */
        if (readSize >= 0) {
@@ -594,7 +594,7 @@
 size_t VfsEncryption::write(const std::vector<uint8_t> &plainData, size_t 
offset) {
        // plain file?
        if (m_module == nullptr) {
-               ssize_t ret = bctbx_file_write(pFileStd, plainData.data(), 
plainData.size(), offset);
+               ssize_t ret = bctbx_file_write(pFileStd, plainData.data(), 
plainData.size(), (off_t)offset);
                if ( ret - plainData.size() == 0) { // compare signed and 
unsigned
                        return plainData.size();
                } else {
@@ -621,7 +621,7 @@
 
        if (readOffset<mFileSize) { // Yes we are overwritting some data, read 
all the existing chunks we are overwritting
                rawData.resize(rawDataSize);
-               ssize_t overwrittenSize = bctbx_file_read(pFileStd, 
rawData.data(), rawDataSize, getChunkOffset(firstChunk));
+               ssize_t overwrittenSize = bctbx_file_read(pFileStd, 
rawData.data(), rawDataSize, (off_t)getChunkOffset(firstChunk));
                rawData.resize(overwrittenSize);
                rawData.shrink_to_fit();
        }
@@ -666,7 +666,7 @@
        }
 
        // now actually write the rawData in the file
-       ssize_t ret = bctbx_file_write(pFileStd, updatedRawData.data(), 
updatedRawData.size(), getChunkOffset(firstChunk));
+       ssize_t ret = bctbx_file_write(pFileStd, updatedRawData.data(), 
updatedRawData.size(), (off_t)getChunkOffset(firstChunk));
        if ( ret - updatedRawData.size() == 0) { // compare signed and unsigned
                mFileSize = finalFileSize;
                writeHeader();
@@ -697,7 +697,7 @@
                        std::vector<uint8_t> rawData(rawChunkSizeGet());
 
                        // read the future last chunk from actual file
-                       ssize_t readSize = bctbx_file_read(pFileStd, 
rawData.data(), rawData.size(), getChunkOffset(getChunkIndex(newSize)));
+                       ssize_t readSize = bctbx_file_read(pFileStd, 
rawData.data(), rawData.size(), (off_t)getChunkOffset(getChunkIndex(newSize)));
                        rawData.resize(readSize);
                        // decrypt it
                        auto plainLastChunk = 
m_module->decryptChunk(getChunkIndex(newSize), 
std::vector<uint8_t>(rawData.cbegin(), 
rawData.cbegin()+std::min(rawChunkSizeGet(), rawData.size())));
@@ -707,7 +707,7 @@
                        m_module->encryptChunk(getChunkIndex(newSize), rawData, 
std::vector<uint8_t>(plainLastChunk.cbegin(), plainLastChunk.cend()));
 
                        /* write it to the actual file */
-                       if (bctbx_file_write(pFileStd, rawData.data(), 
rawData.size(), getChunkOffset(getChunkIndex(newSize))) - rawData.size() != 0) {
+                       if (bctbx_file_write(pFileStd, rawData.data(), 
rawData.size(), (off_t)getChunkOffset(getChunkIndex(newSize))) - rawData.size() 
!= 0) {
                                throw EVFS_EXCEPTION << "Cannot write file 
"<<mFilename<<" during truncate";
                        }
                }
@@ -789,7 +789,7 @@
                        auto readBuffer = ctx->read(offset, count);
 
                        memcpy (buf, readBuffer.data(), readBuffer.size());
-                       return readBuffer.size();
+                       return (ssize_t)readBuffer.size();
                } catch (EvfsException const &e) { // cannot let raise an 
exception to a C context
                        BCTBX_SLOGE<<"Encrypted VFS: error while reading 
"<<count<<" bytes from file "<<ctx->filenameGet()<<" at offset "<<offset<<". 
"<<e;
                }
@@ -811,7 +811,7 @@
        if (offset < 0 ) return BCTBX_VFS_ERROR;
        if (pFile && pFile->pUserData) {
                VfsEncryption *ctx = static_cast<VfsEncryption 
*>(pFile->pUserData);
-               return ctx->write(std::vector<uint8_t>(reinterpret_cast<const 
uint8_t *>(buf), reinterpret_cast<const uint8_t *>(buf)+count), offset);
+               return 
(ssize_t)ctx->write(std::vector<uint8_t>(reinterpret_cast<const uint8_t 
*>(buf), reinterpret_cast<const uint8_t *>(buf)+count), offset);
        }
        return BCTBX_VFS_ERROR;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bctoolbox-4.5.20/src/vfs/vfs_standard.c 
new/bctoolbox-5.0.0/src/vfs/vfs_standard.c
--- old/bctoolbox-4.5.20/src/vfs/vfs_standard.c 2021-06-10 14:56:37.000000000 
+0200
+++ new/bctoolbox-5.0.0/src/vfs/vfs_standard.c  2021-07-07 13:05:29.000000000 
+0200
@@ -214,7 +214,7 @@
        if (pFile == NULL || fName == NULL) {
                return BCTBX_VFS_ERROR;
        }
-#if _WIN32
+#ifdef _WIN32
        openFlags |= O_BINARY;
 #endif
 

Reply via email to