aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llinventory/llinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llinventory/llinventory.cpp')
-rw-r--r--linden/indra/llinventory/llinventory.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp
index 1f7efb3..3235748 100644
--- a/linden/indra/llinventory/llinventory.cpp
+++ b/linden/indra/llinventory/llinventory.cpp
@@ -320,6 +320,8 @@ void LLInventoryObject::setType(LLAssetType::EType type)
320// virtual 320// virtual
321BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) 321BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
322{ 322{
323 // *NOTE: Changing the buffer size will require changing the scanf
324 // calls below.
323 char buffer[MAX_STRING]; 325 char buffer[MAX_STRING];
324 char keyword[MAX_STRING]; 326 char keyword[MAX_STRING];
325 char valuestr[MAX_STRING]; 327 char valuestr[MAX_STRING];
@@ -358,7 +360,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
358 { 360 {
359 //strcpy(valuestr, buffer + strlen(keyword) + 3); 361 //strcpy(valuestr, buffer + strlen(keyword) + 3);
360 // *NOTE: Not ANSI C, but widely supported. 362 // *NOTE: Not ANSI C, but widely supported.
361 sscanf(buffer, " %254s %[^|]", keyword, valuestr); 363 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
362 mName.assign(valuestr); 364 mName.assign(valuestr);
363 LLString::replaceNonstandardASCII(mName, ' '); 365 LLString::replaceNonstandardASCII(mName, ' ');
364 LLString::replaceChar(mName, '|', ' '); 366 LLString::replaceChar(mName, '|', ' ');
@@ -681,6 +683,8 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32
681// virtual 683// virtual
682BOOL LLInventoryItem::importFile(FILE* fp) 684BOOL LLInventoryItem::importFile(FILE* fp)
683{ 685{
686 // *NOTE: Changing the buffer size will require changing the scanf
687 // calls below.
684 char buffer[MAX_STRING]; 688 char buffer[MAX_STRING];
685 char keyword[MAX_STRING]; 689 char keyword[MAX_STRING];
686 char valuestr[MAX_STRING]; 690 char valuestr[MAX_STRING];
@@ -769,7 +773,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
769 { 773 {
770 //strcpy(valuestr, buffer + strlen(keyword) + 3); 774 //strcpy(valuestr, buffer + strlen(keyword) + 3);
771 // *NOTE: Not ANSI C, but widely supported. 775 // *NOTE: Not ANSI C, but widely supported.
772 sscanf(buffer, " %254s%[\t]%[^|]", keyword, junk, valuestr); 776 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
773 777
774 // IW: sscanf chokes and puts | in valuestr if there's no name 778 // IW: sscanf chokes and puts | in valuestr if there's no name
775 if (valuestr[0] == '|') 779 if (valuestr[0] == '|')
@@ -785,7 +789,7 @@ BOOL LLInventoryItem::importFile(FILE* fp)
785 { 789 {
786 //strcpy(valuestr, buffer + strlen(keyword) + 3); 790 //strcpy(valuestr, buffer + strlen(keyword) + 3);
787 // *NOTE: Not ANSI C, but widely supported. 791 // *NOTE: Not ANSI C, but widely supported.
788 sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); 792 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
789 793
790 if (valuestr[0] == '|') 794 if (valuestr[0] == '|')
791 { 795 {
@@ -875,6 +879,8 @@ BOOL LLInventoryItem::exportFile(FILE* fp, BOOL include_asset_key) const
875// virtual 879// virtual
876BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) 880BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
877{ 881{
882 // *NOTE: Changing the buffer size will require changing the scanf
883 // calls below.
878 char buffer[MAX_STRING]; 884 char buffer[MAX_STRING];
879 char keyword[MAX_STRING]; 885 char keyword[MAX_STRING];
880 char valuestr[MAX_STRING]; 886 char valuestr[MAX_STRING];
@@ -889,7 +895,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
889 while(success && input_stream.good()) 895 while(success && input_stream.good())
890 { 896 {
891 input_stream.getline(buffer, MAX_STRING); 897 input_stream.getline(buffer, MAX_STRING);
892 sscanf(buffer, " %s %s", keyword, valuestr); 898 sscanf(buffer, " %254s %254s", keyword, valuestr);
893 if(!keyword) 899 if(!keyword)
894 { 900 {
895 continue; 901 continue;
@@ -963,7 +969,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
963 { 969 {
964 //strcpy(valuestr, buffer + strlen(keyword) + 3); 970 //strcpy(valuestr, buffer + strlen(keyword) + 3);
965 // *NOTE: Not ANSI C, but widely supported. 971 // *NOTE: Not ANSI C, but widely supported.
966 sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); 972 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
967 973
968 // IW: sscanf chokes and puts | in valuestr if there's no name 974 // IW: sscanf chokes and puts | in valuestr if there's no name
969 if (valuestr[0] == '|') 975 if (valuestr[0] == '|')
@@ -979,7 +985,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
979 { 985 {
980 //strcpy(valuestr, buffer + strlen(keyword) + 3); 986 //strcpy(valuestr, buffer + strlen(keyword) + 3);
981 // *NOTE: Not ANSI C, but widely supported. 987 // *NOTE: Not ANSI C, but widely supported.
982 sscanf(buffer, " %s%[\t]%[^|]", keyword, junk, valuestr); 988 sscanf(buffer, " %254s%254[\t]%254[^|]", keyword, junk, valuestr);
983 989
984 if (valuestr[0] == '|') 990 if (valuestr[0] == '|')
985 { 991 {
@@ -1522,6 +1528,8 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
1522// virtual 1528// virtual
1523BOOL LLInventoryCategory::importFile(FILE* fp) 1529BOOL LLInventoryCategory::importFile(FILE* fp)
1524{ 1530{
1531 // *NOTE: Changing the buffer size will require changing the scanf
1532 // calls below.
1525 char buffer[MAX_STRING]; 1533 char buffer[MAX_STRING];
1526 char keyword[MAX_STRING]; 1534 char keyword[MAX_STRING];
1527 char valuestr[MAX_STRING]; 1535 char valuestr[MAX_STRING];
@@ -1531,7 +1539,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1531 while(!feof(fp)) 1539 while(!feof(fp))
1532 { 1540 {
1533 fgets(buffer, MAX_STRING, fp); 1541 fgets(buffer, MAX_STRING, fp);
1534 sscanf(buffer, " %s %s", keyword, valuestr); 1542 sscanf(buffer, " %254s %254s", keyword, valuestr);
1535 if(!keyword) 1543 if(!keyword)
1536 { 1544 {
1537 continue; 1545 continue;
@@ -1564,7 +1572,7 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1564 { 1572 {
1565 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1573 //strcpy(valuestr, buffer + strlen(keyword) + 3);
1566 // *NOTE: Not ANSI C, but widely supported. 1574 // *NOTE: Not ANSI C, but widely supported.
1567 sscanf(buffer, " %s %[^|]", keyword, valuestr); 1575 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
1568 mName.assign(valuestr); 1576 mName.assign(valuestr);
1569 LLString::replaceNonstandardASCII(mName, ' '); 1577 LLString::replaceNonstandardASCII(mName, ' ');
1570 LLString::replaceChar(mName, '|', ' '); 1578 LLString::replaceChar(mName, '|', ' ');
@@ -1597,6 +1605,8 @@ BOOL LLInventoryCategory::exportFile(FILE* fp, BOOL) const
1597// virtual 1605// virtual
1598BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) 1606BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1599{ 1607{
1608 // *NOTE: Changing the buffer size will require changing the scanf
1609 // calls below.
1600 char buffer[MAX_STRING]; 1610 char buffer[MAX_STRING];
1601 char keyword[MAX_STRING]; 1611 char keyword[MAX_STRING];
1602 char valuestr[MAX_STRING]; 1612 char valuestr[MAX_STRING];
@@ -1606,7 +1616,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1606 while(input_stream.good()) 1616 while(input_stream.good())
1607 { 1617 {
1608 input_stream.getline(buffer, MAX_STRING); 1618 input_stream.getline(buffer, MAX_STRING);
1609 sscanf(buffer, " %s %s", keyword, valuestr); 1619 sscanf(buffer, " %254s %254s", keyword, valuestr);
1610 if(!keyword) 1620 if(!keyword)
1611 { 1621 {
1612 continue; 1622 continue;
@@ -1639,7 +1649,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1639 { 1649 {
1640 //strcpy(valuestr, buffer + strlen(keyword) + 3); 1650 //strcpy(valuestr, buffer + strlen(keyword) + 3);
1641 // *NOTE: Not ANSI C, but widely supported. 1651 // *NOTE: Not ANSI C, but widely supported.
1642 sscanf(buffer, " %s %[^|]", keyword, valuestr); 1652 sscanf(buffer, " %254s %254[^|]", keyword, valuestr);
1643 mName.assign(valuestr); 1653 mName.assign(valuestr);
1644 LLString::replaceNonstandardASCII(mName, ' '); 1654 LLString::replaceNonstandardASCII(mName, ' ');
1645 LLString::replaceChar(mName, '|', ' '); 1655 LLString::replaceChar(mName, '|', ' ');