-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jas add compression methods two (#2407)
* Feature: add NCI attribute compression_method Use the NCI field spare2 to hold a 1 byte compression_method which will be used to determine which of the supported (distributed) compression methods will be used to compress this node. 1 --> 'standard' 2 --> 'gip' this is a work in progress. Still need: tcl_set_node - keep a stack of error strings since now we have a warning, which will keep going. tcl dir/full - display this tdi SETNCI and GETNCI treeshr (use the compression method) * Use the NCI field spare2 to hold a 1 byte compression_method which will be used to determine which of the supported (distributed) compression methods will be used to compress this node. 1 --> 'standard' 2 --> 'gip' this is a work in progress. Still need: tcl_set_node - keep a stack of error strings since now we have a warning, which will keep going. tcl dir/full - display this tdi SETNCI and GETNCI treeshr (use the compression method)
- Loading branch information
1 parent
7f0a492
commit 9829bf6
Showing
19 changed files
with
300 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef INTERNAL_NCIDEF_H | ||
#define INTERNAL_NCIDEF_H | ||
/************************************** | ||
_NCIDEF.H - definitions of constants | ||
used in to define compression method | ||
names and routines. | ||
**************************************/ | ||
|
||
|
||
typedef struct compression_method { | ||
char *name; | ||
char *method; | ||
char *image; | ||
} COMPRESSION_METHOD; | ||
|
||
#define DEFINE_COMPRESSION_METHODS \ | ||
static const COMPRESSION_METHOD compression_methods[] = {{"standard", NULL, NULL}, {"gzip", "gzip", "libMdsShr"}}; \ | ||
static const size_t NUM_COMPRESSION_METHODS = sizeof(compression_methods)/sizeof(COMPRESSION_METHOD); | ||
#endif //INTERNAL_NCIDEF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include <string.h> | ||
|
||
#include <mdsdescrip.h> | ||
#include <strroutines.h> | ||
|
||
#include <stdio.h> | ||
#include <stdarg.h> | ||
#include <zlib.h> | ||
|
||
//#define DEBUG | ||
|
||
#define UNUSED(x) (void)(x) | ||
|
||
EXPORT int gzip( | ||
const int *const nitems_ptr, | ||
const mdsdsc_a_t *const items_dsc_ptr, | ||
mdsdsc_a_t *const pack_dsc_ptr, | ||
int *const bit_ptr, | ||
mdsdsc_d_t * const pdximage, | ||
mdsdsc_d_t * const pdxentry | ||
) | ||
{ | ||
int ret; | ||
UNUSED(nitems_ptr); | ||
|
||
// unsigned long maxDestinationSize = compressBound(items_dsc_ptr->length); | ||
|
||
unsigned long pack_length = pack_dsc_ptr->arsize; | ||
static const DESCRIPTOR(image, "libMdsShr"); | ||
static const DESCRIPTOR(routine, "gunzip"); | ||
ret = compress( | ||
(Bytef *)pack_dsc_ptr->pointer, | ||
&pack_length, | ||
(Bytef *)items_dsc_ptr->pointer, | ||
items_dsc_ptr->arsize | ||
); | ||
|
||
if (ret != Z_OK) { | ||
return LibSTRTRU; | ||
} | ||
|
||
#ifdef DEBUG | ||
printf("gzip() %u => %lu\n", pack_dsc_ptr->arsize, pack_length); | ||
#endif | ||
// The new compressed length, in bits (for some reason) | ||
*bit_ptr = pack_length * 8; | ||
|
||
if (pdximage) { | ||
StrCopyDx((mdsdsc_t * const)pdximage, &image); | ||
} | ||
|
||
if (pdxentry) { | ||
StrCopyDx((mdsdsc_t * const)pdxentry, &routine); | ||
} | ||
#ifdef DEBUG | ||
printf("gzip() called successfully\n"); | ||
#endif | ||
return 1; | ||
} | ||
EXPORT int gunzip( | ||
int *const nitems_ptr, | ||
const mdsdsc_a_t *const pack_dsc_ptr, | ||
mdsdsc_a_t *const items_dsc_ptr, | ||
int *const bit_ptr | ||
) | ||
{ | ||
int ret; | ||
UNUSED(nitems_ptr); | ||
UNUSED(bit_ptr); | ||
unsigned long items_length = items_dsc_ptr->arsize; | ||
|
||
ret = uncompress( | ||
(Bytef *)items_dsc_ptr->pointer, | ||
&items_length, | ||
(Bytef *)pack_dsc_ptr->pointer, | ||
pack_dsc_ptr->arsize | ||
); | ||
|
||
if (ret != Z_OK) { | ||
return LibINVSTRDES; | ||
} | ||
#ifdef DEBUG | ||
printf("gunzip() called successfully\n"); | ||
#endif | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.