Diff for /libelwix/src/str.c between versions 1.8 and 1.9

version 1.8, 2018/05/31 15:35:16 version 1.9, 2019/01/23 13:26:28
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004 - 2018Copyright 2004 - 2019
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 285  str_Dig2Hex(ait_val_t *digz) Line 285  str_Dig2Hex(ait_val_t *digz)
                 memset(str, 0, AIT_LEN(digz) * 2 + 1);                  memset(str, 0, AIT_LEN(digz) * 2 + 1);
   
         for (i = 0, b = AIT_GET_BUF(digz); i < AIT_LEN(digz); i++) {          for (i = 0, b = AIT_GET_BUF(digz); i < AIT_LEN(digz); i++) {
                   snprintf(szWork, sizeof szWork, "%02hhX", b[i]);
                   strncat(str, szWork, 2);
           }
   
           return str;
   }
   
   /*
    * str_Dig2Hex2() - Convert from digit array to Hex string
    *
    * @digz = Digits array
    * @diglen = Array length
    * return: NULL nothing to do or error; 
    *              !=0 Allocated new converted string (must be e_free())
   */
   char *
   str_Dig2Hex2(u_char * __restrict digz, int diglen)
   {
           register int i;
           char szWork[3] = { 0, 0, 0 }, *str;
           u_char *b;
   
           if (!digz || !diglen)
                   return NULL;
   
           str = e_malloc(diglen * 2 + 1);
           if (!str)
                   return NULL;
           else
                   memset(str, 0, diglen * 2 + 1);
   
           for (i = 0, b = digz; i < diglen; i++) {
                 snprintf(szWork, sizeof szWork, "%02hhX", b[i]);                  snprintf(szWork, sizeof szWork, "%02hhX", b[i]);
                 strncat(str, szWork, 2);                  strncat(str, szWork, 2);
         }          }

Removed from v.1.8  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>