Changeset 792 for cpp/frams/param/paramtabobj.cpp
- Timestamp:
- 05/29/18 16:32:45 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/paramtabobj.cpp
r478 r792 7 7 int ParamTab::measureTab(const ParamEntry *pe) 8 8 { 9 int i=0;10 while(pe->id) {i++;pe++;}11 return i;9 int i = 0; 10 while (pe->id) { i++; pe++; } 11 return i; 12 12 } 13 13 14 14 void ParamTab::resize(int s) 15 15 { 16 if (s==siz) return;17 tab=(ParamEntry*)realloc(tab,sizeof(ParamEntry)*(s+1));18 siz=s;16 if (s == siz) return; 17 tab = (ParamEntry*)realloc(tab, sizeof(ParamEntry)*(s + 1)); 18 siz = s; 19 19 } 20 20 21 int ParamTab::add(const ParamEntry* p, int count)21 int ParamTab::add(const ParamEntry* p, int count) 22 22 { 23 if (count<0) count=measureTab(p);24 resize(siz+count);25 memmove(tab+siz-count,p,sizeof(ParamEntry)*count);26 memset(tab+siz,0,sizeof(ParamEntry));27 if (siz>0) tab[0].flags=(paInt)(siz-tab[0].group);28 return siz-1;23 if (count < 0) count = measureTab(p); 24 resize(siz + count); 25 memmove(tab + siz - count, p, sizeof(ParamEntry)*count); 26 memset(tab + siz, 0, sizeof(ParamEntry)); 27 if (siz > 0) tab[0].flags = (paInt)(siz - tab[0].group); 28 return siz - 1; 29 29 } 30 30 31 void ParamTab::remove(int i, int count)31 void ParamTab::remove(int i, int count) 32 32 { 33 memmove(tab+i,tab+i+count,sizeof(ParamEntry)*count);34 resize(siz-count);35 memset(tab+siz,0,sizeof(ParamEntry));36 if (siz>0) tab[0].flags=(paInt)(siz-tab[0].group);33 memmove(tab + i, tab + i + count, sizeof(ParamEntry)*count); 34 resize(siz - count); 35 memset(tab + siz, 0, sizeof(ParamEntry)); 36 if (siz > 0) tab[0].flags = (paInt)(siz - tab[0].group); 37 37 } 38
Note: See TracChangeset
for help on using the changeset viewer.