Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. A very intersting code

A very intersting code

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dracula Wang
    wrote on last edited by
    #1

    when i look into 7z's code, find this:

    namespace NSignature
    {
    UInt32 kLocalFileHeader = 0x04034B50 + 1;
    UInt32 kDataDescriptor = 0x08074B50 + 1;
    UInt32 kCentralFileHeader = 0x02014B50 + 1;
    UInt32 kEndOfCentralDir = 0x06054B50 + 1;
    UInt32 kZip64EndOfCentralDir = 0x06064B50 + 1;
    UInt32 kZip64EndOfCentralDirLocator = 0x07064B50 + 1;

    class CMarkersInitializer
    {
    public:
    CMarkersInitializer()
    {
    kLocalFileHeader--;
    kDataDescriptor--;
    kCentralFileHeader--;
    kEndOfCentralDir--;
    kZip64EndOfCentralDir--;
    kZip64EndOfCentralDirLocator--;
    }
    };
    static CMarkersInitializer g_MarkerInitializer;
    }

    i really wonder why they did this? do any body have read this code? Thanks

    D 1 Reply Last reply
    0
    • D Dracula Wang

      when i look into 7z's code, find this:

      namespace NSignature
      {
      UInt32 kLocalFileHeader = 0x04034B50 + 1;
      UInt32 kDataDescriptor = 0x08074B50 + 1;
      UInt32 kCentralFileHeader = 0x02014B50 + 1;
      UInt32 kEndOfCentralDir = 0x06054B50 + 1;
      UInt32 kZip64EndOfCentralDir = 0x06064B50 + 1;
      UInt32 kZip64EndOfCentralDirLocator = 0x07064B50 + 1;

      class CMarkersInitializer
      {
      public:
      CMarkersInitializer()
      {
      kLocalFileHeader--;
      kDataDescriptor--;
      kCentralFileHeader--;
      kEndOfCentralDir--;
      kZip64EndOfCentralDir--;
      kZip64EndOfCentralDirLocator--;
      }
      };
      static CMarkersInitializer g_MarkerInitializer;
      }

      i really wonder why they did this? do any body have read this code? Thanks

      D Offline
      D Offline
      Dracula Wang
      wrote on last edited by
      #2

      0x04034B50; 0x08074B50; 0x02014B50; 0x06054B50; 0x06064B50; 0x07064B50; those code are const, why add 1 and then sub 1?

      K 1 Reply Last reply
      0
      • D Dracula Wang

        0x04034B50; 0x08074B50; 0x02014B50; 0x06054B50; 0x06064B50; 0x07064B50; those code are const, why add 1 and then sub 1?

        K Offline
        K Offline
        KarstenK
        wrote on last edited by
        #3

        I guess for getting the number in the first instance. A second gets it lowered by 1.:~

        Greetings from Germany

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups