Changeset 94
- Timestamp:
- Jan 29, 2011, 9:57:55 PM (14 years ago)
- Location:
- trunk/zoo-kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/service_internal.c
r93 r94 1400 1400 isSized=false; 1401 1401 } 1402 xmlAddChild(nc3,xmlNewText(BAD_CAST base64((const unsigned char*)toto->value,atoi(rs->value)))); 1402 1403 xmlAddChild(nc3,xmlNewText(BAD_CAST base64(toto->value, atoi(rs->value)))); 1403 1404 if(!isSized){ 1404 1405 freeMap(&rs); … … 1762 1763 1763 1764 b64 = BIO_new(BIO_f_base64()); 1765 BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); 1764 1766 bmem = BIO_new(BIO_s_mem()); 1765 1767 b64 = BIO_push(b64, bmem); … … 1768 1770 BIO_get_mem_ptr(b64, &bptr); 1769 1771 1770 char *buff = (char *)malloc( bptr->length);1772 char *buff = (char *)malloc((bptr->length)*sizeof(char)); 1771 1773 memcpy(buff, bptr->data, bptr->length-1); 1772 1774 buff[bptr->length-1] = 0; … … 1782 1784 1783 1785 char *buffer = (char *)malloc(length); 1784 memset(buffer, 0, length); 1785 1786 b64 = BIO_new(BIO_f_base64()); 1787 bmem = BIO_new_mem_buf(input, length); 1788 bmem = BIO_push(b64, bmem); 1789 1790 *red=BIO_read(bmem, buffer, length); 1791 1792 BIO_free_all(bmem); 1793 1786 if(buffer){ 1787 memset(buffer, 0, length); 1788 b64 = BIO_new(BIO_f_base64()); 1789 if(b64){ 1790 bmem = BIO_new_mem_buf(input,length); 1791 bmem = BIO_push(b64, bmem); 1792 *red=BIO_read(bmem, buffer, length); 1793 buffer[length-1]=0; 1794 BIO_free_all(bmem); 1795 } 1796 } 1794 1797 return buffer; 1795 1798 } … … 1802 1805 tmp=getMap(cursor->content,"value"); 1803 1806 addToMap(cursor->content,"base64_value",tmp->value); 1807 int size=0; 1804 1808 char *s=strdup(tmp->value); 1805 1809 free(tmp->value); 1806 int size=0;1807 1810 tmp->value=base64d(s,strlen(s),&size); 1811 free(s); 1808 1812 char sizes[1024]; 1809 1813 sprintf(sizes,"%d",size); -
trunk/zoo-kernel/zoo_service_loader.c
r92 r94 1343 1343 } 1344 1344 } 1345 xmlChar* mv=xmlNodeListGetString(doc,cur4->xmlChildrenNode,1); 1346 if(mv==NULL){ 1347 xmlDocPtr doc1=xmlNewDoc(BAD_CAST "1.0"); 1348 int buffersize; 1349 xmlDocSetRootElement(doc1,cur4->xmlChildrenNode); 1350 xmlDocDumpFormatMemoryEnc(doc1, &mv, &buffersize, "utf-8", 1); 1351 char size[1024]; 1352 sprintf(size,"%d",buffersize); 1353 addToMap(tmpmaps->content,"size",size); 1345 map* test=getMap(tmpmaps->content,"encoding"); 1346 if(test==NULL || strcasecmp(test->value,"base64")!=0){ 1347 xmlChar* mv=xmlNodeListGetString(doc,cur4->xmlChildrenNode,1); 1348 if(mv==NULL){ 1349 xmlDocPtr doc1=xmlNewDoc(BAD_CAST "1.0"); 1350 int buffersize; 1351 xmlDocSetRootElement(doc1,cur4->xmlChildrenNode); 1352 xmlDocDumpFormatMemoryEnc(doc1, &mv, &buffersize, "utf-8", 1); 1353 char size[1024]; 1354 sprintf(size,"%d",buffersize); 1355 addToMap(tmpmaps->content,"size",size); 1356 } 1357 addToMap(tmpmaps->content,"value",(char*)mv); 1358 xmlFree(mv); 1359 }else{ 1360 xmlSubstituteEntitiesDefault(1); 1361 xmlChar* tmp=xmlNodeListGetString(doc,cur4->xmlChildrenNode,0); 1362 addToMap(tmpmaps->content,"value",(char*)tmp); 1363 map* tmpv=getMap(tmpmaps->content,"value"); 1364 char *res=NULL; 1365 char *curs=tmpv->value; 1366 int i=0; 1367 for(int i=0;i<=strlen(tmpv->value)/64;i++) { 1368 if(res==NULL) 1369 res=(char*)malloc(67*sizeof(char)); 1370 else 1371 res=(char*)realloc(res,(((i+1)*65)+i)*sizeof(char)); 1372 int csize=i*65; 1373 strncpy(res + csize,curs,64); 1374 if(i==xmlStrlen(tmp)/64) 1375 strcat(res,"\n\0"); 1376 else{ 1377 strncpy(res + (((i+1)*64)+i),"\n\0",2); 1378 curs+=64; 1379 } 1380 } 1381 free(tmpv->value); 1382 tmpv->value=strdup(res); 1383 for(int j=0;j<strlen(tmpv->value);j++) 1384 if(tmpv->value[j]==' ') 1385 tmpv->value[j]='+'; 1386 free(res); 1387 xmlFree(tmp); 1354 1388 } 1355 addToMap(tmpmaps->content,"value",(char*)mv);1356 xmlFree(mv);1357 1389 cur4=cur4->next; 1358 1390 } … … 1731 1763 int eres=SERVICE_STARTED; 1732 1764 int cpid=getpid(); 1733 1765 1734 1766 maps *_tmpMaps=(maps*)malloc(MAPS_SIZE); 1735 1767 _tmpMaps->name=strdup("lenv"); … … 1836 1868 errorException(m, _("Unable to run the child process properly"), "InternalError"); 1837 1869 } 1838 1839 1870 } 1840 1871
Note: See TracChangeset
for help on using the changeset viewer.