use sscanf with the correct type conversion and not atoi/atol to load nframes_t and...
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 4 Jul 2009 23:09:50 +0000 (23:09 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 4 Jul 2009 23:09:50 +0000 (23:09 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5324 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc
libs/ardour/location.cc

index 0865854cf98afc0a67d4fd633f20ddd477fee1f3..55c1b1a7eba8318d3e75dfc3ef7917c4e43de2ef 100644 (file)
@@ -2418,7 +2418,8 @@ Editor::set_state (const XMLNode& node)
        move (x, y);
 
        if (session && (prop = node.property ("playhead"))) {
-               nframes64_t pos = atol (prop->value().c_str());
+               nframes64_t pos;
+               sscanf (prop->value().c_str(), "%" PRIi64, &pos);
                playhead_cursor->set_position (pos);
        } else {
                playhead_cursor->set_position (0);
index 103074511ce17aa97e03aa63f8e72993c6d0f64d..6bd10ca27a3e59333f9d76efecc2af36d821bbd0 100644 (file)
@@ -375,15 +375,15 @@ Location::set_state (const XMLNode& node)
                /* can't use set_start() here, because _end
                   may make the value of _start illegal.
                */
-               
-       _start = atoi (prop->value().c_str());
+
+       sscanf (prop->value().c_str(), "%" PRIu32, &_start);
 
        if ((prop = node.property ("end")) == 0) {
                  error << _("XML node for Location has no end information") << endmsg; 
                  return -1;
        }
                
-       _end = atoi (prop->value().c_str());
+       sscanf (prop->value().c_str(), "%" PRIu32, &_end);
                
        if ((prop = node.property ("flags")) == 0) {
                  error << _("XML node for Location has no flags information") << endmsg; 
@@ -403,19 +403,19 @@ Location::set_state (const XMLNode& node)
                  cd_node = *cd_iter;
                  
                  if (cd_node->name() != "CD-Info") {
-                   continue;
+                         continue;
                  }
                  
                  if ((prop = cd_node->property ("name")) != 0) {
-                   cd_name = prop->value();
+                         cd_name = prop->value();
                  } else {
-                   throw failed_constructor ();
+                         throw failed_constructor ();
                  }
                  
                  if ((prop = cd_node->property ("value")) != 0) {
-                   cd_value = prop->value();
+                         cd_value = prop->value();
                  } else {
-                   throw failed_constructor ();
+                         throw failed_constructor ();
                  }