Explicit conversions and minor changes to prevent MSVC compiler warnings
diff --git a/library/ecp.c b/library/ecp.c
index b7af16a..d3880be 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -442,7 +442,7 @@
     /*
      * write length to the first byte and update total length
      */
-    buf[0] = *olen;
+    buf[0] = (unsigned char) *olen;
     ++*olen;
 
     return 0;
@@ -1427,7 +1427,7 @@
 {
     int ret;
     unsigned char w, m_is_odd, p_eq_g;
-    size_t pre_len, naf_len, i, j;
+    size_t pre_len = 1, naf_len, i, j;
     signed char naf[ MAX_NAF_LEN ];
     ecp_point Q, *T = NULL, S[2];
     mpi M;
@@ -1469,7 +1469,7 @@
     if( w < 2 || w >= grp->nbits )
         w = 2;
 
-    pre_len = 1 << ( w - 1 );
+    pre_len <<= ( w - 1 );
     naf_len = grp->nbits / w + 1;
 
     /*
@@ -1478,7 +1478,8 @@
      */
     if( ! p_eq_g || grp->T == NULL )
     {
-        if( ( T = polarssl_malloc( pre_len * sizeof( ecp_point ) ) ) == NULL )
+        T = (ecp_point *) polarssl_malloc( pre_len * sizeof( ecp_point ) );
+        if( T == NULL )
         {
             ret = POLARSSL_ERR_ECP_MALLOC_FAILED;
             goto cleanup;