diff options
author | unknown <brian@zim.(none)> | 2007-01-21 11:41:00 -0800 |
---|---|---|
committer | unknown <brian@zim.(none)> | 2007-01-21 11:41:00 -0800 |
commit | d1fb6340e57a2aaf44ae4ab529eabd71dfe1fb64 (patch) | |
tree | 636cb8e2a45eeaff95bca7e1b301755235d87016 /storage/archive | |
parent | af23ddf6d2730649429763f690287ccf263f63d7 (diff) | |
download | mariadb-git-d1fb6340e57a2aaf44ae4ab529eabd71dfe1fb64.tar.gz |
Just adding support for a "minor" version number.
storage/archive/archive_reader.c:
Print minor information version.
storage/archive/archive_test.c:
Fixed test
storage/archive/azio.c:
Added support for "minor" version.
storage/archive/azlib.h:
Added information for minor information.
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/archive_reader.c | 3 | ||||
-rw-r--r-- | storage/archive/archive_test.c | 6 | ||||
-rw-r--r-- | storage/archive/azio.c | 6 | ||||
-rw-r--r-- | storage/archive/azlib.h | 28 |
4 files changed, 25 insertions, 18 deletions
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index 2e668cdb49d..1de398625dc 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -41,9 +41,10 @@ int main(int argc, char *argv[]) } printf("Version %u\n", reader_handle.version); - printf("\tStart position %llu\n", (unsigned long long)reader_handle.start); if (reader_handle.version > 2) { + printf("\tMinor version %u\n", reader_handle.minor_version); + printf("\tStart position %llu\n", (unsigned long long)reader_handle.start); printf("\tBlock size %u\n", reader_handle.block_size); printf("\tRows %llu\n", reader_handle.rows); printf("\tAutoincrement %llu\n", reader_handle.auto_increment); diff --git a/storage/archive/archive_test.c b/storage/archive/archive_test.c index f8d531d9f5e..2d79b954a1a 100644 --- a/storage/archive/archive_test.c +++ b/storage/archive/archive_test.c @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) azflush(&reader_handle, Z_SYNC_FLUSH); assert(reader_handle.rows == TEST_LOOP_NUM); assert(reader_handle.auto_increment == 0); - assert(reader_handle.check_point == 61); + assert(reader_handle.check_point == 62); assert(reader_handle.forced_flushes == 1); assert(reader_handle.dirty == AZ_STATE_SAVED); @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) azflush(&writer_handle, Z_SYNC_FLUSH); assert(writer_handle.rows == TEST_LOOP_NUM); assert(writer_handle.auto_increment == 4); - assert(writer_handle.check_point == 61); + assert(writer_handle.check_point == 62); assert(writer_handle.forced_flushes == 2); assert(writer_handle.dirty == AZ_STATE_SAVED); @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) azflush(&reader_handle, Z_SYNC_FLUSH); assert(reader_handle.rows == 102); assert(reader_handle.auto_increment == 4); - assert(reader_handle.check_point == 1255); + assert(reader_handle.check_point == 1256); assert(reader_handle.forced_flushes == 4); assert(reader_handle.dirty == AZ_STATE_SAVED); diff --git a/storage/archive/azio.c b/storage/archive/azio.c index c1483310119..fbb180e4604 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -17,7 +17,7 @@ #include <string.h> static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ -static int const az_magic[2] = {0xfe, 0x03}; /* az magic header */ +static int const az_magic[3] = {0xfe, 0x03, 0x01}; /* az magic header */ /* gzip flag byte */ #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ @@ -69,6 +69,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd) s->transparent = 0; s->mode = 'r'; s->version = (unsigned char)az_magic[1]; /* this needs to be a define to version */ + s->version = (unsigned char)az_magic[2]; /* minor version */ /* We do our own version of append by nature. @@ -155,12 +156,14 @@ void write_header(azio_stream *s) s->start = AZHEADER_SIZE + AZMETA_BUFFER_SIZE; s->block_size= AZ_BUFSIZE; s->version = (unsigned char)az_magic[1]; + s->minor_version = (unsigned char)az_magic[2]; /* Write a very simple .az header: */ memset(buffer, 0, AZHEADER_SIZE + AZMETA_BUFFER_SIZE); *(ptr + AZ_MAGIC_POS)= az_magic[0]; *(ptr + AZ_VERSION_POS)= (unsigned char)s->version; + *(ptr + AZ_MINOR_VERSION_POS)= (unsigned char)s->minor_version; *(ptr + AZ_BLOCK_POS)= (unsigned char)(s->block_size/1024); /* Reserved for block size */ *(ptr + AZ_STRATEGY_POS)= (unsigned char)Z_DEFAULT_STRATEGY; /* Compression Type */ @@ -314,6 +317,7 @@ void read_header(azio_stream *s, unsigned char *buffer) if (buffer[0] == az_magic[0] && buffer[1] == az_magic[1]) { s->version= (unsigned int)buffer[AZ_VERSION_POS]; + s->minor_version= (unsigned int)buffer[AZ_MINOR_VERSION_POS]; s->block_size= 1024 * buffer[AZ_BLOCK_POS]; s->start= (unsigned long long)uint8korr(buffer + AZ_START_POS); s->rows= (unsigned long long)uint8korr(buffer + AZ_ROW_POS); diff --git a/storage/archive/azlib.h b/storage/archive/azlib.h index 94ed45121cc..804532dfdbf 100644 --- a/storage/archive/azlib.h +++ b/storage/archive/azlib.h @@ -51,22 +51,23 @@ extern "C" { + sizeof(unsigned int) + sizeof(unsigned int) \ + sizeof(unsigned char) -#define AZHEADER_SIZE 20 +#define AZHEADER_SIZE 21 #define AZ_MAGIC_POS 0 #define AZ_VERSION_POS 1 -#define AZ_BLOCK_POS 2 -#define AZ_STRATEGY_POS 3 -#define AZ_FRM_POS 4 -#define AZ_META_POS 8 -#define AZ_START_POS 12 -#define AZ_ROW_POS 20 -#define AZ_FLUSH_POS 28 -#define AZ_CHECK_POS 36 -#define AZ_AUTOINCREMENT_POS 44 -#define AZ_LONGEST_POS 52 -#define AZ_SHORTEST_POS 56 -#define AZ_DIRTY_POS 60 +#define AZ_MINOR_VERSION_POS 2 +#define AZ_BLOCK_POS 3 +#define AZ_STRATEGY_POS 4 +#define AZ_FRM_POS 5 +#define AZ_META_POS 9 +#define AZ_START_POS 13 +#define AZ_ROW_POS 21 +#define AZ_FLUSH_POS 29 +#define AZ_CHECK_POS 37 +#define AZ_AUTOINCREMENT_POS 45 +#define AZ_LONGEST_POS 53 +#define AZ_SHORTEST_POS 57 +#define AZ_DIRTY_POS 61 /* @@ -210,6 +211,7 @@ typedef struct azio_stream { int back; /* one character push-back */ int last; /* true if push-back is last character */ unsigned char version; /* Version */ + unsigned char minor_version; /* Version */ unsigned int block_size; /* Block Size */ unsigned long long check_point; /* Last position we checked */ unsigned long long forced_flushes; /* Forced Flushes */ |