Changeset 19467
- Timestamp:
- 01/05/13 05:23:37 (11 years ago)
- Location:
- titan/titan
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/about.h
r15915 r19467 7 7 struct dvbdev* dvbnode = dvbdev; 8 8 9 text = malloc(MINMALLOC); 10 if(text == NULL) 11 { 12 err("no memory"); 13 return 1; 14 } 15 16 tmpstr = ostrcat(_("Image"), ": ", 0, 0); 17 tmpstr = ostrcat(tmpstr, PROGNAME, 1, 0); 18 tmpstr = ostrcat(tmpstr, "\n", 1, 0); 19 tmpstr = ostrcat(tmpstr, _("Version"), 1, 0); 20 tmpstr = ostrcat(tmpstr, ": ", 1, 0); 21 tmpstr = ostrcat(tmpstr, OVERSION, 1, 0); 22 tmpstr = ostrcat(tmpstr, "\n", 1, 0); 23 tmpstr = ostrcat(tmpstr, _("Copyright"), 1, 0); 24 tmpstr = ostrcat(tmpstr, ": ", 1, 0); 25 tmpstr = ostrcat(tmpstr, COPYRIGHT, 1, 0); 26 tmpstr = ostrcat(tmpstr, "\n\n", 1, 0); 27 28 // snprintf(text, MINMALLOC, _("Image: %s\nVersion: %s\nCopyright: %s\n\n"), PROGNAME, OVERSION, COPYRIGHT); 29 snprintf(text, MINMALLOC, "%s", tmpstr); 30 free(tmpstr), tmpstr = NULL; 9 text = ostrcat(_("Image"), ": ", 0, 0); 10 text = ostrcat(text, PROGNAME, 1, 0); 11 text = ostrcat(text, "\n", 1, 0); 12 text = ostrcat(text, _("Version"), 1, 0); 13 text = ostrcat(text, ": ", 1, 0); 14 text = ostrcat(text, OVERSION, 1, 0); 15 text = ostrcat(text, "\n", 1, 0); 16 text = ostrcat(text, _("Copyright"), 1, 0); 17 text = ostrcat(text, ": ", 1, 0); 18 text = ostrcat(text, COPYRIGHT, 1, 0); 19 text = ostrcat(text, "\n\n", 1, 0); 31 20 32 21 while(dvbnode != NULL) -
titan/titan/ca.h
r18690 r19467 205 205 unsigned char *tmpbuf = NULL; 206 206 207 buf = malloc(MINMALLOC);207 buf = calloc(1, MINMALLOC); 208 208 if(buf == NULL) 209 209 { … … 214 214 debug(620, "send SPDU, nr %d", sessionnr); 215 215 216 memset(buf, 0, MINMALLOC);217 216 tmpbuf = buf; 218 217 … … 1499 1498 canode = dvbnode->caslot; 1500 1499 1501 buf = malloc(MINMALLOC);1500 buf = calloc(1, MINMALLOC); 1502 1501 if(buf == NULL) 1503 1502 { … … 1505 1504 return; 1506 1505 } 1507 memset(buf, 0, MINMALLOC);1508 1506 1509 1507 switch(canode->status) … … 1514 1512 debug(620, "status: no, slot %d", dvbnode->devnr); 1515 1513 1516 1514 //reset the module an wait max 10 sek 1517 1515 careseting(self, dvbnode, 0); 1518 1516 -
titan/titan/channel.h
r18431 r19467 317 317 } 318 318 319 newnode->name = ostr cat(name, NULL, 1, 0);319 newnode->name = ostrshrink(name); 320 320 //99 = tmp channel 321 321 if(newnode->servicetype != 99) -
titan/titan/extepg.h
r19375 r19467 682 682 } 683 683 684 newnode->file = ostr cat(file, NULL, 1, 0);684 newnode->file = ostrshrink(file); 685 685 686 686 if(last == NULL) -
titan/titan/global.h
r19447 r19467 155 155 ltostr(str, val, base); 156 156 157 return ostr cat(str, NULL, 1, 0);157 return ostrshrink(str); 158 158 } 159 159 … … 1140 1140 return; 1141 1141 1142 buf = malloc(MINMALLOC);1142 buf = calloc(1, MINMALLOC); 1143 1143 if(buf == NULL) 1144 1144 { … … 1146 1146 return; 1147 1147 } 1148 memset(buf, 0, MINMALLOC); 1149 1148 1150 1149 fwrite(buf, MINMALLOC, 1, fd); 1151 1150 … … 1699 1698 char* buf = NULL, *to = NULL; 1700 1699 1701 buf = malloc(MINMALLOC);1700 buf = calloc(1, MINMALLOC); 1702 1701 if(buf == NULL) 1703 1702 { … … 1705 1704 return NULL; 1706 1705 } 1707 memset(buf, 0, MINMALLOC);1708 1706 to = buf; 1709 1707 … … 1725 1723 *to = '\0'; 1726 1724 1727 buf = ostr cat(buf, NULL, 1, 0);1725 buf = ostrshrink(buf); 1728 1726 return buf; 1729 1727 } … … 3179 3177 } 3180 3178 3179 char* ostrshrink(char* value) 3180 { 3181 // debug(1000, "in"); 3182 int len = 0; 3183 char* buf = NULL; 3184 3185 if(value == NULL) return NULL; 3186 3187 len = strlen(value); 3188 if(len == 0) return value; 3189 3190 buf = malloc(len + 1); 3191 if(buf == NULL) 3192 return value; 3193 3194 memcpy(buf, value, len); 3195 free(value); 3196 buf[len] = '\0'; 3197 3198 return buf; 3199 } 3200 3181 3201 char* ostrcat(char* value1, char* value2, int free1, int free2) 3182 3202 { … … 3220 3240 { 3221 3241 debug(1000, "in"); 3222 char *buf = NULL , *buf1 = NULL;3242 char *buf = NULL; 3223 3243 3224 3244 buf = malloc(MINMALLOC); … … 3230 3250 3231 3251 sprintf(buf, "%llu", value); 3232 buf 1 = ostrcat(buf, NULL, 1, 0);3233 3234 debug(1000, "out"); 3235 return buf 1;3252 buf = ostrshrink(buf); 3253 3254 debug(1000, "out"); 3255 return buf; 3236 3256 } 3237 3257 … … 3239 3259 { 3240 3260 debug(1000, "in"); 3241 char *buf = NULL , *buf1 = NULL;3261 char *buf = NULL; 3242 3262 3243 3263 buf = malloc(MINMALLOC); … … 3249 3269 3250 3270 sprintf(buf, "%lu", value); 3251 buf 1 = ostrcat(buf, NULL, 1, 0);3252 3253 debug(1000, "out"); 3254 return buf 1;3271 buf = ostrshrink(buf); 3272 3273 debug(1000, "out"); 3274 return buf; 3255 3275 } 3256 3276 … … 3258 3278 { 3259 3279 debug(1000, "in"); 3260 char *buf = NULL , *buf1 = NULL;3280 char *buf = NULL; 3261 3281 3262 3282 buf = malloc(MINMALLOC); … … 3268 3288 3269 3289 sprintf(buf, "%x", value); 3270 buf 1 = ostrcat(buf, NULL, 1, 0);3271 3272 debug(1000, "out"); 3273 return buf 1;3290 buf = ostrshrink(buf); 3291 3292 debug(1000, "out"); 3293 return buf; 3274 3294 } 3275 3295 … … 3277 3297 { 3278 3298 debug(1000, "in"); 3279 char *buf = NULL , *buf1 = NULL;3299 char *buf = NULL; 3280 3300 3281 3301 buf = malloc(MINMALLOC); … … 3287 3307 3288 3308 sprintf(buf, "%d", value); 3289 buf 1 = ostrcat(buf, NULL, 1, 0);3290 3291 debug(1000, "out"); 3292 return buf 1;3309 buf = ostrshrink(buf); 3310 3311 debug(1000, "out"); 3312 return buf; 3293 3313 } 3294 3314 … … 3296 3316 { 3297 3317 debug(1000, "in"); 3298 char *buf = NULL , *buf1 = NULL;3318 char *buf = NULL; 3299 3319 3300 3320 buf = malloc(MINMALLOC); … … 3306 3326 3307 3327 sprintf(buf, "%lld", value); 3308 buf 1 = ostrcat(buf, NULL, 1, 0);3309 3310 debug(1000, "out"); 3311 return buf 1;3328 buf = ostrcat(buf); 3329 3330 debug(1000, "out"); 3331 return buf; 3312 3332 } 3313 3333 … … 3315 3335 { 3316 3336 debug(1000, "in"); 3317 char *buf = NULL , *buf1 = NULL;3337 char *buf = NULL; 3318 3338 char* tmpstr = NULL; 3319 3339 … … 3329 3349 3330 3350 sprintf(buf, tmpstr, value); 3331 buf 1 = ostrcat(buf, NULL, 1, 0);3351 buf = ostrcat(buf); 3332 3352 3333 3353 free(tmpstr); 3334 3354 debug(1000, "out"); 3335 return buf 1;3355 return buf; 3336 3356 } 3337 3357 … … 3666 3686 if(len >= 0 && fileline[len] == '\n') 3667 3687 fileline[len] = '\0'; 3668 buf1 = ostr cat(fileline, NULL, 1, 0);3688 buf1 = ostrshrink(fileline); 3669 3689 3670 3690 fclose(fd); … … 3713 3733 if(len >= 0 && fileline[len] == '\n') 3714 3734 fileline[len] = '\0'; 3715 buf1 = ostr cat(fileline, NULL, 1, 0);3735 buf1 = ostrshrink(fileline); 3716 3736 3717 3737 fclose(fd); -
titan/titan/harddisk.h
r18077 r19467 13 13 } 14 14 snprintf(buf, MINMALLOC, "%.2f", (float)size / 2 / 1024 / 1024); //size is in 512KB blocks 15 return buf;15 return ostrshrink(buf); 16 16 } 17 17 -
titan/titan/header.h
r19454 r19467 666 666 int ostrcmp(char* value1, char* value2); 667 667 int ostrcasecmp(char* value1, char* value2); 668 char* ostrshrink(char* value); 668 669 char* ostrcat(char* value1, char* value2, int free1, int free2); 669 670 int ostrncmp(char* value1, char* value2, int count); -
titan/titan/mediadb.h
r19216 r19467 338 338 } 339 339 340 newnode->name = ostr cat(name, NULL, 1, 0);340 newnode->name = ostrshrink(name); 341 341 342 342 if(flag == 0) m_lock(&status.mediadbmutex, 17); -
titan/titan/newsletter.h
r19453 r19467 60 60 } 61 61 62 newnode->date = ostrcat(date, NULL, 1, 0); 63 newnode->title = ostrcat(title, NULL, 1, 0); 64 newnode->text = string_replace_all("\\n", "\n", text, 1); 62 newnode->date = ostrshrink(date); 63 newnode->title = ostrshrink(title); 64 newnode->text = ostrshrink(text); 65 newnode->text = string_replace_all("\\n", "\n", newnode->text, 1); 65 66 66 67 if(last == NULL) -
titan/titan/playlist.h
r16991 r19467 214 214 215 215 free(file); 216 newnode->file = ostr cat(line, NULL, 0, 0);216 newnode->file = ostrshrink(line); 217 217 218 218 if(last == NULL) -
titan/titan/provider.h
r18452 r19467 192 192 int ret = 0; 193 193 194 newnode = (struct provider*) malloc(sizeof(struct provider));194 newnode = (struct provider*)calloc(1, sizeof(struct provider)); 195 195 if(newnode == NULL) 196 196 { … … 207 207 } 208 208 209 memset(newnode, 0, sizeof(struct provider));210 209 status.writeprovider = 1; 211 210 … … 226 225 } 227 226 228 newnode->name = ostr cat(name, NULL, 1, 0);227 newnode->name = ostrshrink(name); 229 228 230 229 if(last == NULL) -
titan/titan/rcmap.h
r16380 r19467 23 23 return NULL; 24 24 } 25 25 26 key = malloc(MINMALLOC); 26 27 if(key == NULL) … … 60 61 } 61 62 62 newnode->name = ostr cat(name, NULL, 1, 0);63 newnode->name = ostrshrink(name); 63 64 newnode->key = getrcconfigint(key, NULL); 64 65 free(key); key = NULL; -
titan/titan/sat.h
r18165 r19467 321 321 } 322 322 323 newnode->name = ostr cat(name, NULL, 1, 0);323 newnode->name = ostrshrink(name); 324 324 325 325 if(last == NULL) -
titan/titan/sock.h
r19036 r19467 462 462 if(host == NULL) return NULL; 463 463 464 ip = malloc(iplen);464 ip = calloc(1, iplen); 465 465 if(ip == NULL) 466 466 { … … 468 468 return NULL; 469 469 } 470 memset(ip, 0, iplen); 471 472 buf = malloc(MINMALLOC); 470 471 buf = calloc(1, MINMALLOC); 473 472 if(buf == NULL) 474 473 { … … 477 476 return NULL; 478 477 } 479 memset(buf, 0, MINMALLOC);480 478 481 479 ret = gethostbyname_r(host, &hent, buf, MINMALLOC, &result, &err); … … 649 647 650 648 //now it is time to receive the page 651 tmpbuf = malloc(MINMALLOC);649 tmpbuf = calloc(1, MINMALLOC); 652 650 if(tmpbuf == NULL) 653 651 { … … 662 660 return NULL; 663 661 } 664 memset(tmpbuf, 0, MINMALLOC);665 662 666 663 //read one line -
titan/titan/stream.h
r18431 r19467 89 89 debug(250, "accept stream connection connfd=%d", connfd); 90 90 91 buf = malloc(MINMALLOC);91 buf = calloc(1, MINMALLOC); 92 92 if(buf == NULL) 93 93 { … … 96 96 continue; 97 97 } 98 memset(buf, 0, MINMALLOC);99 98 100 99 debug(250, "get client data");
Note: See TracChangeset
for help on using the changeset viewer.