~ubuntu-branches/ubuntu/oneiric/libinfinity/oneiric

« back to all changes in this revision

Viewing changes to libinfinity/adopted/inf-adopted-state-vector.c

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Kern
  • Date: 2009-12-22 00:04:27 UTC
  • mfrom: (1.2.2 upstream) (1.4.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091222000427-8iyupvgjy3gkle3w
Tags: 0.4.0-2
Fix up infinoted alternative in infinoted-0.4's postinst.
(Closes: #562002)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *
14
14
 * You should have received a copy of the GNU Lesser General Public
15
15
 * License along with this library; if not, write to the Free
16
 
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
16
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 
17
 * MA 02110-1301, USA.
17
18
 */
18
19
 
19
20
/**
722
723
{
723
724
  InfAdoptedStateVector* vec;
724
725
  const char* strpos;
 
726
  char* endpos;
725
727
  gsize pos;
726
728
  guint id;
727
729
  guint n;
733
735
 
734
736
  while(*strpos)
735
737
  {
736
 
    id = strtoul(strpos, (char**)&strpos, 10);
737
 
    if(*strpos != ':')
 
738
    id = strtoul(strpos, &endpos, 10);
 
739
    if(*endpos != ':')
738
740
    {
739
741
      g_set_error(
740
742
        error,
741
743
        inf_adopted_state_vector_error_quark(),
742
744
        INF_ADOPTED_STATE_VECTOR_BAD_FORMAT,
 
745
        "%s",
743
746
        _("Expected ':' after ID")
744
747
      );
745
748
 
762
765
      return NULL;
763
766
    }
764
767
 
765
 
    ++ strpos; /* step over ':' */
766
 
    n = strtoul(strpos, (char**)&strpos, 10);
 
768
    strpos = endpos + 1; /* step over ':' */
 
769
    n = strtoul(strpos, &endpos, 10);
767
770
 
768
 
    if(*strpos != ';' && *strpos != '\0')
 
771
    if(*endpos != ';' && *endpos != '\0')
769
772
    {
770
773
      g_set_error(
771
774
        error,
780
783
    }
781
784
 
782
785
    inf_adopted_state_vector_insert(vec, id, n, pos);
 
786
    strpos = endpos;
783
787
    if(*strpos != '\0') ++ strpos; /* step over ';' */
784
788
  }
785
789