| 406 | |
| 407 | |
| 408 | CTag *CFileDataIO::ReadTag(bool bOptACP) const |
| 409 | { |
| 410 | CTag *retVal = NULL; |
| 411 | wxString name; |
| 412 | uint8_t type = 0; |
| 413 | try { |
| 414 | type = ReadUInt8(); |
| 415 | name = ReadString(false); |
| 416 | |
| 417 | switch (type) |
| 418 | { |
| 419 | // NOTE: This tag data type is accepted and stored only to give us the possibility to upgrade |
| 420 | // the net in some months. |
| 421 | // |
| 422 | // And still.. it doesn't work this way without breaking backward compatibility. To properly |
| 423 | // do this without messing up the network the following would have to be done: |
| 424 | // - those tag types have to be ignored by any client, otherwise those tags would also be sent (and |
| 425 | // that's really the problem) |
| 426 | // |
| 427 | // - ignoring means, each client has to read and right throw away those tags, so those tags get |
| 428 | // get never stored in any tag list which might be sent by that client to some other client. |
| 429 | // |
| 430 | // - all calling functions have to be changed to deal with the 'nr. of tags' attribute (which was |
| 431 | // already parsed) correctly.. just ignoring those tags here is not enough, any taglists have to |
| 432 | // be built with the knowledge that the 'nr. of tags' attribute may get decreased during the tag |
| 433 | // reading.. |
| 434 | // |
| 435 | // If those new tags would just be stored and sent to remote clients, any malicious or just bugged |
| 436 | // client could let send a lot of nodes "corrupted" packets... |
| 437 | // |
| 438 | case TAGTYPE_HASH16: |
| 439 | { |
| 440 | retVal = new CTagHash(name, ReadHash()); |
| 441 | break; |
| 442 | } |
| 443 | |
| 444 | case TAGTYPE_STRING: |
| 445 | retVal = new CTagString(name, ReadString(bOptACP)); |
| 446 | break; |
| 447 | |
| 448 | case TAGTYPE_UINT64: |
| 449 | retVal = new CTagInt64(name, ReadUInt64()); |
| 450 | break; |
| 451 | |
| 452 | case TAGTYPE_UINT32: |
| 453 | retVal = new CTagInt32(name, ReadUInt32()); |
| 454 | break; |
| 455 | |
| 456 | case TAGTYPE_UINT16: |
| 457 | retVal = new CTagInt16(name, ReadUInt16()); |
| 458 | break; |
| 459 | |
| 460 | case TAGTYPE_UINT8: |
| 461 | retVal = new CTagInt8(name, ReadUInt8()); |
| 462 | break; |
| 463 | |
| 464 | case TAGTYPE_FLOAT32: |
| 465 | retVal = new CTagFloat(name, ReadFloat()); |