diff options
author | Jacek Antonelli | 2008-08-15 23:44:48 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:48 -0500 |
commit | 9b4f54c826ffa4f94efa866068c9d6ecdfb4b424 (patch) | |
tree | 2f8ae193ab487088962e628f1ee9dee2f5901f01 /linden/indra/llinventory | |
parent | Second Life viewer sources 1.13.2.12 (diff) | |
download | meta-impy-9b4f54c826ffa4f94efa866068c9d6ecdfb4b424.zip meta-impy-9b4f54c826ffa4f94efa866068c9d6ecdfb4b424.tar.gz meta-impy-9b4f54c826ffa4f94efa866068c9d6ecdfb4b424.tar.bz2 meta-impy-9b4f54c826ffa4f94efa866068c9d6ecdfb4b424.tar.xz |
Second Life viewer sources 1.13.2.15
Diffstat (limited to 'linden/indra/llinventory')
-rw-r--r-- | linden/indra/llinventory/llinventory.cpp | 30 | ||||
-rw-r--r-- | linden/indra/llinventory/lllandmark.cpp | 4 | ||||
-rw-r--r-- | linden/indra/llinventory/llpermissions.cpp | 24 | ||||
-rw-r--r-- | linden/indra/llinventory/llsaleinfo.cpp | 8 |
4 files changed, 43 insertions, 23 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 |
321 | BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) | 321 | BOOL 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 |
682 | BOOL LLInventoryItem::importFile(FILE* fp) | 684 | BOOL 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 |
876 | BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) | 880 | BOOL 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 |
1523 | BOOL LLInventoryCategory::importFile(FILE* fp) | 1529 | BOOL 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 |
1598 | BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) | 1606 | BOOL 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, '|', ' '); |
diff --git a/linden/indra/llinventory/lllandmark.cpp b/linden/indra/llinventory/lllandmark.cpp index bca64d1..d7dca20 100644 --- a/linden/indra/llinventory/lllandmark.cpp +++ b/linden/indra/llinventory/lllandmark.cpp | |||
@@ -138,10 +138,12 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer) | |||
138 | } | 138 | } |
139 | else if(version == 2) | 139 | else if(version == 2) |
140 | { | 140 | { |
141 | // *NOTE: Changing the buffer size will require changing the | ||
142 | // scanf call below. | ||
141 | char region_id_str[MAX_STRING]; | 143 | char region_id_str[MAX_STRING]; |
142 | LLVector3 pos; | 144 | LLVector3 pos; |
143 | cur += chars_read; | 145 | cur += chars_read; |
144 | count = sscanf(cur, "region_id %s\n%n", region_id_str, &chars_read); | 146 | count = sscanf(cur, "region_id %254s\n%n", region_id_str, &chars_read); |
145 | if(count != 1) goto error; | 147 | if(count != 1) goto error; |
146 | cur += chars_read; | 148 | cur += chars_read; |
147 | count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read); | 149 | count = sscanf(cur, "local_pos %f %f %f\n%n", pos.mV+VX, pos.mV+VY, pos.mV+VZ, &chars_read); |
diff --git a/linden/indra/llinventory/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp index 39e7a72..35dbc3e 100644 --- a/linden/indra/llinventory/llpermissions.cpp +++ b/linden/indra/llinventory/llpermissions.cpp | |||
@@ -511,6 +511,8 @@ BOOL LLPermissions::importFile(FILE *fp) | |||
511 | init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); | 511 | init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); |
512 | const S32 BUFSIZE = 16384; | 512 | const S32 BUFSIZE = 16384; |
513 | 513 | ||
514 | // *NOTE: Changing the buffer size will require changing the scanf | ||
515 | // calls below. | ||
514 | char buffer[BUFSIZE]; | 516 | char buffer[BUFSIZE]; |
515 | char keyword[256]; | 517 | char keyword[256]; |
516 | char valuestr[256]; | 518 | char valuestr[256]; |
@@ -523,7 +525,7 @@ BOOL LLPermissions::importFile(FILE *fp) | |||
523 | while (!feof(fp)) | 525 | while (!feof(fp)) |
524 | { | 526 | { |
525 | fgets(buffer, BUFSIZE, fp); | 527 | fgets(buffer, BUFSIZE, fp); |
526 | sscanf(buffer, " %s %s", keyword, valuestr); | 528 | sscanf(buffer, " %255s %255s", keyword, valuestr); |
527 | if (!keyword) | 529 | if (!keyword) |
528 | { | 530 | { |
529 | continue; | 531 | continue; |
@@ -571,22 +573,22 @@ BOOL LLPermissions::importFile(FILE *fp) | |||
571 | } | 573 | } |
572 | else if (!strcmp("creator_id", keyword)) | 574 | else if (!strcmp("creator_id", keyword)) |
573 | { | 575 | { |
574 | sscanf(valuestr, "%s", uuid_str); | 576 | sscanf(valuestr, "%255s", uuid_str); |
575 | mCreator.set(uuid_str); | 577 | mCreator.set(uuid_str); |
576 | } | 578 | } |
577 | else if (!strcmp("owner_id", keyword)) | 579 | else if (!strcmp("owner_id", keyword)) |
578 | { | 580 | { |
579 | sscanf(valuestr, "%s", uuid_str); | 581 | sscanf(valuestr, "%255s", uuid_str); |
580 | mOwner.set(uuid_str); | 582 | mOwner.set(uuid_str); |
581 | } | 583 | } |
582 | else if (!strcmp("last_owner_id", keyword)) | 584 | else if (!strcmp("last_owner_id", keyword)) |
583 | { | 585 | { |
584 | sscanf(valuestr, "%s", uuid_str); | 586 | sscanf(valuestr, "%255s", uuid_str); |
585 | mLastOwner.set(uuid_str); | 587 | mLastOwner.set(uuid_str); |
586 | } | 588 | } |
587 | else if (!strcmp("group_id", keyword)) | 589 | else if (!strcmp("group_id", keyword)) |
588 | { | 590 | { |
589 | sscanf(valuestr, "%s", uuid_str); | 591 | sscanf(valuestr, "%255s", uuid_str); |
590 | mGroup.set(uuid_str); | 592 | mGroup.set(uuid_str); |
591 | } | 593 | } |
592 | else if (!strcmp("group_owned", keyword)) | 594 | else if (!strcmp("group_owned", keyword)) |
@@ -644,6 +646,8 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) | |||
644 | init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); | 646 | init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null); |
645 | const S32 BUFSIZE = 16384; | 647 | const S32 BUFSIZE = 16384; |
646 | 648 | ||
649 | // *NOTE: Changing the buffer size will require changing the scanf | ||
650 | // calls below. | ||
647 | char buffer[BUFSIZE]; | 651 | char buffer[BUFSIZE]; |
648 | char keyword[256]; | 652 | char keyword[256]; |
649 | char valuestr[256]; | 653 | char valuestr[256]; |
@@ -656,7 +660,7 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) | |||
656 | while (input_stream.good()) | 660 | while (input_stream.good()) |
657 | { | 661 | { |
658 | input_stream.getline(buffer, BUFSIZE); | 662 | input_stream.getline(buffer, BUFSIZE); |
659 | sscanf(buffer, " %s %s", keyword, valuestr); | 663 | sscanf(buffer, " %255s %255s", keyword, valuestr); |
660 | if (!keyword) | 664 | if (!keyword) |
661 | { | 665 | { |
662 | continue; | 666 | continue; |
@@ -704,22 +708,22 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) | |||
704 | } | 708 | } |
705 | else if (!strcmp("creator_id", keyword)) | 709 | else if (!strcmp("creator_id", keyword)) |
706 | { | 710 | { |
707 | sscanf(valuestr, "%s", uuid_str); | 711 | sscanf(valuestr, "%255s", uuid_str); |
708 | mCreator.set(uuid_str); | 712 | mCreator.set(uuid_str); |
709 | } | 713 | } |
710 | else if (!strcmp("owner_id", keyword)) | 714 | else if (!strcmp("owner_id", keyword)) |
711 | { | 715 | { |
712 | sscanf(valuestr, "%s", uuid_str); | 716 | sscanf(valuestr, "%255s", uuid_str); |
713 | mOwner.set(uuid_str); | 717 | mOwner.set(uuid_str); |
714 | } | 718 | } |
715 | else if (!strcmp("last_owner_id", keyword)) | 719 | else if (!strcmp("last_owner_id", keyword)) |
716 | { | 720 | { |
717 | sscanf(valuestr, "%s", uuid_str); | 721 | sscanf(valuestr, "%255s", uuid_str); |
718 | mLastOwner.set(uuid_str); | 722 | mLastOwner.set(uuid_str); |
719 | } | 723 | } |
720 | else if (!strcmp("group_id", keyword)) | 724 | else if (!strcmp("group_id", keyword)) |
721 | { | 725 | { |
722 | sscanf(valuestr, "%s", uuid_str); | 726 | sscanf(valuestr, "%255s", uuid_str); |
723 | mGroup.set(uuid_str); | 727 | mGroup.set(uuid_str); |
724 | } | 728 | } |
725 | else if (!strcmp("group_owned", keyword)) | 729 | else if (!strcmp("group_owned", keyword)) |
diff --git a/linden/indra/llinventory/llsaleinfo.cpp b/linden/indra/llinventory/llsaleinfo.cpp index b82bd18..98043d1 100644 --- a/linden/indra/llinventory/llsaleinfo.cpp +++ b/linden/indra/llinventory/llsaleinfo.cpp | |||
@@ -158,6 +158,8 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask) | |||
158 | { | 158 | { |
159 | has_perm_mask = FALSE; | 159 | has_perm_mask = FALSE; |
160 | 160 | ||
161 | // *NOTE: Changing the buffer size will require changing the scanf | ||
162 | // calls below. | ||
161 | char buffer[MAX_STRING]; | 163 | char buffer[MAX_STRING]; |
162 | char keyword[MAX_STRING]; | 164 | char keyword[MAX_STRING]; |
163 | char valuestr[MAX_STRING]; | 165 | char valuestr[MAX_STRING]; |
@@ -168,7 +170,7 @@ BOOL LLSaleInfo::importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask) | |||
168 | while(success && (!feof(fp))) | 170 | while(success && (!feof(fp))) |
169 | { | 171 | { |
170 | fgets(buffer, MAX_STRING, fp); | 172 | fgets(buffer, MAX_STRING, fp); |
171 | sscanf(buffer, " %s %s", keyword, valuestr); | 173 | sscanf(buffer, " %254s %254s", keyword, valuestr); |
172 | if(!keyword) | 174 | if(!keyword) |
173 | { | 175 | { |
174 | continue; | 176 | continue; |
@@ -209,6 +211,8 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m | |||
209 | { | 211 | { |
210 | has_perm_mask = FALSE; | 212 | has_perm_mask = FALSE; |
211 | 213 | ||
214 | // *NOTE: Changing the buffer size will require changing the scanf | ||
215 | // calls below. | ||
212 | char buffer[MAX_STRING]; | 216 | char buffer[MAX_STRING]; |
213 | char keyword[MAX_STRING]; | 217 | char keyword[MAX_STRING]; |
214 | char valuestr[MAX_STRING]; | 218 | char valuestr[MAX_STRING]; |
@@ -219,7 +223,7 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m | |||
219 | while(success && input_stream.good()) | 223 | while(success && input_stream.good()) |
220 | { | 224 | { |
221 | input_stream.getline(buffer, MAX_STRING); | 225 | input_stream.getline(buffer, MAX_STRING); |
222 | sscanf(buffer, " %s %s", keyword, valuestr); | 226 | sscanf(buffer, " %254s %254s", keyword, valuestr); |
223 | if(!keyword) | 227 | if(!keyword) |
224 | { | 228 | { |
225 | continue; | 229 | continue; |