(file) Return to helpers.c CVS log (file) (dir) Up to [OMI] / omi / base

Diff for /omi/base/helpers.c between version 1.3 and 1.4

version 1.3, 2015/04/20 18:19:49 version 1.4, 2015/09/25 20:24:20
Line 27 
Line 27 
 #include "types.h" #include "types.h"
 #include <pal/strings.h> #include <pal/strings.h>
 #include "alloc.h" #include "alloc.h"
   #include <pal/intsafe.h>
 #include <pal/format.h> #include <pal/format.h>
 #include "class.h" #include "class.h"
 #include "base64.h" #include "base64.h"
Line 920 
Line 921 
  
     if( *str == NULL ) // This is the first time we are called     if( *str == NULL ) // This is the first time we are called
     {     {
           size_t allocSize = 0;
           if (SizeTAdd(size, 4, &allocSize) == S_OK &&
               SizeTMult(allocSize, sizeof(unsigned char), &allocSize) == S_OK)
           {
         // prepend length in 4 bytes         // prepend length in 4 bytes
         *str = (char*)PAL_Malloc((size + 4) * sizeof(unsigned char));              *str = (char*)PAL_Malloc(allocSize);
           }
           else
           {
               // Overflow
               return -1;
           }
  
         if (!*str)         if (!*str)
             return -1;             return -1;
Line 937 
Line 948 
         totalSize = p1 + p2 + p3 + p4;         totalSize = p1 + p2 + p3 + p4;
         skipSize = totalSize;         skipSize = totalSize;
         totalSize += size;         totalSize += size;
         newStr = (char*)PAL_Malloc(totalSize * sizeof(unsigned char));          size_t allocSize = 0;
           if (SizeTMult(totalSize, sizeof(unsigned char), &allocSize) == S_OK)
           {
               newStr = (char*)PAL_Malloc(allocSize);
           }
   
         if (!newStr)         if (!newStr)
         {         {
             PAL_Free(arr->data);             PAL_Free(arr->data);


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

ViewCVS 0.9.2