compiler warnings
authorhgn <hgodden00@gmail.com>
Fri, 3 Nov 2023 15:05:53 +0000 (15:05 +0000)
committerhgn <hgodden00@gmail.com>
Fri, 3 Nov 2023 15:05:53 +0000 (15:05 +0000)
vg_msg.h
vg_platform.h

index f0c8d2562db10ee9325887a81315a2a46333dd61..a41b24c1e914712617c6d6042085b08c99795fdb 100644 (file)
--- a/vg_msg.h
+++ b/vg_msg.h
@@ -314,6 +314,7 @@ static void vg_msg_init( vg_msg *msg, u8 *buffer, u32 len ){
  * must be handled in this function */
 static int vg_msg_next( vg_msg *msg, vg_msg_cmd *cmd ){
    vg_msg_rbuf( msg, &cmd->code, 1 );
+   if( msg->error != k_vg_msg_error_OK ) return 0;
 
 #ifdef VG_MSG_V1_SUPPORT
   /* |sized|  |count-1| |shift|
@@ -638,10 +639,24 @@ static void vg_msg_print( vg_msg *msg, u32 len ){
             for( u32 i=0; i<count; i++ ){
                const void *p = cmd.value + size*i;
 
-               if( base == k_vg_msg_unsigned )
-                  printf( "%lu", vg_msg_cast_to_u64( p, base, size ) );
-               else if( base == k_vg_msg_signed )
-                  printf( "%ld", vg_msg_cast_to_i64( p, base, size ) );
+               if( base == k_vg_msg_unsigned ){
+                  printf( 
+#ifdef _WIN32
+                  "%llu"
+#else
+                  "%lu"
+#endif
+                  , vg_msg_cast_to_u64( p, base, size ) );
+               }
+               else if( base == k_vg_msg_signed ){
+                  printf(
+#ifdef _WIN32
+                  "%lld"
+#else
+                  "%ld"
+#endif
+                  , vg_msg_cast_to_i64( p, base, size ) );
+               }
                else 
                   printf( "%f", vg_msg_cast_to_f64( p, base, size ));
 
index aa4175d5f214dc832d21f92c22c4aecca0c23170..8bdd0991b8e245537120989774b378aa0549b50a 100644 (file)
@@ -101,7 +101,7 @@ static void vg_strcat( vg_str *str, const char *append ){
    }
 
    /* overflow */
-   str->buffer[ str->i ] = '\0';
+   str->buffer[ str->len-1 ] = '\0';
    str->i = -1;
 }