--- liblscp/trunk/src/common.c 2005/02/13 17:20:46 378 +++ liblscp/trunk/src/common.c 2005/03/02 16:25:27 419 @@ -2,7 +2,7 @@ // /**************************************************************************** liblscp - LinuxSampler Control Protocol API - Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -329,9 +329,9 @@ --pch; *pch = (char) 0; // Make it official. - ppszSplit[i++] = lscp_unquote(&pszHead, 0); + ppszSplit[i] = lscp_unquote(&pszHead, 0); // Do we need to grow? - if (i >= iSize) { + if (++i >= iSize) { // Yes, but only grow in chunks. iSize += LSCP_SPLIT_CHUNK1; // Allocate and copy to new split array. @@ -396,7 +396,7 @@ pchHead = lscp_ltrim((char *) pszCsv); if (*pchHead == (char) 0) return NULL; - + // Initial size is one chunk away. iSize = LSCP_SPLIT_CHUNK1; // Allocate and split... @@ -417,9 +417,9 @@ // Pre-advance to next item. pchHead = pch + cchSeps; // Make it official. - piSplit[i++] = atoi(pchHead); + piSplit[i] = atoi(pchHead); // Do we need to grow? - if (i >= iSize) { + if (++i >= iSize) { // Yes, but only grow in chunks. iSize += LSCP_SPLIT_CHUNK1; // Allocate and copy to new split array. @@ -581,7 +581,7 @@ { lscp_param_t *pParams; int i; - + if (ppList) { if (*ppList) { pParams = *ppList; @@ -603,7 +603,7 @@ lscp_param_t *pNewParams; int iSize, iNewSize; int i = 0; - + if (ppList && *ppList) { pParams = *ppList; while (pParams[i].key) { @@ -622,8 +622,8 @@ iNewSize = iSize + LSCP_SPLIT_CHUNK1; pNewParams = (lscp_param_t *) malloc(iNewSize * sizeof(lscp_param_t)); for (i = 0; i < iSize; i++) { - pParams[i].key = pParams[i].key; - pParams[i].value = pParams[i].value; + pNewParams[i].key = pParams[i].key; + pNewParams[i].value = pParams[i].value; } for ( ; i < iNewSize; i++) { pNewParams[i].key = NULL;