From 8f1a430f8f5f6bcb044db88cab636cc56e06ad39 Mon Sep 17 00:00:00 2001
From: kristof <Kristof.Szabados@ericsson.com>
Date: Mon, 3 Apr 2017 07:51:14 +0200
Subject: [PATCH] static_casts are stricter than old-style casts, so lets use
 them.

Signed-off-by: kristof <Kristof.Szabados@ericsson.com>
---
 common/ModuleVersion.cc  |  2 +-
 common/NetworkHandler.cc | 26 ++++++++++++-------------
 common/Quadruple.cc      | 42 ++++++++++++++++++++--------------------
 common/config_preproc.cc |  9 ++++-----
 common/memory.h          |  4 ++--
 common/new.cc            |  2 +-
 common/pattern_la.l      | 24 +++++++++++------------
 common/pattern_p.y       | 16 +++++++--------
 common/pattern_uni.y     | 18 ++++++++---------
 9 files changed, 71 insertions(+), 72 deletions(-)

diff --git a/common/ModuleVersion.cc b/common/ModuleVersion.cc
index 3dc5511ed..aff2b22f9 100644
--- a/common/ModuleVersion.cc
+++ b/common/ModuleVersion.cc
@@ -29,7 +29,7 @@ std::string ModuleVersion::toString() const {
   }
   if (release != 0) {
     stream << separator << 'R' << release << separator
-      << (char)('A' + patch);
+      << static_cast<char>('A' + patch);
   }
   if (build != 0) {
     stream << separator << build;
diff --git a/common/NetworkHandler.cc b/common/NetworkHandler.cc
index afa18be0c..a361b8d53 100644
--- a/common/NetworkHandler.cc
+++ b/common/NetworkHandler.cc
@@ -188,11 +188,11 @@ bool IPv4Address::set_addr(const char *p_addr, unsigned short p_port)
   clean_up();
   if (p_addr != NULL) {
     struct hostent *hptr = gethostbyname(p_addr);
-    if (hptr != NULL && (size_t)hptr->h_length == sizeof(struct in_addr)) {
+    if (hptr != NULL && static_cast<size_t>(hptr->h_length) == sizeof(struct in_addr)) {
       m_addr.sin_family = AF_INET;
       m_addr.sin_port = htons(p_port);
       memset(m_addr.sin_zero, 0, sizeof(m_addr.sin_zero));
-      memcpy(&m_addr.sin_addr, hptr->h_addr_list[0], hptr->h_length);
+      memcpy(&m_addr.sin_addr, hptr->h_addr_list[0], static_cast<size_t>(hptr->h_length));
       strncpy(m_addr_str, inet_ntoa(m_addr.sin_addr), sizeof(m_addr_str));
       strncpy(m_host_str, hptr->h_name, sizeof(m_host_str));
       return true;
@@ -212,7 +212,7 @@ int IPv4Address::accept(int p_sockfd)
       struct hostent *hptr =
         gethostbyaddr((const char *)&m_addr.sin_addr,
                       sizeof(m_addr.sin_addr), m_addr.sin_family);
-      if (hptr != NULL && (size_t)hptr->h_length == sizeof(struct in_addr)) {
+      if (hptr != NULL && static_cast<size_t>(hptr->h_length) == sizeof(struct in_addr)) {
         strncpy(m_host_str, hptr->h_name, sizeof(m_host_str));
       }
     }
@@ -231,7 +231,7 @@ int IPv4Address::getsockname(int p_sockfd)
       struct hostent *hptr =
         gethostbyaddr((const char *)&m_addr.sin_addr,
                       sizeof(m_addr.sin_addr), m_addr.sin_family);
-      if (hptr != NULL && (size_t)hptr->h_length == sizeof(struct in_addr)) {
+      if (hptr != NULL && static_cast<size_t>(hptr->h_length) == sizeof(struct in_addr)) {
         strncpy(m_host_str, hptr->h_name, sizeof(m_host_str));
       }
     }
@@ -241,7 +241,7 @@ int IPv4Address::getsockname(int p_sockfd)
 
 bool IPv4Address::operator==(const IPAddress& p_addr) const
 {
-  return memcmp(&m_addr.sin_addr, &(((const IPv4Address&)p_addr).m_addr.sin_addr), sizeof(m_addr.sin_addr)) == 0;
+  return memcmp(&m_addr.sin_addr, &((static_cast<const IPv4Address&>(p_addr)).m_addr.sin_addr), sizeof(m_addr.sin_addr)) == 0;
 }
 
 bool IPv4Address::operator!=(const IPAddress& p_addr) const
@@ -252,9 +252,9 @@ bool IPv4Address::operator!=(const IPAddress& p_addr) const
 IPAddress& IPv4Address::operator=(const IPAddress& p_addr)
 {
   clean_up();
-  memcpy(&m_addr, &((const IPv4Address&)p_addr).m_addr, sizeof(m_addr));
-  strncpy(m_host_str, ((const IPv4Address&)p_addr).m_host_str, sizeof(m_host_str));
-  strncpy(m_addr_str, ((const IPv4Address&)p_addr).m_addr_str, sizeof(m_addr_str));
+  memcpy(&m_addr, &(static_cast<const IPv4Address&>(p_addr)).m_addr, sizeof(m_addr));
+  strncpy(m_host_str, (static_cast<const IPv4Address&>(p_addr)).m_host_str, sizeof(m_host_str));
+  strncpy(m_addr_str, (static_cast<const IPv4Address&>(p_addr)).m_addr_str, sizeof(m_addr_str));
   return *this;
 }
 
@@ -325,7 +325,7 @@ bool IPv6Address::set_addr(const char *p_addr, unsigned short p_port)
   snprintf(p_port_str, sizeof(p_port_str), "%u", p_port);
   int s = getaddrinfo(p_addr, p_port_str, &hints, &res);
   if (s == 0) {
-    struct sockaddr_in6 *addr = (struct sockaddr_in6 *)(void*)res->ai_addr;
+    struct sockaddr_in6 *addr = static_cast<struct sockaddr_in6 *>(static_cast<void*>(res->ai_addr));
     // The (void*) shuts up the "cast increases required alignment" warning.
     // Hopefully, the res->ai_addr points to a properly aligned sockaddr_in6
     // and we won't have problems like these if we decide to support Sparc:
@@ -382,7 +382,7 @@ int IPv6Address::getsockname(int p_sockfd)
 
 bool IPv6Address::operator==(const IPAddress& p_addr) const
 {
-  return memcmp(&m_addr.sin6_addr, &(((const IPv6Address&)p_addr).m_addr.sin6_addr), sizeof(m_addr.sin6_addr)) == 0;
+  return memcmp(&m_addr.sin6_addr, &((static_cast<const IPv6Address&>(p_addr)).m_addr.sin6_addr), sizeof(m_addr.sin6_addr)) == 0;
 }
 
 bool IPv6Address::operator!=(const IPAddress& p_addr) const
@@ -393,9 +393,9 @@ bool IPv6Address::operator!=(const IPAddress& p_addr) const
 IPAddress& IPv6Address::operator=(const IPAddress& p_addr)
 {
   clean_up();
-  memcpy(&m_addr, &((const IPv6Address&)p_addr).m_addr, sizeof(m_addr));
-  strncpy(m_host_str, ((const IPv6Address&)p_addr).m_host_str, sizeof(m_host_str));
-  strncpy(m_addr_str, ((const IPv6Address&)p_addr).m_addr_str, sizeof(m_addr_str));
+  memcpy(&m_addr, &(static_cast<const IPv6Address&>(p_addr)).m_addr, sizeof(m_addr));
+  strncpy(m_host_str, (static_cast<const IPv6Address&>(p_addr)).m_host_str, sizeof(m_host_str));
+  strncpy(m_addr_str, (static_cast<const IPv6Address&>(p_addr)).m_addr_str, sizeof(m_addr_str));
   return *this;
 }
 
diff --git a/common/Quadruple.cc b/common/Quadruple.cc
index c2537a93c..3e019f546 100644
--- a/common/Quadruple.cc
+++ b/common/Quadruple.cc
@@ -66,10 +66,10 @@ void Quad::set(unsigned char group, unsigned char plane, unsigned char row,
 }
 
 void Quad::set_hexrepr(const char* hex_repr) {
-  u.comp.group = (unsigned char)(((hex_repr[0] - 'A') << 4) + (hex_repr[1] - 'A'));
-  u.comp.plane = (unsigned char)(((hex_repr[2] - 'A') << 4) + (hex_repr[3] - 'A'));
-  u.comp.row =   (unsigned char)(((hex_repr[4] - 'A') << 4) + (hex_repr[5] - 'A'));
-  u.comp.cell =  (unsigned char)(((hex_repr[6] - 'A') << 4) + (hex_repr[7] - 'A'));
+  u.comp.group = static_cast<unsigned char>(((hex_repr[0] - 'A') << 4) + (hex_repr[1] - 'A'));
+  u.comp.plane = static_cast<unsigned char>(((hex_repr[2] - 'A') << 4) + (hex_repr[3] - 'A'));
+  u.comp.row =   static_cast<unsigned char>(((hex_repr[4] - 'A') << 4) + (hex_repr[5] - 'A'));
+  u.comp.cell =  static_cast<unsigned char>(((hex_repr[6] - 'A') << 4) + (hex_repr[7] - 'A'));
 }
 
 const Quad Quad::operator-(const Quad& rhs) const {
@@ -133,21 +133,21 @@ char* Quad::get_hexrepr(unsigned int value) {
 }
 
 void Quad::get_hexrepr(const Quad& q, char* const str) {
-  str[0] = (char)('A' + (q.u.comp.group >> 4)); // high end
-  str[1] = (char)('A' + (q.u.comp.group & 15));
-  str[2] = (char)('A' + (q.u.comp.plane >> 4));
-  str[3] = (char)('A' + (q.u.comp.plane & 15));
-  str[4] = (char)('A' + (q.u.comp.row   >> 4));
-  str[5] = (char)('A' + (q.u.comp.row   & 15));
-  str[6] = (char)('A' + (q.u.comp.cell  >> 4));
-  str[7] = (char)('A' + (q.u.comp.cell  & 15)); // low end
+  str[0] = static_cast<char>('A' + (q.u.comp.group >> 4)); // high end
+  str[1] = static_cast<char>('A' + (q.u.comp.group & 15));
+  str[2] = static_cast<char>('A' + (q.u.comp.plane >> 4));
+  str[3] = static_cast<char>('A' + (q.u.comp.plane & 15));
+  str[4] = static_cast<char>('A' + (q.u.comp.row   >> 4));
+  str[5] = static_cast<char>('A' + (q.u.comp.row   & 15));
+  str[6] = static_cast<char>('A' + (q.u.comp.cell  >> 4));
+  str[7] = static_cast<char>('A' + (q.u.comp.cell  & 15)); // low end
 }
 
 char* Quad::char_hexrepr(unsigned char c) {
   char hex[3];
   hex[2] = '\0';
-  hex[1] = (char)((c & 15) + 'A');
-  hex[0] = (char)((c >> 4) + 'A');
+  hex[1] = static_cast<char>((c & 15) + 'A');
+  hex[0] = static_cast<char>((c >> 4) + 'A');
   return mcopystr(hex);
 }
 
@@ -235,7 +235,7 @@ char* QuadInterval::generate_posix() {
                 Free(str);
                 q1.set(j, 0);
                 if (j > 0 && q1[j-1] < 255)
-                  q1.set(j - 1, (unsigned char)(q1[j-1] + 1));
+                  q1.set(j - 1, static_cast<unsigned char>(q1[j-1] + 1));
                 for (k = j + 1; k < 4; k++) {
                   res = mputprintf(res, "%s",
                     str = generate_hex_interval(0, 255));
@@ -251,8 +251,8 @@ char* QuadInterval::generate_posix() {
               res = mputstr(res, str = Quad::char_hexrepr(lower[j]));
               Free(str);
             }
-            str = generate_hex_interval((unsigned char)(lower[c] + 1),
-              (unsigned char)(lower[c] + diff[c] - 1));
+            str = generate_hex_interval(static_cast<unsigned char>(lower[c] + 1),
+              static_cast<unsigned char>(lower[c] + diff[c] - 1));
             res = mputprintf(res, "%s", str);
             Free(str);
             k = (3 - c) * 2;
@@ -274,7 +274,7 @@ char* QuadInterval::generate_posix() {
               }
               c++;
               if (c < 3)
-                q2.set(c, (unsigned char)(upper[c] - 1));
+                q2.set(c, static_cast<unsigned char>(upper[c] - 1));
               res = mputstr(res, str = generate_hex_interval(q1[c], q2[c]));
               Free(str);
               for (j = c + 1; j < 4; j++) {
@@ -328,14 +328,14 @@ char* QuadInterval::generate_hex_interval(unsigned char source,
     if (lo < 0) { // This is possibly reported during parsing.
       TTCN_pattern_error("Illegal interval in set: start > end.");
     } else if (lo > 0) {
-      res = mputc(res, (char)s_hi);
+      res = mputc(res, static_cast<char>(s_hi));
       if (s_lo == 'A' && d_lo == 'P')
         res = mputc(res, '.');
       else
         res = mputprintf(res, "[%c-%c]", s_lo, d_lo);
     } else {
-      res = mputc(res, (char)s_hi);
-      res = mputc(res, (char)s_lo);
+      res = mputc(res, static_cast<char>(s_hi));
+      res = mputc(res, static_cast<char>(s_lo));
     }
     return res;
   }
diff --git a/common/config_preproc.cc b/common/config_preproc.cc
index 4f0ab238d..40e21703f 100644
--- a/common/config_preproc.cc
+++ b/common/config_preproc.cc
@@ -32,7 +32,7 @@ void string_chain_add(string_chain_t **ec, char *s)
       i = i->next;
     }
   }
-  new_ec = (string_chain_t*) Malloc(sizeof(*new_ec));
+  new_ec = static_cast<string_chain_t*>( Malloc(sizeof(*new_ec)));
   new_ec->str = s;
   new_ec->next = NULL;
   if (i != NULL) i->next = new_ec;
@@ -85,11 +85,10 @@ const char* string_map_add(string_map_t *map, char *key,
   } else {
     /* creating a new entry */
     map->n++;
-    map->data = (string_keyvalue_t**)
-      Realloc(map->data, (map->n) * sizeof(*map->data));
+    map->data = static_cast<string_keyvalue_t**>(Realloc(map->data, (map->n) * sizeof(*map->data)));
     memmove(map->data + pos + 1, map->data + pos,
             (map->n - pos - 1) * sizeof(*map->data));
-    map->data[pos] = (string_keyvalue_t*)Malloc(sizeof(**map->data));
+    map->data[pos] = static_cast<string_keyvalue_t*>(Malloc(sizeof(**map->data)));
     map->data[pos]->key = key;
     map->data[pos]->value = value;
     map->data[pos]->value_len = value_len;
@@ -118,7 +117,7 @@ const char* string_map_get_bykey(const string_map_t *map,
 
 string_map_t* string_map_new(void)
 {
-  string_map_t *map=(string_map_t*)Malloc(sizeof(string_map_t));
+  string_map_t *map = static_cast<string_map_t*>(Malloc(sizeof(string_map_t)));
   map->n=0;
   map->data=NULL;
   return map;
diff --git a/common/memory.h b/common/memory.h
index e4815d933..55c0066ea 100644
--- a/common/memory.h
+++ b/common/memory.h
@@ -287,9 +287,9 @@ extern "C" {
 #ifdef __cplusplus
   /** Convert a patch level to the "Ericsson letter" */
   inline char eri(unsigned int p) { /* p stands for patch level */
-    char   i = (char)('A' + p); /* i stands for "if only it was that simple" */
+    char   i = static_cast<char>('A' + p); /* i stands for "if only it was that simple" */
     const int result = i + (i >= 'I') + 4 * (i >= 'N') + (i >= 'R');
-    return (char)result; /*check: does not overflow*/
+    return static_cast<char>(result); /*check: does not overflow*/
   }
 
 } /* extern "C" */
diff --git a/common/new.cc b/common/new.cc
index 5ceac3738..416ebb1bb 100644
--- a/common/new.cc
+++ b/common/new.cc
@@ -36,7 +36,7 @@ void operator delete(void *ptr) throw()
 
 void operator delete[](void *ptr) throw()
 {
-    if (ptr != (void*)&dummy) Free(ptr);
+    if (ptr != static_cast<void*>(&dummy)) Free(ptr);
 }
 
 /**************************************************************************/
diff --git a/common/pattern_la.l b/common/pattern_la.l
index 70f6586f6..be381a854 100644
--- a/common/pattern_la.l
+++ b/common/pattern_la.l
@@ -213,12 +213,12 @@ NUMBER 0|([1-9][0-9]*)
 
  /* invalid escape sequences */
 "\\"(.|"\n") {
-  if (isprint((unsigned char)yytext[1]))
+  if (isprint(static_cast<unsigned char>(yytext[1])))
     TTCN_pattern_warning("Use of unrecognized escape sequence `\\%c' is "
       "deprecated.", yytext[1]);
   else TTCN_pattern_warning("Use of unrecognized escape sequence `\\' + "
-    "character code %u (0x%02X) is deprecated.", (unsigned char)yytext[1],
-    (unsigned char)yytext[1]);
+    "character code %u (0x%02X) is deprecated.", static_cast<unsigned char>(yytext[1]),
+    static_cast<unsigned char>(yytext[1]));
   yylval.c = yytext[1];
   return TOK_Char;
 }
@@ -239,30 +239,30 @@ NUMBER 0|([1-9][0-9]*)
  /* erroneous characters */
 
 <SC_Hash>.|\n {
-  if (isprint((unsigned char)yytext[0]))
+  if (isprint(static_cast<unsigned char>(yytext[0])))
     TTCN_pattern_error("A digit or `(' was expected after `#' instead of "
       "character `%c'.", yytext[0]);
   else TTCN_pattern_error("A digit or `(' was expected after `#' instead of "
-    "character with code %u (0x%02X).", (unsigned char)yytext[0],
-    (unsigned char)yytext[0]);
+    "character with code %u (0x%02X).", static_cast<unsigned char>(yytext[0]),
+    static_cast<unsigned char>(yytext[0]));
 }
 
 <SC_HashParen>. {
-  if (isprint((unsigned char)yytext[0]))
+  if (isprint(static_cast<unsigned char>(yytext[0])))
     TTCN_pattern_error("A number, `,' or `)' was expected after `#(' instead "
       "of character `%c'.", yytext[0]);
   else TTCN_pattern_error("A number, `,' or `)' was expected after `#(' "
-    "instead of character with code %u (0x%02X).", (unsigned char)yytext[0],
-    (unsigned char)yytext[0]);
+    "instead of character with code %u (0x%02X).", static_cast<unsigned char>(yytext[0]),
+    static_cast<unsigned char>(yytext[0]));
 }
 
 <SC_Quadruple,SC_Quadruple_Set>. {
-  if (isprint((unsigned char)yytext[0]))
+  if (isprint(static_cast<unsigned char>(yytext[0])))
     TTCN_pattern_error("A number, `,' or `}' was expected after `\\q{' "
       "instead of character `%c'.", yytext[0]);
   else TTCN_pattern_error("A number, `,' or `}' was expected after `\\q{' "
-    "instead of character with code %u (0x%02X).", (unsigned char)yytext[0],
-    (unsigned char)yytext[0]);
+    "instead of character with code %u (0x%02X).", static_cast<unsigned char>(yytext[0]),
+    static_cast<unsigned char>(yytext[0]));
 }
 
 %%
diff --git a/common/pattern_p.y b/common/pattern_p.y
index d09c03e0e..2387760c2 100644
--- a/common/pattern_p.y
+++ b/common/pattern_p.y
@@ -489,7 +489,7 @@ RE_Set:
     if (']' > $3) {
       TTCN_pattern_error("Invalid range `%s' in the character set: the "
 	"character code of the lower bound (%u) is higher than that of the "
-	"upper bound (%u).", range_str, ']', (unsigned char)$3);
+	"upper bound (%u).", range_str, ']', static_cast<unsigned char>($3));
     } else {
       if (set_has_range($$, ']', $3)) {
 	character_set *tmpset = set_init();
@@ -550,7 +550,7 @@ RE_Set_Elem:
       char *range_str = print_range($1, $3);
       TTCN_pattern_error("Invalid range `%s' in the character set: the "
 	"character code of the lower bound (%u) is higher than that of the "
-	"upper bound (%u).", range_str, (unsigned char)$1, (unsigned char)$3);
+	"upper bound (%u).", range_str, static_cast<unsigned char>($1), static_cast<unsigned char>($3));
       Free(range_str);
     }
     $$ = set_init();
@@ -715,8 +715,8 @@ char *print_character(char c)
   case '\r':
     return mcopystr("\\r");
   default:
-    if (isprint((unsigned char)c)) return mprintf("%c", c);
-    else return mprintf("\\q{0,0,0,%u}", (unsigned char)c);
+    if (isprint(static_cast<unsigned char>(c))) return mprintf("%c", c);
+    else return mprintf("\\q{0,0,0,%u}", static_cast<unsigned char>(c));
   }
 }
 
@@ -739,14 +739,14 @@ struct character_set {
 
 character_set *set_init()
 {
-  character_set *set = (character_set*)Malloc(sizeof(*set));
+  character_set *set = static_cast<character_set*>(Malloc(sizeof(*set)));
   memset(set->set_members, 0, sizeof(set->set_members));
   return set;
 }
 
 character_set *set_copy(const character_set *set)
 {
-  character_set *set2 = (character_set*)Malloc(sizeof(*set2));
+  character_set *set2 = static_cast<character_set*>(Malloc(sizeof(*set2)));
   memcpy(set2, set, sizeof(*set2));
   return set2;
 }
@@ -791,7 +791,7 @@ void set_remove_char(character_set *set, char c)
 
 int set_has_range(const character_set *set, char lower, char upper)
 {
-  for (size_t i = lower; i <= (unsigned char)upper; i++)
+  for (size_t i = lower; i <= static_cast<unsigned char>(upper); i++)
     if (set->set_members[i / CS_BITS_PER_ELEM] & 1UL << i % CS_BITS_PER_ELEM)
       return 1;
   return 0;
@@ -799,7 +799,7 @@ int set_has_range(const character_set *set, char lower, char upper)
 
 void set_add_range(character_set *set, char lower, char upper)
 {
-  for (size_t i = lower; i <= (unsigned char)upper; i++)
+  for (size_t i = lower; i <= static_cast<unsigned char>(upper); i++)
     set->set_members[i / CS_BITS_PER_ELEM] |= 1UL << i % CS_BITS_PER_ELEM;
 }
 
diff --git a/common/pattern_uni.y b/common/pattern_uni.y
index c981cc989..e2a8e5967 100644
--- a/common/pattern_uni.y
+++ b/common/pattern_uni.y
@@ -449,10 +449,10 @@ RE_Set:
       $$ = $4;
     else
       $$ = new QuadSet();
-    if ((unsigned int)']' > $3.value) {
+    if (static_cast<unsigned int>(']') > $3.value) {
       TTCN_pattern_error("Invalid range in the character set: the "
         "character code of the lower bound (%u) is higher than that of the "
-        "upper bound (%u).", ']', (unsigned int)$3.value);
+        "upper bound (%u).", ']', static_cast<unsigned int>($3.value));
     }
     $$->add(new QuadInterval(Quad(']'), Quad($3.value)));
     if ($5) {
@@ -504,7 +504,7 @@ RE_Set_Elem:
     if ($1.value > $3.value) {
       TTCN_pattern_error("Invalid range in the character set: the "
         "character code of the lower bound (%u) is higher than that of the "
-        "upper bound (%u).", (unsigned int)$1.value, (unsigned int)$3.value);
+        "upper bound (%u).", static_cast<unsigned int>($1.value), static_cast<unsigned int>($3.value));
     }
     $$ = new QuadSet();
     $$->add(new QuadInterval(Quad($1.value), Quad($3.value)));
@@ -574,10 +574,10 @@ RE_Quadruple:
     if ($3 == 0 && $5 == 0 && $7 == 0 && $9 == 0) TTCN_pattern_error("Zero "
       "character (i.e. quadruple `\\q{0,0,0,0}') is not supported in a "
       "pattern for type universal charstring.");
-    $$.comp.group = (unsigned char)$3;
-    $$.comp.plane = (unsigned char)$5;
-    $$.comp.row = (unsigned char)$7;
-    $$.comp.cell = (unsigned char)$9;
+    $$.comp.group = static_cast<unsigned char>($3);
+    $$.comp.plane = static_cast<unsigned char>($5);
+    $$.comp.row = static_cast<unsigned char>($7);
+    $$.comp.cell = static_cast<unsigned char>($9);
   }
 ;
 
@@ -611,7 +611,7 @@ char* TTCN_pattern_to_regexp_uni(const char* p_pattern, bool p_nocase, int** gro
   // needed by regexp to find user specified groups
   if (user_groups /*&& groups*/) {
     if (groups) {
-      *groups = (int*)Malloc(sizeof(int) * (user_groups + 1));
+      *groups = static_cast<int*>(Malloc(sizeof(int) * (user_groups + 1)));
       (*groups)[0] = user_groups;
     }
 
@@ -627,7 +627,7 @@ char* TTCN_pattern_to_regexp_uni(const char* p_pattern, bool p_nocase, int** gro
       }
     }
   } else if (groups)
-    *groups = (int*)0;
+    *groups = static_cast<int*>(0);
 
   return ret_val;
 }
-- 
GitLab