Fix compiler warnings

No functional changes

Change-Id: I938fecc941b14c065639e27a110ab1feb7c85ba9
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
diff --git a/include/tosa_serialization_handler.h b/include/tosa_serialization_handler.h
index e5448bc..41032fc 100644
--- a/include/tosa_serialization_handler.h
+++ b/include/tosa_serialization_handler.h
@@ -1,5 +1,5 @@
 
-// Copyright (c) 2020-2023, ARM Limited.
+// Copyright (c) 2020-2024, ARM Limited.
 //
 //    Licensed under the Apache License, Version 2.0 (the "License");
 //    you may not use this file except in compliance with the License.
@@ -184,7 +184,7 @@
     {
         return _data;
     }
-    const bool GetIsUnranked() const
+    bool GetIsUnranked() const
     {
         return _is_unranked;
     }
@@ -216,7 +216,7 @@
     }
     void SetDimSize(size_t dim, uint32_t new_size)
     {
-        if (dim < 0 || dim >= _shape.size())
+        if (dim >= _shape.size())
         {
             printf("dim is out of bound\n");
             assert(0);
diff --git a/src/numpy_utils.cpp b/src/numpy_utils.cpp
index 64460bd..5fe0490 100644
--- a/src/numpy_utils.cpp
+++ b/src/numpy_utils.cpp
@@ -1,5 +1,5 @@
 
-// Copyright (c) 2020-2023, ARM Limited.
+// Copyright (c) 2020-2024, ARM Limited.
 //
 //    Licensed under the Apache License, Version 2.0 (the "License");
 //    you may not use this file except in compliance with the License.
@@ -16,14 +16,13 @@
 #include "numpy_utils.h"
 #include "half.hpp"
 #include <algorithm>
+#include <memory>
 
 // Magic NUMPY header
 static const char NUMPY_HEADER_STR[] = "\x93NUMPY\x1\x0\x76\x0{";
 static const int NUMPY_HEADER_SZ     = 128;
 // Maximum shape dimensions supported
 static const int NUMPY_MAX_DIMS_SUPPORTED = 10;
-// Offset for NUMPY header desc dictionary string
-static const int NUMPY_HEADER_DESC_OFFSET = 8;
 
 // This is an entry function for reading 8-/16-/32-bit npy file.
 template <>
@@ -55,14 +54,14 @@
                 int8_t* tmp_buf = new int8_t[elems];
                 rc              = readFromNpyFile<int8_t>(filename, elems, tmp_buf);
                 copyBufferByElement(databuf, tmp_buf, elems);
-                free(tmp_buf);
+                delete[] tmp_buf;
             }
             else
             {
                 uint8_t* tmp_buf = new uint8_t[elems];
                 rc               = readFromNpyFile<uint8_t>(filename, elems, tmp_buf);
                 copyBufferByElement(databuf, tmp_buf, elems);
-                free(tmp_buf);
+                delete[] tmp_buf;
             }
             break;
         case 2:
@@ -71,14 +70,14 @@
                 int16_t* tmp_buf = new int16_t[elems];
                 rc               = readFromNpyFile<int16_t>(filename, elems, tmp_buf);
                 copyBufferByElement(databuf, tmp_buf, elems);
-                free(tmp_buf);
+                delete[] tmp_buf;
             }
             else
             {
                 uint16_t* tmp_buf = new uint16_t[elems];
                 rc                = readFromNpyFile<uint16_t>(filename, elems, tmp_buf);
                 copyBufferByElement(databuf, tmp_buf, elems);
-                free(tmp_buf);
+                delete[] tmp_buf;
             }
             break;
         case 4:
@@ -168,7 +167,6 @@
     {
         return HEADER_PARSE_ERROR;
     }
-    char* ptr;
 
     // Validate the numpy magic number
     if (memcmp(buf, NUMPY_HEADER_STR, sizeof(NUMPY_HEADER_STR) - 1))
diff --git a/test/src/serialization_npy_test.cpp b/test/src/serialization_npy_test.cpp
index 64536fb..24e3aff 100644
--- a/test/src/serialization_npy_test.cpp
+++ b/test/src/serialization_npy_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2021, ARM Limited.
+// Copyright (c) 2021,2024, ARM Limited.
 //
 //    Licensed under the Apache License, Version 2.0 (the "License");
 //    you may not use this file except in compliance with the License.
@@ -37,7 +37,7 @@
     }
 
     auto buffer = std::make_unique<T[]>(total_size);
-    for (int i = 0; i < total_size; i++)
+    for (size_t i = 0; i < total_size; i++)
     {
         buffer[i] = gen_data(gen);
     }
@@ -76,7 +76,7 @@
     }
 
     auto buffer = std::make_unique<T[]>(total_size);
-    for (int i = 0; i < total_size; i++)
+    for (size_t i = 0; i < total_size; i++)
     {
         buffer[i] = gen_data(gen);
     }
@@ -115,7 +115,7 @@
     }
 
     auto buffer = std::make_unique<T[]>(total_size);
-    for (int i = 0; i < total_size; i++)
+    for (size_t i = 0; i < total_size; i++)
     {
         buffer[i] = gen_data(gen);
     }
@@ -153,7 +153,7 @@
     }
 
     auto buffer = std::make_unique<bool[]>(total_size);
-    for (int i = 0; i < total_size; i++)
+    for (size_t i = 0; i < total_size; i++)
     {
         buffer[i] = (gen_data(gen)) ? true : false;
     }
@@ -183,15 +183,13 @@
 
 int main(int argc, char** argv)
 {
-    size_t total_size = 1;
-    int32_t seed      = 1;
+    int32_t seed = 1;
     std::string str_type;
     std::string str_shape;
     std::string filename = "npytest.npy";
     std::vector<int32_t> shape;
-    bool verbose = false;
     int opt;
-    while ((opt = getopt(argc, argv, "d:f:s:t:v")) != -1)
+    while ((opt = getopt(argc, argv, "d:f:s:t:")) != -1)
     {
         switch (opt)
         {
@@ -207,9 +205,6 @@
             case 't':
                 str_shape = optarg;
                 break;
-            case 'v':
-                verbose = true;
-                break;
             default:
                 std::cerr << "Invalid argument" << std::endl;
                 break;
@@ -232,7 +227,6 @@
             break;
         int val = stoi(substr, &pos, 0);
         assert(val);
-        total_size *= val;
         shape.push_back(val);
     }