version reorg, precedence patch for stat check
authorjhurst <jhurst@cinecert.com>
Tue, 20 May 2008 22:40:09 +0000 (22:40 +0000)
committerjhurst <>
Tue, 20 May 2008 22:40:09 +0000 (22:40 +0000)
configure.ac
src/AS_DCP.cpp
src/AS_DCP.h
src/KM_fileio.cpp
src/asdcp-test.cpp
src/h__Writer.cpp

index e41af9cb6366bcb02b8c0c3ca0cc597d3ada2d7c..f65642f9cbda04ea800a730871ccf0f0bd9a0ad7 100644 (file)
@@ -5,7 +5,17 @@ AC_PREREQ([2.59])
 # If you change this, you should update the libtool version number specified
 # in src/Makefile.am. Read <http://www.gnu.org/software/libtool/manual.html#Versioning>
 # for suggestions on doing so.
+
+# The version number consists of three segments: major, API minor, and
+# implementation minor. Whenever a change is made to AS_DCP.h, the API minor
+# version will increment. Changes made to the internal implementation will
+# result in the incrementing of the implementation minor version.
+#
+# For example, if asdcplib version 1.0.0 were modified to accomodate changes
+# in file format, and if no changes were made to AS_DCP.h, the new version would be
+# 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
 AC_INIT([asdcplib], [1.3.19], [asdcplib@cinecert.com])
+
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/KM_error.h])
 #AC_CONFIG_HEADER([src/config.h])
index 10d5c666f451c436685f40abb42be1625892b0c9..9bb8dd55fb3b0f30cfadbccc904b12599e94cd22 100755 (executable)
@@ -35,9 +35,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 const char*
 ASDCP::Version()
 {
-  static char ver[16];
-  snprintf(ver, 16, "%u.%u.%u", VERSION_MAJOR, VERSION_APIMINOR, VERSION_IMPMINOR);
-  return ver;
+  return PACKAGE_VERSION;
 }
 
 
index e03557ad49e86f545c7b005d0d079004e9be67c1..bda4c1359808a7fc299e70e611cd0900495d6736 100755 (executable)
@@ -146,17 +146,8 @@ typedef unsigned int   ui32_t;
 // All library components are defined in the namespace ASDCP
 //
 namespace ASDCP {
-  // The version number consists of three segments: major, API minor, and
-  // implementation minor. Whenever a change is made to AS_DCP.h, the API minor
-  // version will increment. Changes made to the internal implementation will
-  // result in the incrementing of the implementation minor version.
-
-  // For example, if asdcplib version 1.0.0 were modified to accomodate changes
-  // in file format, and if no changes were made to AS_DCP.h, the new version would be
-  // 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
-  const ui32_t VERSION_MAJOR = 1;
-  const ui32_t VERSION_APIMINOR = 3;
-  const ui32_t VERSION_IMPMINOR = 19;
+  //
+  // The version number declaration and explanation have moved to ../configure.ac
   const char* Version();
 
   // UUIDs are passed around as strings of UUIDlen bytes
index 5a56c44cd09890c8831f4f4500e59c9e651f8844..918a852ad334d5479576e815f2b1ac3a168c84f2 100644 (file)
@@ -103,7 +103,7 @@ do_stat(const char* path, fstat_t* stat_info)
   if ( stat(path, stat_info) == -1L )
     result = Kumu::RESULT_FILEOPEN;
 
-  if ( stat_info->st_mode & (S_IFREG|S_IFLNK|S_IFDIR) == 0 )
+  if ( (stat_info->st_mode & (S_IFREG|S_IFLNK|S_IFDIR)) == 0 )
     result = Kumu::RESULT_FILEOPEN;
 #endif
 
@@ -123,7 +123,7 @@ do_fstat(HANDLE handle, fstat_t* stat_info)
   if ( fstat(handle, stat_info) == -1L )
     result = Kumu::RESULT_FILEOPEN;
 
-  if ( stat_info->st_mode & (S_IFREG|S_IFLNK|S_IFDIR) == 0 )
+  if ( (stat_info->st_mode & (S_IFREG|S_IFLNK|S_IFDIR)) == 0 )
     result = Kumu::RESULT_FILEOPEN;
 
   return result;
index c77cd8913d44775955d0574589b887aedc84263c..daa8b4fdf973f88dc0760ac1ca2f481e94f3377b 100755 (executable)
@@ -83,10 +83,7 @@ public:
       memcpy(ProductUUID, default_ProductUUID_Data, UUIDlen);
       CompanyName = "WidgetCo";
       ProductName = "asdcp-test";
-
-      char s_buf[128];
-      snprintf(s_buf, 128, "%u.%u.%u", VERSION_MAJOR, VERSION_APIMINOR, VERSION_IMPMINOR);
-      ProductVersion = s_buf;
+      ProductVersion = ASDCP::Version();
   }
 } s_MyInfo;
 
index 451796654be01e5e0acd649aed43549015cdbf0e..fb66b68e340a80d5a2ec60cce4c0d02c906a4364 100755 (executable)
@@ -41,6 +41,31 @@ using namespace ASDCP::MXF;
 #endif
 
 
+static std::vector<int>
+version_split(const char* str)
+{
+  std::vector<int> result;
+
+  const char* pstr = str;
+  const char* r = strchr(pstr, '.');
+
+  while ( r != 0 )
+    {
+      assert(r >= pstr);
+      if ( r > pstr )
+       result.push_back(atoi(pstr));
+
+      pstr = r + 1;
+      r = strchr(pstr, '.');
+    }
+
+  if( strlen(pstr) > 0 )
+    result.push_back(atoi(pstr));
+
+  assert(result.size() == 3);
+  return result;
+}
+
 
 //
 ASDCP::h__Writer::h__Writer() :
@@ -124,9 +149,12 @@ ASDCP::h__Writer::InitHeader()
   Ident->VersionString = m_Info.ProductVersion.c_str();
   Ident->ProductUID.Set(m_Info.ProductUUID);
   Ident->Platform = ASDCP_PLATFORM;
-  Ident->ToolkitVersion.Major = VERSION_MAJOR;
-  Ident->ToolkitVersion.Minor = VERSION_APIMINOR;
-  Ident->ToolkitVersion.Patch = VERSION_IMPMINOR;
+
+  std::vector<int> version = version_split(Version());
+
+  Ident->ToolkitVersion.Major = version[0];
+  Ident->ToolkitVersion.Minor = version[1];
+  Ident->ToolkitVersion.Patch = version[2];
   Ident->ToolkitVersion.Build = ASDCP_BUILD_NUMBER;
   Ident->ToolkitVersion.Release = VersionType::RL_RELEASE;
 }