Apply clang-11 fixes for fileio
[alexxy/gromacs.git] / src / gromacs / fileio / tpxio.cpp
index d3dde6a33895f66c75724fc9af77a7a239f8e33a..6109039cd599fde116a70ec26723b7b2858be90f 100644 (file)
@@ -95,7 +95,7 @@
  * merging with mainstream GROMACS, set this tag string back to
  * TPX_TAG_RELEASE, and instead add an element to tpxv.
  */
-static const char* tpx_tag = TPX_TAG_RELEASE;
+static const std::string tpx_tag = TPX_TAG_RELEASE;
 
 /*! \brief Enum of values that describe the contents of a tpr file
  * whose format matches a version number
@@ -2719,7 +2719,7 @@ static void do_tpxheader(gmx::FileIOXdrSerializer* serializer,
         serializer->doString(&buf);
         gmx_fio_setprecision(fio, tpx->isDouble);
         serializer->doInt(&precision);
-        fileTag = gmx::formatString("%s", tpx_tag);
+        fileTag = tpx_tag;
     }
 
     /* Check versions! */
@@ -2751,7 +2751,7 @@ static void do_tpxheader(gmx::FileIOXdrSerializer* serializer,
 
         if (fileTag != tpx_tag)
         {
-            fprintf(stderr, "Note: file tpx tag '%s', software tpx tag '%s'\n", fileTag.c_str(), tpx_tag);
+            fprintf(stderr, "Note: file tpx tag '%s', software tpx tag '%s'\n", fileTag.c_str(), tpx_tag.c_str());
 
             /* We only support reading tpx files with the same tag as the code
              * or tpx files with the release tag and with lower version number.
@@ -2765,7 +2765,7 @@ static void do_tpxheader(gmx::FileIOXdrSerializer* serializer,
                           tpx->fileVersion,
                           fileTag.c_str(),
                           tpx_version,
-                          tpx_tag);
+                          tpx_tag.c_str());
             }
         }
     }