Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2004-04-16 19:55:16 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2004-04-16 19:55:16 +0400
commit39a8c014c4572f7f5f9ca099482929b67fe4273e (patch)
tree84224067db57aaa5717930d2c5703f7ab70f14f8 /source/blender
parent2cc124cf3b1281488c726b71090c1d2640e8078d (diff)
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue, sign, writeblenfile and writestreamglue. Sirdude was so kind to modify the makefiles, so SCons and Make are ready to build with the new Blender. Visual Studio workspaces, solutions and projectfiles still need to be updated (I'll do the .vcprojs and .sln myself after this commit). Runtimes created with the Blender Publisher are not anymore recognised - if you want these available, you'll have to convert them first to .blends with the Publisher.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/Makefile4
-rw-r--r--source/blender/SConscript5
-rw-r--r--source/blender/blenloader/BLO_readfile.h20
-rw-r--r--source/blender/blenloader/BLO_sys_types.h (renamed from source/blender/readstreamglue/BLO_sys_types.h)0
-rw-r--r--source/blender/blenloader/intern/readblenentry.c12
-rw-r--r--source/blender/blenloader/intern/readfile.c160
-rw-r--r--source/blender/blenloader/intern/writefile.c130
-rw-r--r--source/blender/decrypt/BLO_decrypt.h79
-rw-r--r--source/blender/decrypt/BLO_en_de_cryptHeader.h70
-rw-r--r--source/blender/decrypt/Makefile37
-rw-r--r--source/blender/decrypt/intern/BLO_decrypt.c398
-rw-r--r--source/blender/decrypt/intern/Makefile58
-rw-r--r--source/blender/decrypt/stub/BLO_decryptSTUB.c89
-rw-r--r--source/blender/decrypt/stub/Makefile51
-rw-r--r--source/blender/deflate/BLO_deflate.h59
-rw-r--r--source/blender/deflate/Makefile39
-rw-r--r--source/blender/deflate/SConscript17
-rw-r--r--source/blender/deflate/intern/BLO_deflate.c215
-rw-r--r--source/blender/deflate/intern/Makefile57
-rw-r--r--source/blender/deflate/stub/BLO_deflateSTUB.c56
-rw-r--r--source/blender/deflate/stub/Makefile55
-rw-r--r--source/blender/deflate/test/Makefile37
-rw-r--r--source/blender/deflate/test/stubbed/Makefile72
-rw-r--r--source/blender/deflate/test/stubbed/stubbed.c207
-rw-r--r--source/blender/encrypt/BLO_encrypt.h51
-rw-r--r--source/blender/encrypt/Makefile37
-rw-r--r--source/blender/encrypt/intern/BLO_encrypt.c235
-rw-r--r--source/blender/encrypt/intern/Makefile57
-rw-r--r--source/blender/inflate/BLO_in_de_flateHeader.h60
-rw-r--r--source/blender/inflate/BLO_inflate.h81
-rw-r--r--source/blender/inflate/Makefile37
-rw-r--r--source/blender/inflate/SConscript15
-rw-r--r--source/blender/inflate/intern/BLO_inflate.c436
-rw-r--r--source/blender/inflate/intern/Makefile55
-rw-r--r--source/blender/readblenfile/SConscript11
-rw-r--r--source/blender/readblenfile/intern/BLO_readblenfile.c555
-rw-r--r--source/blender/readstreamglue/BLO_keyStore.h78
-rw-r--r--source/blender/readstreamglue/BLO_readStreamErrors.h90
-rw-r--r--source/blender/readstreamglue/BLO_readStreamGlue.h97
-rw-r--r--source/blender/readstreamglue/Makefile37
-rw-r--r--source/blender/readstreamglue/SConscript17
-rw-r--r--source/blender/readstreamglue/intern/BLO_keyStorePrivate.h63
-rw-r--r--source/blender/readstreamglue/intern/BLO_readStreamGlue.c214
-rw-r--r--source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.c84
-rw-r--r--source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.h52
-rw-r--r--source/blender/readstreamglue/intern/Makefile59
-rw-r--r--source/blender/sign/BLO_sign.h51
-rw-r--r--source/blender/sign/Makefile37
-rw-r--r--source/blender/sign/intern/BLO_sign.c231
-rw-r--r--source/blender/sign/intern/Makefile60
-rw-r--r--source/blender/writeblenfile/BLO_writeblenfile.h61
-rw-r--r--source/blender/writeblenfile/Makefile37
-rw-r--r--source/blender/writeblenfile/SConscript18
-rw-r--r--source/blender/writeblenfile/intern/BLO_writeblenfile.c351
-rw-r--r--source/blender/writeblenfile/intern/Makefile58
-rw-r--r--source/blender/writeblenfile/test/Makefile54
-rw-r--r--source/blender/writeblenfile/test/test.c48
-rw-r--r--source/blender/writestreamglue/BLO_getPubKey.h37
-rw-r--r--source/blender/writestreamglue/BLO_writeStreamErrors.h86
-rw-r--r--source/blender/writestreamglue/BLO_writeStreamGlue.h91
-rw-r--r--source/blender/writestreamglue/Makefile38
-rw-r--r--source/blender/writestreamglue/SConscript20
-rw-r--r--source/blender/writestreamglue/intern/BLO_dumpFromMemory.c85
-rw-r--r--source/blender/writestreamglue/intern/BLO_dumpFromMemory.h39
-rw-r--r--source/blender/writestreamglue/intern/BLO_getPubKey.c77
-rw-r--r--source/blender/writestreamglue/intern/BLO_streamGlueControl.c94
-rw-r--r--source/blender/writestreamglue/intern/BLO_writeStreamGlue.c158
-rw-r--r--source/blender/writestreamglue/intern/Makefile64
-rw-r--r--source/blender/writestreamglue/stub/BLO_getPubKeySTUB.c54
-rw-r--r--source/blender/writestreamglue/stub/BLO_keyStoreSTUB.c62
-rw-r--r--source/blender/writestreamglue/stub/BLO_streamGlueControlSTUB.c89
-rw-r--r--source/blender/writestreamglue/stub/BLO_writeStreamGlueSTUB.c65
-rw-r--r--source/blender/writestreamglue/stub/Makefile55
-rw-r--r--source/blender/writestreamglue/test/Makefile37
-rw-r--r--source/blender/writestreamglue/test/readwritetest/Makefile76
-rw-r--r--source/blender/writestreamglue/test/readwritetest/readwritetest.c192
-rw-r--r--source/blender/writestreamglue/test/typetest/Makefile48
-rw-r--r--source/blender/writestreamglue/test/typetest/typetest.c98
78 files changed, 40 insertions, 6879 deletions
diff --git a/source/blender/Makefile b/source/blender/Makefile
index ad891aeb3c9..e4862f0d845 100644
--- a/source/blender/Makefile
+++ b/source/blender/Makefile
@@ -33,9 +33,7 @@
include nan_definitions.mk
-DIRS = blenloader
-DIRS += deflate inflate
-DIRS += writestreamglue readstreamglue writeblenfile readblenfile
+DIRS = blenloader readblenfile
DIRS += avi imbuf img render radiosity blenlib blenkernel blenpluginapi
DIRS += makesdna src renderconverter yafray
DIRS += python
diff --git a/source/blender/SConscript b/source/blender/SConscript
index 0efdb463ba9..2006888c9f7 100644
--- a/source/blender/SConscript
+++ b/source/blender/SConscript
@@ -5,20 +5,15 @@ SConscript(['avi/SConscript',
'blenlib/SConscript',
'blenloader/SConscript',
'blenpluginapi/SConscript',
- 'deflate/SConscript',
'imbuf/SConscript',
'img/SConscript',
- 'inflate/SConscript',
'makesdna/SConscript',
'python/SConscript',
'radiosity/SConscript',
'readblenfile/SConscript',
- 'readstreamglue/SConscript',
'render/SConscript',
'renderconverter/SConscript',
'src/SConscript',
- 'writeblenfile/SConscript',
- 'writestreamglue/SConscript',
'yafray/SConscript'])
if user_options_dict['USE_INTERNATIONAL'] == 1:
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 48f9886c61c..66b3729d860 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -215,26 +215,8 @@ int BLO_has_bfile_extension(char *str);
void BLO_library_append(struct SpaceFile *sfile, char *dir, int idcode);
+BlendFileData* blo_read_blendafterruntime(int file, int actualsize, BlendReadError *error_r);
-/* Ick ick ick, why are internal loader functions
- * being exported out of the loader? IMHO readstreamglue
- * should not need to know anything about the loader,
- * but this is a point of contention. - zr
- */
- void*
-blo_readstreamfile_begin(
- void *endControl);
-
- int
-blo_readstreamfile_process(
- void *filedataVoidPtr,
- unsigned char *data,
- unsigned int dataIn);
-
- int
-blo_readstreamfile_end(
- void *filedataVoidPtr);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/readstreamglue/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h
index 38dde20500e..38dde20500e 100644
--- a/source/blender/readstreamglue/BLO_sys_types.h
+++ b/source/blender/blenloader/BLO_sys_types.h
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 7797f4468d1..bf4a634e8ed 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -257,12 +257,6 @@ BlendFileData *BLO_read_from_file(char *file, BlendReadError *error_r) {
bfd->type= BLENFILETYPE_RUNTIME;
strcpy(bfd->main->name, file);
}
- } else {
- bfd= BLO_readblenfilename(file, error_r);
- if (bfd) {
- bfd->type= BLENFILETYPE_PUB;
- strcpy(bfd->main->name, file);
- }
}
return bfd;
@@ -280,12 +274,6 @@ BlendFileData *BLO_read_from_memory(void *mem, int memsize, BlendReadError *erro
strcpy(bfd->main->name, "");
}
blo_freefiledata(fd);
- } else {
- bfd= BLO_readblenfilememory(mem, memsize, error_r);
- if (bfd) {
- bfd->type= BLENFILETYPE_PUB;
- strcpy(bfd->main->name, "");
- }
}
return bfd;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index cc8163e5b73..cb241af6c4c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -128,9 +128,6 @@
#include "mydevice.h"
-
-
-
/*
Remark: still a weak point is the newadress() function, that doesnt solve reading from
multiple files at the same time
@@ -5067,154 +5064,31 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
}
}
-// ****************** STREAM GLUE READER **********************
-
-static int fd_read_from_streambuffer(FileData *filedata, void *buffer, int size)
-{
- int readsize = EOF;
- int type;
-
- if (size <= (filedata->inbuffer - filedata->seek)) {
- memmove(buffer, filedata->buffer + filedata->seek, size);
- filedata->seek += size;
- readsize = size;
- } else {
- // special ENDB handling
- if (((filedata->inbuffer - filedata->seek) == 8) && (size > 8)) {
- memmove(&type, filedata->buffer + filedata->seek, sizeof(type));
+/* reading runtime */
- if (type == ENDB) {
- memmove(buffer, filedata->buffer + filedata->seek, 8);
- readsize = 8;
- }
- }
- }
-
- return (readsize);
-}
-
-void *blo_readstreamfile_begin(void *endControl)
-{
- void **params = endControl;
-
+BlendFileData *blo_read_blendafterruntime(int file, int actualsize, BlendReadError *error_r) {
+ BlendFileData *bfd = NULL;
FileData *fd = filedata_new();
- fd->read = fd_read_from_streambuffer;
- fd->buffersize = 100000;
- fd->buffer = MEM_mallocN(fd->buffersize, "Buffer readstreamfile");
- fd->bfd_r = params[0];
- fd->error_r = params[1];
-
- return fd;
-}
+ fd->filedes = file;
+ fd->buffersize = actualsize;
+ fd->read = fd_read_from_file;
-int blo_readstreamfile_process(void *filedataVoidPtr, unsigned char *data, unsigned int dataIn)
-{
- struct FileData *filedata = filedataVoidPtr;
- int err = 0;
- int size, datasize;
- char *newbuffer;
- BHead8 bhead8;
- BHead4 bhead4;
-
- // copy everything in the buffer
-
- if (((int) dataIn + filedata->inbuffer) > filedata->buffersize) {
- // do we need a bigger buffer ?
- if (((int) dataIn + filedata->inbuffer - filedata->seek) > filedata->buffersize) {
- // copy data and ajust settings
- filedata->buffersize = dataIn + filedata->inbuffer - filedata->seek;
- newbuffer = MEM_mallocN(filedata->buffersize, "readstreamfile newbuffer");
- memmove(newbuffer, filedata->buffer + filedata->seek, filedata->inbuffer - filedata->seek);
- MEM_freeN(filedata->buffer);
- filedata->buffer = newbuffer;
- } else {
- // we just move the existing data to the start
- // of the block
- memmove(filedata->buffer, filedata->buffer + filedata->seek, filedata->inbuffer - filedata->seek);
- }
- // adjust seek and inbuffer accordingly
- filedata->inbuffer -= filedata->seek;
- filedata->seek = 0;
- }
-
- memmove(filedata->buffer + filedata->inbuffer, data, dataIn);
- filedata->inbuffer += dataIn;
-
- // OK, so now we have everything in one buffer. What are we
- // going to do with it...
-
- while (1) {
- datasize = filedata->inbuffer - filedata->seek;
-
- if (filedata->headerdone) {
- if (filedata->flags & FD_FLAGS_FILE_POINTSIZE_IS_4) {
- if (datasize > sizeof(bhead4)) {
- datasize -= sizeof(bhead4);
- memmove(&bhead4, filedata->buffer + filedata->seek, sizeof(bhead4));
- size = bhead4.len;
- } else {
- break;
- }
- } else {
- if (datasize > sizeof(bhead8)) {
- datasize -= sizeof(bhead8);
- memmove(&bhead8, filedata->buffer + filedata->seek, sizeof(bhead8));
- size = bhead8.len;
- } else {
- break;
- }
- }
+ decode_blender_header(fd);
- if (filedata->flags & FD_FLAGS_SWITCH_ENDIAN) {
- SWITCH_INT(size);
- }
-
- // do we have enough left in the buffer to read
- // in a full bhead + data ?
- if (size <= datasize) {
- get_bhead(filedata);
- } else {
- break;
- }
-
- } else {
- if (datasize < SIZEOFBLENDERHEADER) {
- // still need more data to continue..
- break;
- } else {
- decode_blender_header(filedata);
- filedata->headerdone = 1;
- if (! (filedata->flags & FD_FLAGS_FILE_OK)) {
- // not a blender file ... ?
- err = 1;
- break;
- }
- }
+ if (fd->flags & FD_FLAGS_FILE_OK) {
+ if (!read_file_dna(fd)) {
+ blo_freefiledata(fd);
+ fd= NULL;
+ return NULL;
}
- }
-
- return err;
-}
-
-int blo_readstreamfile_end(void *filedataVoidPtr)
-{
- struct FileData *fd = filedataVoidPtr;
- int err = 1;
-
- *fd->bfd_r= NULL;
- if (!(fd->flags & FD_FLAGS_FILE_OK)) {
- *fd->error_r= BRE_NOT_A_BLEND;
- } else if ((fd->inbuffer - fd->seek) != 8) {
- *fd->error_r= BRE_INCOMPLETE;
- } else if (!get_bhead(fd) || !read_file_dna(fd)) {
- // ENDB block !
- *fd->error_r= BRE_INCOMPLETE;
} else {
- *fd->bfd_r= blo_read_file_internal(fd, fd->error_r);
- err = 0;
+ blo_freefiledata(fd);
+ fd= NULL;
+ return NULL;
}
+ bfd= blo_read_file_internal(fd, error_r);
blo_freefiledata(fd);
- return err;
+ return bfd;
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index b7e510834aa..455eed82aaa 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -162,12 +162,6 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
#include "readfile.h"
#include "genfile.h"
-/* ******* MYWRITE ********* */
-
-#include "BLO_writeStreamGlue.h"
-
-/***/
-
typedef struct {
struct SDNA *sdna;
@@ -175,12 +169,9 @@ typedef struct {
unsigned char *buf;
int tot, count, error;
-
- int is_publisher;
- struct writeStreamGlueStruct *streamGlue;
} WriteData;
-static WriteData *writedata_new(int file, int is_publisher)
+static WriteData *writedata_new(int file)
{
extern char DNAstr[]; /* DNA.c */
extern int DNAlen;
@@ -193,7 +184,6 @@ static WriteData *writedata_new(int file, int is_publisher)
wd->sdna= dna_sdna_from_data(DNAstr, DNAlen, 0);
wd->file= file;
- wd->is_publisher= is_publisher;
wd->buf= MEM_mallocN(100000, "wd->buf");
@@ -203,13 +193,8 @@ static WriteData *writedata_new(int file, int is_publisher)
static void writedata_do_write(WriteData *wd, void *mem, int memlen)
{
if (wd->error) return;
-
- if (wd->is_publisher) {
- wd->error = writeStreamGlue(Global_streamGlueControl, &wd->streamGlue, mem, memlen, 0);
- } else {
- if (write(wd->file, mem, memlen) != memlen)
- wd->error= 1;
- }
+ if (write(wd->file, mem, memlen) != memlen)
+ wd->error= 1;
}
static void writedata_free(WriteData *wd)
@@ -222,7 +207,6 @@ static void writedata_free(WriteData *wd)
/***/
-struct streamGlueControlStruct *Global_streamGlueControl;
int mywfile;
/**
@@ -268,25 +252,7 @@ bgnwrite(
int file,
int write_flags)
{
- int is_publisher= (write_flags & (G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN | G_FILE_PUBLISH));
- WriteData *wd= writedata_new(file, is_publisher);
-
- if (is_publisher) {
- mywfile= file;
- wd->streamGlue = NULL;
- Global_streamGlueControl = streamGlueControlConstructor();
- streamGlueControlAppendAction(Global_streamGlueControl, DUMPFROMMEMORY);
- if (write_flags & G_FILE_COMPRESS) {
- streamGlueControlAppendAction(Global_streamGlueControl, DEFLATE);
- }
- if (write_flags & G_FILE_LOCK) {
- streamGlueControlAppendAction(Global_streamGlueControl, ENCRYPT);
- }
- if (write_flags & G_FILE_SIGN) {
- streamGlueControlAppendAction(Global_streamGlueControl, SIGN);
- }
- streamGlueControlAppendAction(Global_streamGlueControl, WRITEBLENFILE);
- }
+ WriteData *wd= writedata_new(file);
return wd;
}
@@ -307,88 +273,6 @@ endwrite(
writedata_do_write(wd, wd->buf, wd->count);
wd->count= 0;
}
- if (wd->is_publisher) {
- writeStreamGlue(Global_streamGlueControl, &wd->streamGlue, NULL, 0, 1);
- streamGlueControlDestructor(Global_streamGlueControl);
- // final writestream error handling goes here
- if (wd->error) {
- int err = wd->error;
- int errFunction = BWS_GETFUNCTION(err);
- int errGeneric = BWS_GETGENERR(err);
- int errSpecific = BWS_GETSPECERR(err);
- char *errFunctionStrings[] = {
- "",
- "The write stream",
- "The deflation",
- "The encryption",
- "The signing",
- "Writing the blendfile"
- };
- char *errGenericStrings[] = {
- "",
- "generated an out of memory error",
- "is not allowed in this version",
- "has problems with your key"
- };
- char *errWriteStreamGlueStrings[] = {
- "",
- "does not know how to proceed"
- };
- char *errDeflateStrings[] = {
- "",
- "bumped on a compress error"
- };
- char *errEncryptStrings[] = {
- "",
- "could not write the key",
- "bumped on an encrypt error"
- };
- char *errSignStrings[] = {
- "",
- "could not write the key",
- "failed"
- };
- char *errWriteBlenFileStrings[] = {
- "",
- "encountered problems writing the filedescription",
- "encountered problems writing the blendfile",
- "encountered problems writing one (or more) parameters"
- };
- char *errFunctionString= errFunctionStrings[errFunction];
- char *errExtraString= "";
-
- if (errGeneric)
- {
- errExtraString= errGenericStrings[errGeneric];
- }
- else if (errSpecific)
- {
- switch (errFunction)
- {
- case BWS_WRITESTREAMGLUE:
- errExtraString= errWriteStreamGlueStrings[errSpecific];
- break;
- case BWS_DEFLATE:
- errExtraString= errDeflateStrings[errSpecific];
- break;
- case BWS_ENCRYPT:
- errExtraString= errEncryptStrings[errSpecific];
- break;
- case BWS_SIGN:
- errExtraString= errSignStrings[errSpecific];
- break;
- case BWS_WRITEBLENFILE:
- errExtraString= errWriteBlenFileStrings[errSpecific];
- break;
- default:
- break;
- }
- }
-
- // call Blender error popup window
- error("%s %s", errFunctionString, errExtraString);
- }
- }
err= wd->error;
writedata_free(wd);
@@ -1739,8 +1623,7 @@ void BLO_write_runtime(char *file, char *exename) {
outfd= open(gamename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777);
if (outfd != -1) {
- /* Ensure runtime's are built with Publisher files */
- write_file_handle(outfd, 0, G.fileflags|G_FILE_PUBLISH);
+ write_file_handle(outfd, 0, G.fileflags);
if (write(outfd, " ", 1) != 1) {
cause= "Unable to write to output file";
@@ -1820,8 +1703,7 @@ void BLO_write_runtime(char *file, char *exename) {
datastart= lseek(outfd, 0, SEEK_CUR);
- /* Ensure runtime's are built with Publisher files */
- write_file_handle(outfd, 0, G.fileflags|G_FILE_PUBLISH);
+ write_file_handle(outfd, 0, G.fileflags);
if (!handle_write_msb_int(outfd, datastart) || (write(outfd, "BRUNTIME", 8)!=8)) {
cause= "Unable to write to output file";
diff --git a/source/blender/decrypt/BLO_decrypt.h b/source/blender/decrypt/BLO_decrypt.h
deleted file mode 100644
index 3d2f36b1c3b..00000000000
--- a/source/blender/decrypt/BLO_decrypt.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BLO_DECRYPT_H
-#define BLO_DECRYPT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DECRYPT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
-
-DECRYPT_DECLARE_HANDLE(BLO_decryptStructHandle);
-
-/**
- * openssl decrypt decompression initializer
- * @retval pointer to decrypt control structure
- */
- BLO_decryptStructHandle
-BLO_decrypt_begin(
- void *endControl);
-
-/**
- * openssl decrypt dataprocessor wrapper
- * @param BLO_decrypt Pointer to decrypt control structure
- * @param data Pointer to new data
- * @param dataIn New data amount
- * @retval streamGlueRead return value
- */
- int
-BLO_decrypt_process(
- BLO_decryptStructHandle BLO_decryptHandle,
- unsigned char *data,
- unsigned int dataIn);
-
-/**
- * openssl decrypt final call and cleanup
- * @param BLO_decrypt Pointer to decrypt control structure
- * @retval streamGlueRead return value
- */
- int
-BLO_decrypt_end(
- BLO_decryptStructHandle BLO_decryptHandle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_DECRYPT_H */
-
diff --git a/source/blender/decrypt/BLO_en_de_cryptHeader.h b/source/blender/decrypt/BLO_en_de_cryptHeader.h
deleted file mode 100644
index a555e66e800..00000000000
--- a/source/blender/decrypt/BLO_en_de_cryptHeader.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#ifndef BLO_EN_DE_CRYPT_H
-#define BLO_EN_DE_CRYPT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "BLO_sys_types.h"
-
-#ifdef FREE_WINDOWS
-typedef int int32_t;
-#endif
-
-#define EN_DE_CRYPTHEADERSTRUCTSIZE sizeof(struct BLO_en_de_cryptHeaderStruct)
-
-// Tests showed: pubKeyLen 64, cryptedKeyLen 64 bytes
-// So we pick 2*64 bytes + 2 bytes dummy tail for now :
-#define MAXPUBKEYLEN 130
-#define MAXCRYPTKEYLEN 130
-
-struct BLO_en_de_cryptHeaderStruct {
- uint8_t magic; // poor mans header recognize check
- uint32_t length; // how much crypted data is there
- uint8_t pubKey[MAXPUBKEYLEN];
- uint32_t pubKeyLen; // the actual pubKey length
- uint8_t cryptedKey[MAXCRYPTKEYLEN];
- int32_t cryptedKeyLen; // the actual cryptedKey length (NOTE: signed)
- uint32_t datacrc; // crypted data checksum
- uint32_t headercrc; // header minus crc itself checksum
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_EN_DE_CRYPT_H */
-
diff --git a/source/blender/decrypt/Makefile b/source/blender/decrypt/Makefile
deleted file mode 100644
index 7418d4407ae..00000000000
--- a/source/blender/decrypt/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/decrypt
-DIRS = intern stub
-
-include nan_subdirs.mk
diff --git a/source/blender/decrypt/intern/BLO_decrypt.c b/source/blender/decrypt/intern/BLO_decrypt.c
deleted file mode 100644
index 76fdfab2cca..00000000000
--- a/source/blender/decrypt/intern/BLO_decrypt.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * openssl decryption wrapper library
- */
-
-#include <stdio.h>
-#include <string.h> /* memcpy, strcpy */
-#include <stdlib.h>
-
-#include "openssl/rsa.h"
-#include "openssl/rc4.h"
-#include "openssl/err.h"
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_getPubKey.h" // real and stub implemented at writestream ...
-
-#include "BLO_readStreamGlue.h"
-#include "BLO_decrypt.h"
-#include "BLO_en_de_cryptHeader.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-struct decryptStructType {
- struct readStreamGlueStruct *streamGlue;
- unsigned int streamDone;
- unsigned char *deCryptKey;
- int deCryptKeyLen; // NOTE: signed int
- unsigned char headerbuffer[EN_DE_CRYPTHEADERSTRUCTSIZE];
- uint32_t datacrc; // crypted data checksum
- struct BLO_en_de_cryptHeaderStruct *streamHeader;
- RC4_KEY rc4_key;
- void *endControl;
-};
-
- BLO_decryptStructHandle
-BLO_decrypt_begin(
- void *endControl)
-{
- struct decryptStructType *control;
- control = malloc(sizeof(struct decryptStructType));
- if (!control) return NULL;
-
- control->streamGlue = NULL;
- control->streamDone = 0;
- control->deCryptKey = NULL;
- control->deCryptKeyLen = 0;
- strcpy(control->headerbuffer, "");
- control->datacrc = 0;
-
- control->streamHeader = malloc(EN_DE_CRYPTHEADERSTRUCTSIZE);
- if (!control->streamHeader) {
- free(control);
- return NULL;
- }
-
- control->streamHeader->magic = 0;
- control->streamHeader->length = 0;
- strcpy(control->streamHeader->pubKey, "");
- control->streamHeader->pubKeyLen = 0;
- strcpy(control->streamHeader->cryptedKey, "");
- control->streamHeader->cryptedKeyLen = 0;
- control->streamHeader->datacrc = 0;
- control->streamHeader->headercrc = 0;
- control->endControl = endControl;
-
- return((BLO_decryptStructHandle) control);
-}
-
- int
-BLO_decrypt_process(
- BLO_decryptStructHandle BLO_decryptHandle,
- unsigned char *data,
- unsigned int dataIn)
-{
- int err = 0;
- struct decryptStructType *BLO_decrypt =
- (struct decryptStructType *) BLO_decryptHandle;
-
- if (!BLO_decrypt) {
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_NULL);
- return err;
- }
-
- /* First check if we have our header filled in yet */
- if (BLO_decrypt->streamHeader->cryptedKeyLen == 0) {
- unsigned int processed;
- if (dataIn == 0) return err; /* really need data to do anything */
- processed = ((dataIn + BLO_decrypt->streamDone) <=
- EN_DE_CRYPTHEADERSTRUCTSIZE)
- ? dataIn : EN_DE_CRYPTHEADERSTRUCTSIZE;
- memcpy(BLO_decrypt->headerbuffer + BLO_decrypt->streamDone,
- data, processed);
- BLO_decrypt->streamDone += processed;
- dataIn -= processed;
- data += processed;
- if (BLO_decrypt->streamDone == EN_DE_CRYPTHEADERSTRUCTSIZE) {
- /* we have the whole header, absorb it */
- struct BLO_en_de_cryptHeaderStruct *header;
- uint32_t crc;
- //static unsigned char rsa_e[] = "\x11";
- static unsigned char rsa_e[] = "\x01\x00\x01";
- RSA *rsa = NULL;
- unsigned char *publisherPubKey;
- int publisherPubKeyLen;
-
- header = (struct BLO_en_de_cryptHeaderStruct *)
- BLO_decrypt->headerbuffer;
- crc = crc32(0L, (const Bytef *) header,
- EN_DE_CRYPTHEADERSTRUCTSIZE - 4);
-
- if (header->magic == 'A') {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_en_de_cryptHeaderStruct Magic confirmed\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR BLO_en_de_cryptHeaderStruct Magic NOT confirmed\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_MAGIC);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
-
- if (crc == ntohl(header->headercrc)) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_en_de_cryptHeader CRC correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR BLO_en_de_cryptHeader CRC NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_CRCHEADER);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
- BLO_decrypt->streamHeader->length = ntohl(header->length);
- BLO_decrypt->streamHeader->pubKeyLen = ntohl(header->pubKeyLen);
- memcpy(BLO_decrypt->streamHeader->pubKey, header->pubKey,
- BLO_decrypt->streamHeader->pubKeyLen);
-
- // case Publisher: get the .BPkey public key
- // case Player/Plugin: simply use the data stream public key
- err = getPubKey(BLO_decrypt->streamHeader->pubKey,
- BLO_decrypt->streamHeader->pubKeyLen,
- &publisherPubKey,
- &publisherPubKeyLen);
- switch (err) {
- case 0:
- // everything OK
- break;
- case 1:
- // publisher without a key
- case 2:
- // publishers keylen !=
- case 3:
- // publishers key !=
- default:
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ALERT users-pubKey != datastream-pubKey, stop reading\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETSPECERR(BRS_NOTOURPUBKEY);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- break;
- }
-
- BLO_decrypt->streamHeader->cryptedKeyLen =
- ntohl(header->cryptedKeyLen);
- memcpy(BLO_decrypt->streamHeader->cryptedKey,
- header->cryptedKey,
- BLO_decrypt->streamHeader->cryptedKeyLen);
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_decrypt_process gets %u bytes\n",
- (unsigned int) BLO_decrypt->streamHeader->length);
-#endif
- BLO_decrypt->streamHeader->datacrc = ntohl(header->datacrc);
-
- // finished absorbing and testing the header, create rsa key from it
- rsa = RSA_new();
- if (rsa == NULL) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error in RSA_new\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETSPECERR(BRS_RSANEWERROR);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
- // static exponent
- rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
-
- // public part into rsa->n
- rsa->n = BN_bin2bn(publisherPubKey,
- publisherPubKeyLen,
- rsa->n);
-
- //DEBUG RSA_print_fp(stdout, rsa, 0);
-
- BLO_decrypt->deCryptKey = malloc(RSA_size(rsa) *
- sizeof(unsigned char));
- if (! BLO_decrypt->deCryptKey) {
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_MALLOC);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- RSA_free(rsa);
- return err;
- }
-
- // decrypt the cryptkey
- BLO_decrypt->deCryptKeyLen = RSA_public_decrypt(
- BLO_decrypt->streamHeader->cryptedKeyLen,
- BLO_decrypt->streamHeader->cryptedKey,
- BLO_decrypt->deCryptKey,
- rsa, RSA_PKCS1_PADDING);
- if (BLO_decrypt->deCryptKeyLen == -1) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error in RSA_public_decrypt %s\n",
- ERR_error_string(ERR_get_error(),
- NULL));
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETSPECERR(BRS_DECRYPTERROR);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- RSA_free(rsa);
- return err;
- }
-
- // Finally set the RC4 deCryptKey
- RC4_set_key(&(BLO_decrypt->rc4_key),
- BLO_decrypt->deCryptKeyLen,
- BLO_decrypt->deCryptKey);
-
- RSA_free(rsa);
- }
- }
-
- /* Is there really (still) new data available ? */
- if (dataIn > 0) {
- unsigned char *deCryptBuf = malloc(dataIn);
- if (! deCryptBuf) {
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_MALLOC);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
-
- BLO_decrypt->streamDone += dataIn;
-
- // update datacrc
- BLO_decrypt->datacrc = crc32(
- BLO_decrypt->datacrc, (const Bytef *) data, dataIn);
-
- // TODO FIXME we might need to keylength-align the data !
- RC4(&(BLO_decrypt->rc4_key), dataIn, data, deCryptBuf);
-
- // give data to streamGlueRead, it will find out what to do next
- err = readStreamGlue(
- BLO_decrypt->endControl,
- &(BLO_decrypt->streamGlue),
- (unsigned char *) deCryptBuf,
- dataIn);
-
- free(deCryptBuf);
- }
- return err;
-}
-
-/**
- * openssl decrypt final call and cleanup
- * @param BLO_decrypt Pointer to decrypt control structure
- * @retval streamGlueRead return value
- */
- int
-BLO_decrypt_end(
- BLO_decryptStructHandle BLO_decryptHandle)
-{
- int err = 0;
- struct decryptStructType *BLO_decrypt =
- (struct decryptStructType *) BLO_decryptHandle;
-
- if (!BLO_decrypt) {
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_NULL);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
-
- if (BLO_decrypt->streamDone == BLO_decrypt->streamHeader->length +
- EN_DE_CRYPTHEADERSTRUCTSIZE) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Crypted data length is correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Crypted data length is NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_DATALEN);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
-
- if (BLO_decrypt->datacrc == BLO_decrypt->streamHeader->datacrc) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Crypted data CRC is correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Crypted data CRC is NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_CRCDATA);
- if (BLO_decrypt->streamGlue) free(BLO_decrypt->streamGlue);
- if (BLO_decrypt->streamHeader) free(BLO_decrypt->streamHeader);
- if (BLO_decrypt->deCryptKey) free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
- return err;
- }
-
- free(BLO_decrypt->streamGlue);
- free(BLO_decrypt->streamHeader);
- free(BLO_decrypt->deCryptKey);
- free(BLO_decrypt);
-
- return err;
-}
-
diff --git a/source/blender/decrypt/intern/Makefile b/source/blender/decrypt/intern/Makefile
deleted file mode 100644
index 281e9015e3b..00000000000
--- a/source/blender/decrypt/intern/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = decrypt
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../readstreamglue
-
-# ugly hack for decrypt/pubkey
-CPPFLAGS += -I../../writestreamglue
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/decrypt/stub/BLO_decryptSTUB.c b/source/blender/decrypt/stub/BLO_decryptSTUB.c
deleted file mode 100644
index e11aafc9ca7..00000000000
--- a/source/blender/decrypt/stub/BLO_decryptSTUB.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * decrypt STUB
- */
-
-#include <stdio.h>
-
-#include "GEN_messaging.h"
-
-#include "BLO_readStreamErrors.h"
-#include "BLO_decrypt.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- BLO_decryptStructHandle
-BLO_decrypt_begin(
- void *endControl)
-{
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error BLO_decrypt_begin is a stub\n");
-#endif
- return (NULL);
-}
-
- int
-BLO_decrypt_process(
- BLO_decryptStructHandle BLO_decryptHandle,
- unsigned char *data,
- unsigned int dataIn)
-{
- int err = 0;
- BLO_decryptHandle = NULL;
- data = NULL;
- dataIn = 0;
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error BLO_decrypt_process is a stub\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_STUB);
- return (err);
-}
-
- int
-BLO_decrypt_end(
- BLO_decryptStructHandle BLO_decryptHandle)
-{
- int err = 0;
- BLO_decryptHandle = NULL;
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error BLO_decrypt_end is a stub\n");
-#endif
- err = BRS_SETFUNCTION(BRS_DECRYPT) |
- BRS_SETGENERR(BRS_STUB);
- return (err);
-}
-
diff --git a/source/blender/decrypt/stub/Makefile b/source/blender/decrypt/stub/Makefile
deleted file mode 100644
index 61c601a5182..00000000000
--- a/source/blender/decrypt/stub/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = decryptSTUB
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-CPPFLAGS += -I../../readstreamglue
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-
diff --git a/source/blender/deflate/BLO_deflate.h b/source/blender/deflate/BLO_deflate.h
deleted file mode 100644
index 8d7f9ff07e0..00000000000
--- a/source/blender/deflate/BLO_deflate.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * zlib deflate compression wrapper library interface
- */
-
-#ifndef BLO_DEFLATE_H
-#define BLO_DEFLATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * zlib deflate dataprocessor wrapper
- * @param data Pointer to raw input data
- * @param dataIn Raw data input amount
- * @param streamGlueHeader Our streamGlueHeaderStruct
- * @retval streamGlueWrite return value
- */
- int
-BLO_deflate(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_DEFLATE_H */
-
diff --git a/source/blender/deflate/Makefile b/source/blender/deflate/Makefile
deleted file mode 100644
index 397f72614c9..00000000000
--- a/source/blender/deflate/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-#
-
-SOURCEDIR = source/blender/deflate
-DIRS = intern
-TESTDIRS = test
-
-include nan_subdirs.mk
diff --git a/source/blender/deflate/SConscript b/source/blender/deflate/SConscript
deleted file mode 100644
index 400c290f4e4..00000000000
--- a/source/blender/deflate/SConscript
+++ /dev/null
@@ -1,17 +0,0 @@
-Import ('extra_includes')
-Import ('user_options_dict')
-Import ('library_env')
-
-deflate_env = library_env.Copy ()
-
-source_files = ['intern/BLO_deflate.c']
-
-deflate_env.Append (CPPPATH = ['.',
- '../../kernel/gen_messaging',
- '../writestreamglue',
- '../readstreamglue',
- '../inflate'])
-
-deflate_env.Append (CPPPATH=user_options_dict['Z_INCLUDE'])
-deflate_env.Append (CPPPATH=extra_includes)
-deflate_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_deflate', source=source_files)
diff --git a/source/blender/deflate/intern/BLO_deflate.c b/source/blender/deflate/intern/BLO_deflate.c
deleted file mode 100644
index 385b53e8e7a..00000000000
--- a/source/blender/deflate/intern/BLO_deflate.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * zlib deflate compression wrapper library
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_writeStreamGlue.h"
-#include "BLO_deflate.h"
-#include "BLO_in_de_flateHeader.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// TODO use other error function
-static int CHECK_ERR(int err, char *msg);
-
-static int CHECK_ERR(int err, char *msg) {
- if (err != Z_OK) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "%s error: %d\n",
- msg,
- err);
-#endif
- return 1;
- }
- return 0;
-}
-
- int
-BLO_deflate(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader)
-{
- int zlib_err; /* zlib error */
- int err = 0; /* our own error */
- z_stream c_stream; /* compression stream */
- char dictionary[50];
- Bytef *compressBuf; /* minimally sized output buffer for deflate */
- uInt compressSize; /* minimally sized compressBuf size in bytes */
- struct writeStreamGlueStruct *streamGlue = NULL;
- struct BLO_in_de_flateHeaderStruct BLO_in_de_flateHeader;
- char* errmsg1 = "deflateInit";
- char* errmsg2 = "deflateSetDictionary";
- char* errmsg3 = "deflateEnd";
-
- // TODO use dictionary index, this is id = 1 :
- strcpy(dictionary, "sure this is not a number");
-
- compressSize = (dataIn * 1.1) + 12;
- compressBuf = (Bytef *)malloc(compressSize);
- if (!compressBuf) {
- err = BWS_SETFUNCTION(BWS_DEFLATE) |
- BWS_SETGENERR(BWS_MALLOC);
- return err;
- }
-
- c_stream.next_out = compressBuf;
- c_stream.avail_out = compressSize;
- c_stream.next_in = data;
- c_stream.avail_in = dataIn;
-
- c_stream.zalloc = (alloc_func)0;
- c_stream.zfree = (free_func)0;
- c_stream.opaque = (voidpf)0;
-
- zlib_err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
- if (CHECK_ERR(zlib_err, errmsg1)) {
- err = BWS_SETFUNCTION(BWS_DEFLATE) |
- BWS_SETSPECERR(BWS_DEFLATEERROR);
- free(compressBuf);
- return err;
- }
-
- zlib_err = deflateSetDictionary(&c_stream,
- (const Bytef*)dictionary,
- strlen(dictionary));
- if (CHECK_ERR(zlib_err, errmsg2)) {
- err = BWS_SETFUNCTION(BWS_DEFLATE) |
- BWS_SETSPECERR(BWS_DEFLATEERROR);
- free(compressBuf);
- return err;
- }
-
- // Compress it
- zlib_err = deflate(&c_stream, Z_FINISH);
- if (zlib_err != Z_STREAM_END) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "deflate should report Z_STREAM_END\n");
-#endif
- // (avail_out == 0) possibility ? Should not, because we
- // malloc by the minimal needed amount rule
- err = BWS_SETFUNCTION(BWS_DEFLATE) |
- BWS_SETSPECERR(BWS_DEFLATEERROR);
- free(compressBuf);
- return err;
- }
-
- zlib_err = deflateEnd(&c_stream);
- if (CHECK_ERR(zlib_err, errmsg3)) {
- err = BWS_SETFUNCTION(BWS_DEFLATE) |
- BWS_SETSPECERR(BWS_DEFLATEERROR);
- free(compressBuf);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_deflate compressed %ld bytes to %ld (%.0f%%)\n",
- c_stream.total_in, c_stream.total_out,
- 100. * (float)c_stream.total_out / (float)c_stream.total_in);
-
- fprintf(GEN_errorstream,
- "BLO_deflate writes streamGlueHeader of %u bytes\n",
- STREAMGLUEHEADERSIZE);
-#endif
- // Update streamGlueHeader that initiated us and write it away
- streamGlueHeader->totalStreamLength =
- htonl(IN_DE_FLATEHEADERSTRUCTSIZE + c_stream.total_out);
- streamGlueHeader->crc = htonl(crc32(0L, (const Bytef *) streamGlueHeader,
- STREAMGLUEHEADERSIZE - 4));
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) streamGlueHeader,
- STREAMGLUEHEADERSIZE,
- 0);
- if (err) {
- free(compressBuf);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_deflate writes BLO_in_de_flateHeader of %u bytes\n",
- IN_DE_FLATEHEADERSTRUCTSIZE);
-#endif
-
- // write out our header
- BLO_in_de_flateHeader.magic = 'B';
- BLO_in_de_flateHeader.compressedLength = htonl(c_stream.total_out);
- BLO_in_de_flateHeader.uncompressedLength = htonl(c_stream.total_in);
- BLO_in_de_flateHeader.dictionary_id = htonl(1);
- BLO_in_de_flateHeader.dictId = htonl(c_stream.adler); // adler checksum
- BLO_in_de_flateHeader.crc = htonl(crc32(0L,
- (const Bytef *) &BLO_in_de_flateHeader, IN_DE_FLATEHEADERSTRUCTSIZE-4));
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) &BLO_in_de_flateHeader,
- IN_DE_FLATEHEADERSTRUCTSIZE,
- 0);
- if (err) {
- free(compressBuf);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_deflate writes %lu bytes raw data (total %lu)\n",
- c_stream.total_out, STREAMGLUEHEADERSIZE +
- IN_DE_FLATEHEADERSTRUCTSIZE + c_stream.total_out);
-#endif
-
- // finally write all compressed data
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) compressBuf,
- c_stream.total_out,
- 1);
-
- free(compressBuf);
-
- return err;
-}
-
diff --git a/source/blender/deflate/intern/Makefile b/source/blender/deflate/intern/Makefile
deleted file mode 100644
index b6811f2d130..00000000000
--- a/source/blender/deflate/intern/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = deflate
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../writestreamglue
-CPPFLAGS += -I../../readstreamglue
-CPPFLAGS += -I../../inflate
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/deflate/stub/BLO_deflateSTUB.c b/source/blender/deflate/stub/BLO_deflateSTUB.c
deleted file mode 100644
index fc0b038bc0a..00000000000
--- a/source/blender/deflate/stub/BLO_deflateSTUB.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * zlib deflate compression library stub
- */
-
-#include <stdio.h>
-
-#include "GEN_messaging.h"
-#include "BLO_streamglue.h"
-#include "BLO_deflate.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- int
-BLO_deflate(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader)
-{
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error BLO_deflate is a stub");
-#endif
- return(NULL);
-}
-
diff --git a/source/blender/deflate/stub/Makefile b/source/blender/deflate/stub/Makefile
deleted file mode 100644
index 55f3211e2c9..00000000000
--- a/source/blender/deflate/stub/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = deflateSTUB
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../streamglue
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/deflate/test/Makefile b/source/blender/deflate/test/Makefile
deleted file mode 100644
index 25116d51f5c..00000000000
--- a/source/blender/deflate/test/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/deflate/test
-DIRS = stubbed
-
-include nan_subdirs.mk
diff --git a/source/blender/deflate/test/stubbed/Makefile b/source/blender/deflate/test/stubbed/Makefile
deleted file mode 100644
index e8b597f068d..00000000000
--- a/source/blender/deflate/test/stubbed/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Make a little test for the sys_types replacement.
-#
-
-DIR = $(OCGDIR)/blender/deflate/test
-ALLTARGETS = $(DIR)/stubbed_test
-
-include nan_compile.mk
-
-CFLAGS += -funsigned-char
-
-# this module's header
-CPPFLAGS += -I../..
-
-# external headers
-CPPFLAGS += -I../../../readstreamglue
-CPPFLAGS += -I../../../writestreamglue
-
-#################################################################
-# libs
-TESTLIBS = $(OCGDIR)/blender/deflate/$(DEBUG_DIR)libdeflate.a
-TESTLIBS += $(OCGDIR)/blender/writestreamglueSTUB/$(DEBUG_DIR)libwritestreamglueSTUB.a
-TESTLIBS += $(OCGDIR)/kernel/gen_messaging/$(DEBUG_DIR)libgen_messaging.a
-
-ifeq ($(OS),$(findstring $(OS), "freebsd linux"))
- TESTLIBS += -lz
-endif
-
-ifeq ($(OS),windows)
- TESTLIBS += ws2_32.lib
- TESTLIBS += $(NAN_ZLIB)/lib/libz.a
-endif
-
-# There's hardly anything to debug here, so forget about it.
-$(DIR)/stubbed_test: $(OBJS)
- $(CC) $(OBJS) $(TESTLIBS) -o $(DIR)/stubbed_test
-
-clean::
- $(RM) $(DIR)/stubbed_test
-
-test:: $(DIR)/stubbed_test
- $(DIR)/stubbed_test $(NAN_TEST_VERBOSITY)
diff --git a/source/blender/deflate/test/stubbed/stubbed.c b/source/blender/deflate/test/stubbed/stubbed.c
deleted file mode 100644
index 9f1d03e780e..00000000000
--- a/source/blender/deflate/test/stubbed/stubbed.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/*
- * Unit test for the deflater
- *
- * The deflater compresses data, using the zlib compression
- * library. The BLO_deflate module wraps this. It writes the
- * compressed data as well.
- *
- * Tested functions
- *
- * - BLO_deflate (from BLO_deflate.h)
- *
- * Commandline arguments: <verbosity>
- * verbosity: 0 - print nothing
- * 1 - print the results only
- * 2 - print everything
- *
- * */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "BLO_deflate.h"
-#include "BLO_writeStreamGlue.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-struct streamGlueControlStruct *Global_streamGlueControl;
-
-void printStreamGlueHeader(struct streamGlueHeaderStruct *s)
-{
- int i = 0;
- char* c;
-
- fprintf(stderr,"| |- streamGlueHeader: %p\n",
- s);
- fprintf(stderr,"| |- magic: %c\n",
- s->magic);
- fprintf(stderr,"| |- totalStreamLength: %x hex (%x reversed),"
- " %d dec (%d reversed)\n",
- s->totalStreamLength,
- ntohl(s->totalStreamLength),
- s->totalStreamLength,
- ntohl(s->totalStreamLength));
- fprintf(stderr,"| |- dataProcessorType: %d (%d reversed)\n",
- s->dataProcessorType,
- ntohl(s->dataProcessorType));
- fprintf(stderr,"| |- crc: %x hex, (%d dec)\n",
- s->crc,
- s->crc);
- fprintf(stderr,"|\n");
- fprintf(stderr,"|-- Memory dump (starting at %p):", s);
- c = (char*) s;
- for(i = 0; i < STREAMGLUEHEADERSIZE; i+=4, c+=4)
- fprintf(stderr,"%02x%02x%02x%02x-",
- *c,
- *(c+1) ,
- *(c+2),
- *(c+3) );
- fprintf(stderr,"\n|\n");
-
-}
-
-
-
-int main (int argc, char *argv[])
-{
- int verbose = 0;
- int error_status = 0;
- int retval = 0;
- struct streamGlueHeaderStruct *streamGlueHeader;
- int datachunksize = 12345;
- char* datachunk = NULL;
- int i = 0;
- char* dataptr = NULL;
- int sghsize = 0;
-
- switch (argc) {
- case 2:
- verbose = atoi(argv[1]);
- if (verbose < 0) verbose = 0;
- break;
- case 1:
- default:
- verbose = 0;
- }
-
- /* ----------------------------------------------------------------- */
- if (verbose > 0) {
- fprintf(stderr,"\n*** Deflate test with stubs\n|\n");
- }
- /* ----------------------------------------------------------------- */
- /* We need:
- * 1 - a data chunk
- * 2 - the bytecount
- * 3 - a streamglueheader
- * The streamglueheader contains some stats about the datachunk.
- */
-
- /* because of stupid lib dependencies. */
- Global_streamGlueControl = streamGlueControlConstructor();
-
-
- /* 2: the size */
- datachunksize = 12345;
-
- /* 1: a data chunk. We fill it with some numbers */
- datachunk = (char*) malloc(datachunksize);
-
- /* an ascending-ish thingy */
- dataptr = datachunk;
- for (i = 0 ;
- i < datachunksize;
- i++, dataptr++) {
- *dataptr = (i % 0xFF);
- }
-
- /* 3: the streamglue header */
- sghsize = STREAMGLUEHEADERSIZE;
- if (verbose > 1) {
- fprintf(stderr,"|-- Allocating %d bytes for the header.\n",
- sghsize);
- }
- streamGlueHeader = malloc(sghsize);
- streamGlueHeader->magic = 'A';
- streamGlueHeader->totalStreamLength = 0;
- streamGlueHeader->dataProcessorType =
- htonl(0x2);
- streamGlueHeader->crc = 0;
-
-
- if (verbose > 1) {
- fprintf(stderr,"|\n");
- fprintf(stderr,"|-- Will call BLO_deflate with args:\n");
- fprintf(stderr,"| |- datachunk pointing to %p\n",
- datachunk);
- fprintf(stderr,"| |- datachunksize: %d\n",
- datachunksize);
- printStreamGlueHeader(streamGlueHeader);
- fprintf(stderr,"| \n");
- }
-
- retval =
- BLO_deflate(
- datachunk,
- datachunksize,
- streamGlueHeader);
-
- if (verbose > 1) {
- fprintf(stderr,"|-- BLO_deflate returned %d \n", retval);
- }
-
- if (verbose > 1) {
- fprintf(stderr,"|\n");
- fprintf(stderr,"|-- Arguments are now:\n");
- fprintf(stderr,"|-- Will call BLO_deflate with args:\n");
- fprintf(stderr,"| |- datachunk pointing to %p\n",
- datachunk);
- fprintf(stderr,"| |- datachunksize: %d\n",
- datachunksize);
- printStreamGlueHeader(streamGlueHeader);
- fprintf(stderr,"| \n");
- }
-
-
- /* ----------------------------------------------------------------- */
- if (verbose > 0) {
- fprintf(stderr,"|\n*** Finished test\n\n");
- }
- exit(error_status);
-}
-
-/* eof */
diff --git a/source/blender/encrypt/BLO_encrypt.h b/source/blender/encrypt/BLO_encrypt.h
deleted file mode 100644
index 22b9e6f6300..00000000000
--- a/source/blender/encrypt/BLO_encrypt.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BLO_ENCRYPT_H
-#define BLO_ENCRYPT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- int
-BLO_encrypt(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_ENCRYPT_H */
-
diff --git a/source/blender/encrypt/Makefile b/source/blender/encrypt/Makefile
deleted file mode 100644
index 4dbd71af099..00000000000
--- a/source/blender/encrypt/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/encrypt
-DIRS = intern
-
-include nan_subdirs.mk
diff --git a/source/blender/encrypt/intern/BLO_encrypt.c b/source/blender/encrypt/intern/BLO_encrypt.c
deleted file mode 100644
index 3353a1fd69f..00000000000
--- a/source/blender/encrypt/intern/BLO_encrypt.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * openssl/crypt rc4 crypto wrapper library
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef _WIN32
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
-#include "openssl/rc4.h"
-#include "openssl/rand.h"
-#include "openssl/rsa.h"
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_keyStore.h"
-#include "BLO_writeStreamGlue.h"
-#include "BLO_en_de_cryptHeader.h"
-#include "BLO_encrypt.h"
-
- int
-BLO_encrypt(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader)
-{
- int err = 0;
- struct writeStreamGlueStruct *streamGlue = NULL;
- struct BLO_en_de_cryptHeaderStruct BLO_en_de_cryptHeader;
- RC4_KEY *rc4_key;
- unsigned char *cryptBuf = NULL;
- byte *pubKey, *privKey;
- int pubKeyLen, privKeyLen;
- int cryptKeyLen = 16;
- int cryptedKeyLen;
- byte cryptKey[16]; // FIXME cryptKeyLen];
- RSA *rsa = NULL;
- byte *cryptedKey;
- static unsigned char rsa_e[] = "\x01\x00\x01";
-
- cryptBuf = malloc(dataIn);
- if (!cryptBuf) {
- err = BWS_SETFUNCTION(BWS_ENCRYPT) |
- BWS_SETGENERR(BWS_MALLOC);
- return err;
- }
-
- rc4_key = malloc(sizeof(RC4_KEY));
- if (!rc4_key) {
- err = BWS_SETFUNCTION(BWS_ENCRYPT) |
- BWS_SETGENERR(BWS_MALLOC);
- free(cryptBuf);
- return err;
- }
-
-#ifdef _WIN32
-#ifndef FREE_WINDOWS
- RAND_screen();
-#endif
-#endif
- RAND_bytes(cryptKey, cryptKeyLen);
-
- RC4_set_key(rc4_key, cryptKeyLen, cryptKey);
- RC4(rc4_key, dataIn, data, cryptBuf);
-
- free(rc4_key);
-
- // Update streamGlueHeader that initiated us and write it away
- streamGlueHeader->totalStreamLength =
- htonl(EN_DE_CRYPTHEADERSTRUCTSIZE + dataIn);
- streamGlueHeader->crc = htonl(crc32(0L,
- (const Bytef *) streamGlueHeader, STREAMGLUEHEADERSIZE - 4));
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_encrypt writes streamGlueHeader of %u bytes\n",
- STREAMGLUEHEADERSIZE);
-#endif
-
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *)streamGlueHeader,
- STREAMGLUEHEADERSIZE,
- 0);
- if (err) {
- free(cryptBuf);
- return err;
- }
-
- pubKeyLen = keyStoreGetPubKey(&pubKey);
- privKeyLen = keyStoreGetPrivKey(&privKey);
- if ((pubKeyLen == 0) || (privKeyLen == 0)) {
- err = BWS_SETFUNCTION(BWS_ENCRYPT) |
- BWS_SETGENERR(BWS_RSA);
- free(cryptBuf);
- return err;
- }
-
- rsa = RSA_new();
- if (rsa == NULL) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error in RSA_new\n");
-#endif
- err = BWS_SETFUNCTION(BWS_ENCRYPT) |
- BWS_SETSPECERR(BWS_RSANEWERROR);
- free(cryptBuf);
- return err;
- }
- // static exponent
- rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
-
- // public part into rsa->n
- rsa->n = BN_bin2bn(pubKey, pubKeyLen, rsa->n);
-
- // private part into rsa->d
- rsa->d = BN_bin2bn(privKey, privKeyLen, rsa->d);
-
- //DEBUG RSA_print_fp(stdout, rsa, 0);
-
- cryptedKey = malloc(RSA_size(rsa) * sizeof(byte));
- if (!cryptedKey) {
- err = BWS_SETFUNCTION(BWS_ENCRYPT) |
- BWS_SETGENERR(BWS_MALLOC);
- free(cryptBuf);
- RSA_free(rsa);
- return err;
- }
-
- // crypt the cryptkey
- cryptedKeyLen = RSA_private_encrypt(cryptKeyLen, cryptKey, cryptedKey,
- rsa, RSA_PKCS1_PADDING);
- if (cryptedKeyLen == -1) {
- // TODO real error handling
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error in RSA_private_encrypt\n");
-#endif
- err = BWS_SETFUNCTION(BWS_ENCRYPT) |
- BWS_SETSPECERR(BWS_ENCRYPTERROR);
- free(cryptBuf);
- free(cryptedKey);
- RSA_free(rsa);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_encrypt writes BLO_en_de_cryptHeader of %u bytes\n",
- EN_DE_CRYPTHEADERSTRUCTSIZE);
-#endif
-
- // write out our header
- BLO_en_de_cryptHeader.magic = 'A';
- BLO_en_de_cryptHeader.length = htonl(dataIn);
- memcpy(BLO_en_de_cryptHeader.pubKey, pubKey, pubKeyLen);
- BLO_en_de_cryptHeader.pubKeyLen = htonl(pubKeyLen);
- memcpy(BLO_en_de_cryptHeader.cryptedKey, cryptedKey, cryptedKeyLen);
- BLO_en_de_cryptHeader.cryptedKeyLen = htonl(cryptedKeyLen);
- BLO_en_de_cryptHeader.datacrc = htonl(crc32(0L,
- (const Bytef *) cryptBuf, dataIn));
- BLO_en_de_cryptHeader.headercrc = htonl(crc32(0L,
- (const Bytef *) &BLO_en_de_cryptHeader, EN_DE_CRYPTHEADERSTRUCTSIZE-4));
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) &BLO_en_de_cryptHeader,
- EN_DE_CRYPTHEADERSTRUCTSIZE,
- 0);
- if (err) {
- free(cryptBuf);
- free(cryptedKey);
- RSA_free(rsa);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_encrypt writes %u bytes raw data (total %u)\n",
- dataIn,
- STREAMGLUEHEADERSIZE + EN_DE_CRYPTHEADERSTRUCTSIZE + dataIn);
-#endif
-
- // finally write all crypted data
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) cryptBuf,
- dataIn,
- 1);
-
- free(cryptBuf);
- free(cryptedKey);
- RSA_free(rsa);
-
- return err;
-}
-
diff --git a/source/blender/encrypt/intern/Makefile b/source/blender/encrypt/intern/Makefile
deleted file mode 100644
index 1ee2a0b5da2..00000000000
--- a/source/blender/encrypt/intern/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = encrypt
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../writestreamglue
-CPPFLAGS += -I../../readstreamglue
-CPPFLAGS += -I../../decrypt
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/inflate/BLO_in_de_flateHeader.h b/source/blender/inflate/BLO_in_de_flateHeader.h
deleted file mode 100644
index 6504dd66a80..00000000000
--- a/source/blender/inflate/BLO_in_de_flateHeader.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * zlib inflate and deflate stream header
- */
-
-#ifndef BLO_IN_DE_FLATE_H
-#define BLO_IN_DE_FLATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "BLO_sys_types.h"
-
-#define IN_DE_FLATEHEADERSTRUCTSIZE sizeof(struct BLO_in_de_flateHeaderStruct)
-
-/* POSIX datatypes, use BYTEORDER(3) */
-struct BLO_in_de_flateHeaderStruct {
- uint8_t magic; /* poor mans header recognize check */
- uint32_t compressedLength; /* how much compressed data is there */
- uint32_t uncompressedLength; /* how much uncompressed data there is */
- uint32_t dictionary_id; /* which dictionary are we using */
- uint32_t dictId; /* Adler32 value of the dictionary */
- uint32_t crc; /* header minus crc itself checksum */
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_IN_DE_FLATE_H */
-
diff --git a/source/blender/inflate/BLO_inflate.h b/source/blender/inflate/BLO_inflate.h
deleted file mode 100644
index 7e8895e95dc..00000000000
--- a/source/blender/inflate/BLO_inflate.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * zlib inflate decompression wrapper library interface
- */
-
-#ifndef BLO_INFLATE_H
-#define BLO_INFLATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define INFLATE_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
-
-INFLATE_DECLARE_HANDLE(BLO_inflateStructHandle);
-
-/**
- * zlib inflate decompression initializer
- * @retval pointer to inflate control structure
- */
-
- BLO_inflateStructHandle
-BLO_inflate_begin(
- void *endControl);
-
-/**
- * zlib inflate dataprocessor wrapper
- * @param BLO_inflate Pointer to inflate control structure
- * @param data Pointer to new data
- * @param dataIn New data amount
- * @retval streamGlueRead return value
- */
- int
-BLO_inflate_process(
- BLO_inflateStructHandle BLO_inflate_handle,
- unsigned char *data,
- unsigned int dataIn);
-
-/**
- * zlib inflate final call and cleanup
- * @param BLO_inflate Pointer to inflate control structure
- * @retval streamGlueRead return value
- */
- int
-BLO_inflate_end(
- BLO_inflateStructHandle BLO_inflate_handle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_INFLATE_H */
-
diff --git a/source/blender/inflate/Makefile b/source/blender/inflate/Makefile
deleted file mode 100644
index b19cfacf78a..00000000000
--- a/source/blender/inflate/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/inflate
-DIRS = intern
-
-include nan_subdirs.mk
diff --git a/source/blender/inflate/SConscript b/source/blender/inflate/SConscript
deleted file mode 100644
index 54d2ae487d4..00000000000
--- a/source/blender/inflate/SConscript
+++ /dev/null
@@ -1,15 +0,0 @@
-Import ('extra_includes')
-Import ('user_options_dict')
-Import ('library_env')
-
-inflate_env = library_env.Copy ()
-
-source_files = ['intern/BLO_inflate.c']
-
-inflate_env.Append (CPPPATH = ['.',
- '../../kernel/gen_messaging',
- '../readstreamglue'])
-
-inflate_env.Append (CPPPATH = user_options_dict['Z_INCLUDE'])
-inflate_env.Append (CPPPATH = extra_includes)
-inflate_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_inflate', source=source_files)
diff --git a/source/blender/inflate/intern/BLO_inflate.c b/source/blender/inflate/intern/BLO_inflate.c
deleted file mode 100644
index 3d5f132d2ea..00000000000
--- a/source/blender/inflate/intern/BLO_inflate.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * zlib inflate decompression wrapper library
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_readStreamGlue.h"
-#include "BLO_in_de_flateHeader.h" /* used by deflate and inflate */
-
-#include "BLO_inflate.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// TODO use other error function
-static int CHECK_ERR(int err, char *msg);
-
-static int CHECK_ERR(int err, char *msg)
-{
- if (err != Z_OK) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "%s error: %d\n",
- msg,
- err);
-#endif
- return 1;
- }
- return 0;
-}
-
-struct inflateStructType {
- uInt compresSize; /* fixed compresBuf size in bytes */
- Bytef *compresBuf; /* reusable fixed size output buffer for inflate */
- struct readStreamGlueStruct *streamGlue;
- struct BLO_in_de_flateHeaderStruct *streamHeader;
- unsigned int streamDone;
- unsigned char headerbuffer[IN_DE_FLATEHEADERSTRUCTSIZE];
- z_stream d_stream; /* decompression stream */
- char dictionary[50];
- uLong dictId; /* Adler32 value of the dictionary */
- void *endControl;
-};
-
-/**
- * zlib inflate decompression initializer
- * @retval pointer to inflate control structure
- */
- BLO_inflateStructHandle
-BLO_inflate_begin(
- void *endControl)
-{
- int err = 0; /* our own error */
- char *errmessage = "inflateInit";
-
- struct inflateStructType *control;
- control = malloc(sizeof(struct inflateStructType));
- if (!control) return NULL;
-
- control->compresSize = (100000 * 1.1) + 12;
- control->compresBuf = (Bytef *)malloc(control->compresSize);
- if (!control->compresBuf) {
- free(control);
- return NULL;
- }
-
- control->streamGlue = NULL;
- control->streamHeader = malloc(IN_DE_FLATEHEADERSTRUCTSIZE);
- if (!control->streamHeader) {
- free(control->compresBuf);
- free(control);
- return NULL;
- }
-
- control->streamHeader->magic = 0;
- control->streamHeader->compressedLength = 0;
- control->streamHeader->uncompressedLength = 0;
- control->streamHeader->dictionary_id = 0;
- control->streamHeader->dictId = 0;
- control->streamHeader->crc = 0;
- control->streamDone = 0;
- memset(control->headerbuffer, 0, IN_DE_FLATEHEADERSTRUCTSIZE);
- control->d_stream.zalloc = (alloc_func)0;
- control->d_stream.zfree = (free_func)0;
- control->d_stream.opaque = (voidpf)0;
- // TODO use dictionary index, this is id = 1 :
- strcpy(control->dictionary, "sure this is not a number");
-
- /* we need to rewire this to also return err */
- err = inflateInit(&(control->d_stream));
- err = CHECK_ERR(err, errmessage);
- if (err) {
- free(control->compresBuf);
- free(control->streamHeader);
- free(control);
- return NULL;
- }
-
- control->dictId = control->d_stream.adler;
-
- control->d_stream.next_out = control->compresBuf;
- control->d_stream.avail_out = control->compresSize;
-
- control->d_stream.next_in = NULL;
- control->d_stream.avail_in = 0;
-
- control->endControl = endControl;
- return((BLO_inflateStructHandle) control);
-}
-
-/**
- * zlib inflate dataprocessor wrapper
- * @param BLO_inflate Pointer to inflate control structure
- * @param data Pointer to new data
- * @param dataIn New data amount
- * @retval streamGlueRead return value
- */
- int
-BLO_inflate_process(
- BLO_inflateStructHandle BLO_inflate_handle,
- unsigned char *data,
- unsigned int dataIn)
-{
- int zlib_err = 0;
- int err = 0;
- char *errmsg1 = "inflateSetDictionary";
-
- struct inflateStructType *BLO_inflate =
- (struct inflateStructType *) BLO_inflate_handle;
-
- if (!BLO_inflate) {
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETGENERR(BRS_NULL);
- return err;
- }
-
- /* First check if we have our header filled in yet */
- if (BLO_inflate->streamHeader->compressedLength == 0) {
- unsigned int processed;
- if (dataIn == 0) return err; /* really need data to do anything */
- processed = ((dataIn + BLO_inflate->streamDone) <=
- IN_DE_FLATEHEADERSTRUCTSIZE)
- ? dataIn : IN_DE_FLATEHEADERSTRUCTSIZE;
- memcpy(BLO_inflate->headerbuffer + BLO_inflate->streamDone,
- data, processed);
- BLO_inflate->streamDone += processed;
- dataIn -= processed;
- data += processed;
- if (BLO_inflate->streamDone == IN_DE_FLATEHEADERSTRUCTSIZE) {
- /* we have the whole header, absorb it */
- struct BLO_in_de_flateHeaderStruct *header;
- uint32_t crc;
- header = (struct BLO_in_de_flateHeaderStruct *)
- BLO_inflate->headerbuffer;
- BLO_inflate->streamHeader->compressedLength =
- ntohl(header->compressedLength);
- BLO_inflate->streamHeader->uncompressedLength =
- ntohl(header->uncompressedLength);
- BLO_inflate->streamHeader->dictId =
- ntohl(header->dictId);
- BLO_inflate->streamHeader->dictionary_id =
- ntohl(header->dictionary_id);
- crc = crc32(0L, (const Bytef *) header,
- IN_DE_FLATEHEADERSTRUCTSIZE - 4);
-
- if (header->magic == 'B') {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_in_de_flateHeaderStruct Magic confirmed\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR BLO_in_de_flateHeaderStruct Magic NOT confirmed\n");
-#endif
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETGENERR(BRS_MAGIC);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- }
-
- if (crc == ntohl(header->crc)) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_in_de_flateHeader CRC correct\n");
-#endif
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR BLO_in_de_flateHeader CRC NOT correct\n");
-#endif
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETGENERR(BRS_CRCHEADER);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_inflate_process gets %u compressed bytes, will be %u uncompressed\n",
- (unsigned int) BLO_inflate->streamHeader->compressedLength,
- (unsigned int) BLO_inflate->streamHeader->uncompressedLength);
-#endif
-
- }
- }
-
- /* Is there really (still) new data available ? */
- if (dataIn > 0) {
- int inflateWantsToLoopAgain = 0;
- BLO_inflate->d_stream.next_in = data;
- BLO_inflate->d_stream.avail_in = dataIn;
- do {
- zlib_err = inflate(&(BLO_inflate->d_stream), Z_SYNC_FLUSH);
- if (zlib_err == Z_NEED_DICT) {
- // TODO we can use BLO_inflate->d_stream.adler (it has
- // multiple uses) to select the dictionary to use. This is id=1
- zlib_err = inflateSetDictionary(&(BLO_inflate->d_stream),
- (const Bytef*)BLO_inflate->dictionary,
- strlen(BLO_inflate->dictionary));
- err = CHECK_ERR(zlib_err, errmsg1);
- if (err) {
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETSPECERR(BRS_INFLATEERROR);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- }
-
- // go again
- zlib_err = inflate(&(BLO_inflate->d_stream), Z_SYNC_FLUSH);
- }
- if (zlib_err == Z_STREAM_END) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Note: inflate returned Z_STREAM_END\n");
-#endif
- } else if (zlib_err != Z_OK) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "Error: inflate should return Z_OK, not %d\n", zlib_err);
-#endif
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETSPECERR(BRS_INFLATEERROR);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- }
- if (BLO_inflate->d_stream.avail_out == 0) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Note: inflate needs more output space, loop again %u\n",
- (unsigned int) BLO_inflate->d_stream.avail_in);
-#endif
- inflateWantsToLoopAgain = 1;
- } else {
-#ifndef NDEBUG
- if (inflateWantsToLoopAgain == 1)
- fprintf(GEN_errorstream,
- "Note: this is inflates last loop\n");
-#endif
- inflateWantsToLoopAgain = 0;
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream, "inflated %u to %u (flushes) err=%d\n",
- dataIn,
- (unsigned int) (BLO_inflate->compresSize - BLO_inflate->d_stream.avail_out),
- err);
-#endif
- }
-
- // give data to streamGlueRead, it will find out what to do next
- err = readStreamGlue(
- BLO_inflate->endControl,
- &(BLO_inflate->streamGlue),
- BLO_inflate->compresBuf,
- BLO_inflate->compresSize - BLO_inflate->d_stream.avail_out);
- BLO_inflate->d_stream.next_out = BLO_inflate->compresBuf;
- BLO_inflate->d_stream.avail_out = BLO_inflate->compresSize;
- } while (inflateWantsToLoopAgain == 1);
- }
- return err;
-}
-
-/**
- * zlib inflate final call and cleanup
- * @param BLO_inflate Pointer to inflate control structure
- * @retval streamGlueRead return value
- */
- int
-BLO_inflate_end(
- BLO_inflateStructHandle BLO_inflate_handle)
-{
- char *errmsg2 = "inflateEnd";
- int err = 0;
- int zlib_err = 0;
- struct inflateStructType *BLO_inflate =
- (struct inflateStructType *) BLO_inflate_handle;
- // TODO perhaps check streamHeader->totalStreamLength
-
- if (!BLO_inflate) {
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETGENERR(BRS_NULL);
- return err;
- }
-
- BLO_inflate->d_stream.avail_in = 0;
- // Note: do not also set BLO_inflate->d_stream.next_in to NULL, it
- // is illegal (zlib.h:374) and causes a Z_STREAM_ERROR
-
- zlib_err = inflate(&(BLO_inflate->d_stream), Z_FINISH);
- if (zlib_err != Z_STREAM_END) {
-#ifdef NDEBUG
- fprintf(GEN_errorstream,
- "inflate should report Z_STREAM_END, not %d\n",
- err);
-
- if (BLO_inflate->d_stream.avail_out == 0) {
- fprintf(GEN_errorstream,
- "Error: inflate wanted more output buffer space\n");
- // Note that we CANNOT inflate-loop again !
- // But this should never happen because we Z_SYNC_FLUSH
- }
-#endif
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETSPECERR(BRS_INFLATEERROR);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- }
-
- zlib_err = inflateEnd(&(BLO_inflate->d_stream));
- err = CHECK_ERR(zlib_err, errmsg2);
- if (err) {
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETSPECERR(BRS_INFLATEERROR);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- }
-
- if (BLO_inflate->d_stream.adler != BLO_inflate->dictId) {
- // data was corrupted
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Failed adler checksum\n");
-#endif
- err = BRS_SETFUNCTION(BRS_INFLATE) |
- BRS_SETGENERR(BRS_CRCDATA);
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
- return err;
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Passed adler checksum\n");
-#endif
- }
-
- /* ready decompressing */
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "DeCompressed %ld bytes to %ld (%.0f%%)\n",
- BLO_inflate->d_stream.total_in, BLO_inflate->d_stream.total_out,
- 100. * (float)BLO_inflate->d_stream.total_out /
- (float)BLO_inflate->d_stream.total_in);
-#endif
-
- err = readStreamGlue(
- BLO_inflate->endControl,
- &(BLO_inflate->streamGlue),
- BLO_inflate->compresBuf,
- BLO_inflate->compresSize - BLO_inflate->d_stream.avail_out);
-
- BLO_inflate->d_stream.next_out = BLO_inflate->compresBuf;
- BLO_inflate->d_stream.avail_out = BLO_inflate->compresSize;
-
- if (BLO_inflate->streamGlue) free(BLO_inflate->streamGlue);
- if (BLO_inflate->streamHeader) free(BLO_inflate->streamHeader);
- if (BLO_inflate->compresBuf) free(BLO_inflate->compresBuf);
- free(BLO_inflate);
-
- return err;
-}
-
diff --git a/source/blender/inflate/intern/Makefile b/source/blender/inflate/intern/Makefile
deleted file mode 100644
index 9582b6c81c6..00000000000
--- a/source/blender/inflate/intern/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = inflate
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_1_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../readstreamglue
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/readblenfile/SConscript b/source/blender/readblenfile/SConscript
index 69671732055..32c474d1eb6 100644
--- a/source/blender/readblenfile/SConscript
+++ b/source/blender/readblenfile/SConscript
@@ -6,9 +6,12 @@ readblenfile_env = library_env.Copy ()
source_files = ['intern/BLO_readblenfile.c']
readblenfile_env.Append (CPPPATH = ['.',
- '../readstreamglue',
- '../blenloader',
- '../blenkernel',
- '../../kernel/gen_messaging'])
+ '../readstreamglue',
+ '../blenloader',
+ '../blenloader/intern',
+ '../blenkernel',
+ '../blenlib',
+ '../makesdna',
+ '../../kernel/gen_messaging'])
readblenfile_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_readblenfile', source=source_files)
diff --git a/source/blender/readblenfile/intern/BLO_readblenfile.c b/source/blender/readblenfile/intern/BLO_readblenfile.c
index 902066fbbeb..698fed79842 100644
--- a/source/blender/readblenfile/intern/BLO_readblenfile.c
+++ b/source/blender/readblenfile/intern/BLO_readblenfile.c
@@ -50,14 +50,12 @@
#include <unistd.h> // read
#endif
-#include "BLO_readStreamGlue.h"
-
#include "BLO_readfile.h"
#include "BLO_readblenfile.h"
#include "BKE_blender.h"
-#define CACHESIZE 100000
+#include "BLI_blenlib.h"
/** Magic number for the file header */
char *headerMagic = "BLENDFI";
@@ -94,470 +92,7 @@ void BLO_setcurrentversionnumber(char array[4])
#define O_BINARY 0
#endif
-/**
- * Defines the data struct for the .blend file
- */
-struct BLO_readblenfileStruct {
- struct readStreamGlueStruct *streamGlue;
- int fileDes;
- unsigned int cacheSize;
- unsigned int inCache;
- unsigned int leftToRead;
- unsigned int Seek;
-
- int (*read)(struct BLO_readblenfileStruct *readblenfileStruct, void *buffer, int size);
-
- char *readCache;
- char *fromBuffer;
- int fromBufferSize;
- char crInBuffer;
- char removeCR;
-};
-
-// declare static functions
-
-static int readfromfilehandle(
- struct BLO_readblenfileStruct *readblenfileStruct,
- void *buffer,
- int size);
-
-static int readfrommemory(
- struct BLO_readblenfileStruct *readblenfileStruct,
- void *buffer,
- int size);
-
-static int fillcache(
- struct BLO_readblenfileStruct *readblenfileStruct);
-
-static unsigned int readfromcache(
- struct BLO_readblenfileStruct *readblenfileStruct,
- void * buffer,
- unsigned int size);
-
-static BlendFileData *readblenfilegeneric(
- struct BLO_readblenfileStruct *readblenfileStruct,
- BlendReadError *error_r);
-
-// implementation of static functions
-
-/**
- * \brief Reads data from the already opened file.
- * Given the file structure a buffer and the size of the block
- * the function will read from the file if it is open.
- * If not it will return -1 indicating an unopened file.
- *
- * \return Returns the size of the file read, or -1.
- */
-static int readfromfilehandle(
- struct BLO_readblenfileStruct *readblenfileStruct,
- void *buffer,
- int size)
-{
- int readsize = -1;
-
- if (readblenfileStruct->fileDes != -1) {
- readsize = read(readblenfileStruct->fileDes, buffer, size);
- }
-
- return(readsize);
-}
-
-/**
- * \brief Reads and erases from readblenfileStruct->fromBuffer
- *
- * Copies information from the from the fromBuffer to the buffer, then
- * decrements the size of the fromBuffer, and moves the pointer along
- * thereby effectively removing the data forever.
- *
- * \return Returns the size of the read from memory
- */
-static int readfrommemory(
- struct BLO_readblenfileStruct *readblenfileStruct,
- void *buffer,
- int size)
-{
- int readsize = -1;
-
- if (readblenfileStruct->fromBuffer) {
- if (size > readblenfileStruct->fromBufferSize) {
- size = readblenfileStruct->fromBufferSize;
- }
-
- memcpy(buffer, readblenfileStruct->fromBuffer, size);
- readblenfileStruct->fromBufferSize -= size;
- readblenfileStruct->fromBuffer += size;
-
- readsize = size;
- }
-
- return(readsize);
-}
-
-/**
- * Read in data from the file into a cache.
- *
- * \return Returns the size of the read.
- *
- * \attention Note: there is some code missing to return CR if the
- * structure indicates it.
-*/
-static int fillcache(
- struct BLO_readblenfileStruct *readblenfileStruct)
-{
- int readsize;
- int toread;
-
- // how many bytes can we read ?
-
- toread = readblenfileStruct->leftToRead;
-
- if (toread > readblenfileStruct->cacheSize) {
- toread = readblenfileStruct->cacheSize;
- }
-
- readsize = readblenfileStruct->read(readblenfileStruct, readblenfileStruct->readCache, toread);
- if (readsize > 0) {
- if (readblenfileStruct->removeCR) {
- // do some stuff here
- }
- readblenfileStruct->inCache = readsize;
- readblenfileStruct->leftToRead -= readsize;
- }
-
- return (readsize);
-}
-
-/**
- * \brief Read data from the cache into a buffer.
- * Marks the last read location with a seek value.
- *
- * \return Returns the size of the read from the cache.
- *
- * \attention Note: missing some handling code if the location is
- * \attention outside of the cache.
- */
-static unsigned int readfromcache(
- struct BLO_readblenfileStruct *readblenfileStruct,
- void * buffer,
- unsigned int size)
-{
- unsigned int readsize = 0;
-
- if (readblenfileStruct->inCache - readblenfileStruct->Seek > size) {
- memcpy(buffer, readblenfileStruct->readCache + readblenfileStruct->Seek, size);
- readblenfileStruct->Seek += size;
- readsize = size;
- } else {
- // handle me
- }
-
- return(readsize);
-}
-
-/**
- * \brief Converts from BRS error code to BRE error code.
- *
- * Error conversion method to convert from
- * the BRS type errors and return a BRE
- * type error code.
- * Decodes based on the function, the generic,
- * and the specific portions of the error.
- */
-static BlendReadError brs_to_bre(int err)
-{
- int errFunction = BRS_GETFUNCTION(err);
- int errGeneric = BRS_GETGENERR(err);
- int errSpecific = BRS_GETSPECERR(err);
-
- if (errGeneric) {
- switch (errGeneric) {
- case BRS_MALLOC:
- return BRE_OUT_OF_MEMORY;
- case BRS_NULL:
- return BRE_INTERNAL_ERROR;
- case BRS_MAGIC:
- return BRE_NOT_A_BLEND;
- case BRS_CRCHEADER:
- case BRS_CRCDATA:
- return BRE_CORRUPT;
- case BRS_DATALEN:
- return BRE_INCOMPLETE;
- case BRS_STUB:
- return BRE_NOT_A_BLEND;
- }
- } else if (errSpecific) {
- switch (errFunction) {
- case BRS_READSTREAMGLUE:
- switch (errSpecific) {
- case BRS_UNKNOWN:
- return BRE_INTERNAL_ERROR;
- }
- break;
- case BRS_READSTREAMFILE:
- switch (errSpecific) {
- case BRS_NOTABLEND:
- return BRE_NOT_A_BLEND;
- case BRS_READERROR:
- return BRE_UNABLE_TO_READ;
- }
- break;
- case BRS_INFLATE:
- switch (errSpecific) {
- case BRS_INFLATEERROR:
- return BRE_CORRUPT;
- }
- break;
- case BRS_DECRYPT:
- switch (errSpecific) {
- case BRS_RSANEWERROR:
- return BRE_INTERNAL_ERROR;
- case BRS_DECRYPTERROR:
- return BRE_INTERNAL_ERROR;
- case BRS_NOTOURPUBKEY:
- return BRE_NOT_ALLOWED;
- }
- break;
- case BRS_VERIFY:
- switch (errSpecific) {
- case BRS_RSANEWERROR:
- return BRE_INTERNAL_ERROR;
- case BRS_SIGFAILED:
- return BRE_INTERNAL_ERROR;
- }
- break;
- }
- }
-
- return BRE_INVALID;
-}
-
-static BlendFileData *readblenfilegeneric(
- struct BLO_readblenfileStruct *readblenfileStruct,
- BlendReadError *error_r)
-{
- BlendFileData *bfd= NULL;
- unsigned char reserved[BLO_RESERVEDSIZE];
- uint8_t minversion[4];
- uint8_t myversion[4];
- uint8_t version[4];
- uint8_t flags[4];
- void *parms[2];
- int filesize;
-
- parms[0]= &bfd;
- parms[1]= error_r;
-
- BLO_setcurrentversionnumber(myversion);
-
- readblenfileStruct->cacheSize = CACHESIZE;
- readblenfileStruct->readCache = malloc(readblenfileStruct->cacheSize);
-
- if (fillcache(readblenfileStruct) <= 0) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (readfromcache(readblenfileStruct, minversion, sizeof(minversion)) != sizeof(minversion)) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (memcmp(minversion, myversion, sizeof(minversion)) > 0) {
- *error_r = BRE_TOO_NEW;
- } else if (readfromcache(readblenfileStruct, version, sizeof(version)) != sizeof(version)) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (readfromcache(readblenfileStruct, flags, sizeof(flags)) != sizeof(flags)) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (readfromcache(readblenfileStruct, &filesize, sizeof(filesize)) != sizeof(filesize)) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (readfromcache(readblenfileStruct, reserved, sizeof(reserved)) != sizeof(reserved)) {
- *error_r = BRE_UNABLE_TO_READ;
- } else {
- filesize = ntohl(filesize);
-
- // substract number of bytes we've
- // been handling outside readfromcache()
- filesize -= strlen(headerMagic);
- filesize--;
-
- if (filesize < readblenfileStruct->inCache) {
- // we've allready read more than we're supposed to
- readblenfileStruct->inCache = filesize;
- readblenfileStruct->leftToRead = 0;
- } else {
- //
- readblenfileStruct->leftToRead = filesize - readblenfileStruct->inCache;
- }
-
- do {
- int err;
-
- *error_r = BRE_NONE;
- err = readStreamGlue(
- parms,
- &(readblenfileStruct->streamGlue),
- readblenfileStruct->readCache + readblenfileStruct->Seek,
- readblenfileStruct->inCache - readblenfileStruct->Seek);
-
- readblenfileStruct->inCache = 0;
- readblenfileStruct->Seek = 0;
-
- if (err) {
- bfd = NULL;
-
- /* If *error_r != BRE_NONE then it is
- * blo_readstreamfile_end signaling an error
- * in the loading code. Otherwise it is some
- * other part of the streamglue system signalling
- * and error so we convert the BRS error into
- * a BRE error.
- *
- * Does this have to be so convoluted? No.
- */
- if (*error_r == BRE_NONE) {
- *error_r = brs_to_bre(err);
- }
-
- break;
- }
- } while (fillcache(readblenfileStruct) > 0);
- }
-
- free(readblenfileStruct->readCache);
- readblenfileStruct->readCache = 0;
-
- return bfd;
-}
-
-// implementation of exported functions
-
-BlendFileData *
-BLO_readblenfilememory(
- char *fromBuffer,
- int fromBufferSize,
- BlendReadError *error_r)
-{
- int magiclen = strlen(headerMagic);
- BlendFileData *bfd = NULL;
-
- if (!fromBuffer) {
- *error_r = BRE_UNABLE_TO_OPEN;
- } else if (fromBufferSize < magiclen) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (strncmp(fromBuffer, headerMagic, magiclen) != 0) {
- *error_r = BRE_NOT_A_BLEND;
- } else if (fromBufferSize < magiclen+1) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (fromBuffer[magiclen] != '\r' && fromBuffer[magiclen] != '\n') {
- *error_r = BRE_NOT_A_BLEND;
- } else {
- int crnl;
-
- fromBuffer+= magiclen;
- fromBufferSize-= magiclen;
- crnl = (fromBuffer[0] == '\r');
- fromBuffer++;
- fromBufferSize--;
-
- if (crnl && fromBufferSize<1) {
- *error_r = BRE_UNABLE_TO_READ;
- } else {
- struct BLO_readblenfileStruct *readblenfileStruct = NULL;
-
- /* skip carriage return if necessary */
- if (crnl) {
- fromBuffer++;
- fromBufferSize--;
- }
-
- // Allocate all the stuff we need
- readblenfileStruct = calloc(sizeof(struct BLO_readblenfileStruct), 1);
- readblenfileStruct->fileDes = -1;
- readblenfileStruct->fromBuffer = fromBuffer;
- readblenfileStruct->fromBufferSize = fromBufferSize;
- readblenfileStruct->read = readfrommemory;
-
- readblenfileStruct->removeCR = crnl;
- // fake filesize for now until we've
- // actually read in the filesize from the header
- // make sure we don't read more bytes than there
- // are left to handle accoding to fromBufferSize
- readblenfileStruct->leftToRead = readblenfileStruct->fromBufferSize;
-
- bfd = readblenfilegeneric(readblenfileStruct, error_r);
-
- free(readblenfileStruct);
- readblenfileStruct = 0;
- }
- }
-
- return bfd;
-}
-
-
-BlendFileData *
-BLO_readblenfilehandle(
- int fd,
- BlendReadError *error_r)
-{
- int magiclen = strlen(headerMagic);
- BlendFileData *bfd = NULL;
- char tempbuffer[256];
-
- if (fd==-1) {
- *error_r = BRE_UNABLE_TO_OPEN;
- } else if (read(fd, tempbuffer, magiclen) != magiclen) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (strncmp(tempbuffer, headerMagic, magiclen) != 0 ) {
- *error_r = BRE_NOT_A_BLEND;
- } else if (read(fd, tempbuffer, 1) != 1) {
- *error_r = BRE_UNABLE_TO_READ;
- } else if (tempbuffer[0] != '\r' && tempbuffer[0] != '\n') {
- *error_r = BRE_NOT_A_BLEND;
- } else {
- int crnl = (tempbuffer[0] == '\r');
-
- if (crnl && read(fd, tempbuffer, 1)!=1) {
- *error_r = BRE_UNABLE_TO_READ;
- } else {
- struct BLO_readblenfileStruct *readblenfileStruct;
-
- // Allocate all the stuff we need
- readblenfileStruct = calloc(sizeof(struct BLO_readblenfileStruct), 1);
- readblenfileStruct->fileDes = fd;
- readblenfileStruct->read = readfromfilehandle;
-
- readblenfileStruct->removeCR = crnl;
- // fake filesize for now until we've
- // actually read in the filesize from the header
- readblenfileStruct->leftToRead = CACHESIZE;
-
- bfd = readblenfilegeneric(readblenfileStruct, error_r);
-
- free(readblenfileStruct);
- readblenfileStruct = 0;
- }
- }
-
- return bfd;
-}
-
-BlendFileData *
-BLO_readblenfilename(
- char *fileName,
- BlendReadError *error_r)
-{
- BlendFileData *bfd = NULL;
- int fd;
-
- fd = open(fileName, O_RDONLY | O_BINARY);
- if (fd==-1) {
- *error_r= BRE_UNABLE_TO_OPEN;
- } else {
- bfd = BLO_readblenfilehandle(fd, error_r);
- }
-
- if (fd!=-1)
- close(fd);
-
- return bfd;
-}
-
- /* Runtime reading */
+/* Runtime reading */
static int handle_read_msb_int(int handle) {
unsigned char buf[4];
@@ -601,7 +136,8 @@ blo_read_runtime(
BlendReadError *error_r)
{
BlendFileData *bfd= NULL;
- int fd, datastart;
+ void *filedata= NULL;
+ int fd, actualsize, datastart;
char buf[8];
fd= open(path, O_BINARY|O_RDONLY, 0);
@@ -609,6 +145,8 @@ blo_read_runtime(
*error_r= BRE_UNABLE_TO_OPEN;
goto cleanup;
}
+
+ actualsize= BLI_filesize(fd);
lseek(fd, -12, SEEK_END);
@@ -623,8 +161,9 @@ blo_read_runtime(
*error_r= BRE_NOT_A_BLEND;
goto cleanup;
} else {
+ printf("starting to read runtime from %s at datastart %d\n", path, datastart);
lseek(fd, datastart, SEEK_SET);
- bfd= BLO_readblenfilehandle(fd, error_r);
+ bfd = blo_read_blendafterruntime(fd, actualsize-datastart, error_r);
}
cleanup:
@@ -634,81 +173,3 @@ cleanup:
return bfd;
}
-#if 0
-static char *brs_error_to_string(int err) {
- int errFunction = BRS_GETFUNCTION(err);
- int errGeneric = BRS_GETGENERR(err);
- int errSpecific = BRS_GETSPECERR(err);
- char *errFunctionStrings[] = {
- "",
- "The read stream",
- "The read stream loopback",
- "The key store",
- "The file reading",
- "Decompressing the file",
- "Decrypting the file",
- "Verifying the signature"};
- char *errGenericStrings[] = {
- "",
- "generated an out of memory error",
- "bumped on an internal programming error",
- "did not recognize this as a blend file",
- "failed a blend file check",
- "bumped on corrupted data",
- "needed the rest of the blend file",
- "is not allowed in this version"};
- char *errReadStreamGlueStrings[] = {
- "",
- "does not know how to proceed"};
- char *errReadStreamFileStrings[] = {
- "",
- "did not recognize this as a blend file",
- "was busted on a read error"};
- char *errInflateStrings[] = {
- "",
- "bumped on a decompress error"};
- char *errDecryptStrings[] = {
- "",
- "could not make a new key",
- "bumped on a decrypt error",
- "was not allowed. This blend file is not made by you."};
- char *errVerifyStrings[] = {
- "",
- "could not make a new key",
- "failed"};
- char *errFunctionString= errFunctionStrings[errFunction];
- char *errExtraString= "";
- char *errString;
-
- if (errGeneric) {
- errExtraString= errGenericStrings[errGeneric];
- } else if (errSpecific) {
- switch (errFunction) {
- case BRS_READSTREAMGLUE:
- errExtraString= errReadStreamGlueStrings[errSpecific];
- break;
- case BRS_READSTREAMFILE:
- errExtraString= errReadStreamFileStrings[errSpecific];
- break;
- case BRS_INFLATE:
- errExtraString= errInflateStrings[errSpecific];
- break;
- case BRS_DECRYPT:
- errExtraString= errDecryptStrings[errSpecific];
- break;
- case BRS_VERIFY:
- errExtraString= errVerifyStrings[errSpecific];
- break;
- default:
- break;
- }
- }
-
- errString= MEM_mallocN(strlen(errFunctionString) + 1 + strlen(errExtraString) + 1);
- sprintf(errString, "%s %s", errFunctionString, errExtraString);
-
- return errString;
-}
-#endif
-
-
diff --git a/source/blender/readstreamglue/BLO_keyStore.h b/source/blender/readstreamglue/BLO_keyStore.h
deleted file mode 100644
index 02f5275bd59..00000000000
--- a/source/blender/readstreamglue/BLO_keyStore.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * make all key elements available through functions
- */
-
-#ifndef BLO_KEYSTORE_H
-#define BLO_KEYSTORE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned char byte;
-
-struct UserStruct;
-
- void
-keyStoreConstructor(
- struct UserStruct *keyUserStruct,
- char *privHexKey,
- char *pubHexKey,
- byte *ByteChecks,
- char *HexPython);
-
- void
-keyStoreDestructor(
- void);
-
- int
-keyStoreGetPubKey(
- byte **PubKey);
-
- int
-keyStoreGetPrivKey(
- byte **PrivKey);
-
- char *
-keyStoreGetUserName(
- void);
-
- char *
-keyStoreGetEmail(
- void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_KEYSTORE_H */
-
diff --git a/source/blender/readstreamglue/BLO_readStreamErrors.h b/source/blender/readstreamglue/BLO_readStreamErrors.h
deleted file mode 100644
index f49b0a45a0b..00000000000
--- a/source/blender/readstreamglue/BLO_readStreamErrors.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * all Blender Read Stream errors
- */
-
-#ifndef BLO_READSTREAMERRORS_H
-#define BLO_READSTREAMERRORS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BRS_SETFUNCTION(x) ( (int)(x) << 1)
-#define BRS_GETFUNCTION(x) (( (int)(x) >> 1) & 7)
-#define BRS_SETGENERR(x) ( (int)(x) << 4)
-#define BRS_GETGENERR(x) (( (int)(x) >> 4) & 7)
-#define BRS_SETSPECERR(x) ( (int)(x) << 7)
-#define BRS_GETSPECERR(x) (( (int)(x) >> 7) & 7)
-
-/* FUNCTION */
-#define BRS_READSTREAMGLUE 1
-#define BRS_READSTREAMLOOP 2
-#define BRS_KEYSTORE 3
-#define BRS_READSTREAMFILE 4
-#define BRS_INFLATE 5
-#define BRS_DECRYPT 6
-#define BRS_VERIFY 7
-
-/* GENeric errors */
-#define BRS_MALLOC 1
-#define BRS_NULL 2
-#define BRS_MAGIC 3
-#define BRS_CRCHEADER 4
-#define BRS_CRCDATA 5
-#define BRS_DATALEN 6
-#define BRS_STUB 7
-
-/* READSTREAMGLUE specific */
-#define BRS_UNKNOWN 1
-
-/* READSTREAMFILE specific */
-#define BRS_NOTABLEND 1
-#define BRS_READERROR 2
-
-/* INFLATE specific */
-#define BRS_INFLATEERROR 1
-
-/* DECRYPT specific */
-#define BRS_RSANEWERROR 1
-#define BRS_DECRYPTERROR 2
-#define BRS_NOTOURPUBKEY 3
-
-/* VERIFY specific */
-#define BRS_RSANEWERROR 1
-#define BRS_SIGFAILED 2
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_READSTREAMERRORS_H */
-
diff --git a/source/blender/readstreamglue/BLO_readStreamGlue.h b/source/blender/readstreamglue/BLO_readStreamGlue.h
deleted file mode 100644
index ccd322cc97a..00000000000
--- a/source/blender/readstreamglue/BLO_readStreamGlue.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * connect the read stream data processors
- */
-
-#ifndef BLO_READSTREAMGLUE_H
-#define BLO_READSTREAMGLUE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "BLO_sys_types.h"
-#include "BLO_readStreamErrors.h"
-
-#define UNKNOWN 0
-#define DUMPTOMEMORY 1
-#define DUMPFROMMEMORY 2
-#define READBLENFILE 3
-#define WRITEBLENFILE 4
-#define INFLATE 5
-#define DEFLATE 6
-#define DECRYPT 7
-#define ENCRYPT 8
-#define VERIFY 9
-#define SIGN 10
-
-#define MAXSTREAMLENGTH 10
-
-#define STREAMGLUEHEADERSIZE sizeof(struct streamGlueHeaderStruct)
-
-struct streamGlueHeaderStruct {
- uint8_t magic; /* poor mans header recognize check */
- uint32_t totalStreamLength; /* how much data is there */
- uint32_t dataProcessorType; /* next data processing action */
- uint32_t crc; /* header minus crc itself checksum */
-};
-
-struct readStreamGlueStruct {
- /* my control structure elements */
- unsigned int totalStreamLength;
- unsigned int streamDone;
- int dataProcessorType;
- void *ProcessorTypeControlStruct;
-
- unsigned char headerbuffer[STREAMGLUEHEADERSIZE];
-
- void *(*begin)(void *);
- int (*process)(void *, unsigned char *, unsigned int);
- int (*end)(void *);
-};
-
- unsigned int
-correctByteOrder(
- unsigned int x);
-
- int
-readStreamGlue(
- void *endControl,
- struct readStreamGlueStruct **control,
- unsigned char *data,
- unsigned int dataIn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_READSTREAMGLUE_H */
-
diff --git a/source/blender/readstreamglue/Makefile b/source/blender/readstreamglue/Makefile
deleted file mode 100644
index d3a5d89131c..00000000000
--- a/source/blender/readstreamglue/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/readstreamglue
-DIRS = intern
-
-include nan_subdirs.mk
diff --git a/source/blender/readstreamglue/SConscript b/source/blender/readstreamglue/SConscript
deleted file mode 100644
index 2a7484a766a..00000000000
--- a/source/blender/readstreamglue/SConscript
+++ /dev/null
@@ -1,17 +0,0 @@
-Import ('extra_includes')
-Import ('user_options_dict')
-Import ('library_env')
-
-readstrgl_env = library_env.Copy ()
-
-source_files = ['intern/BLO_readStreamGlue.c',
- 'intern/BLO_readStreamGlueLoopBack.c']
-
-readstrgl_env.Append (CPPPATH = ['.',
- '../../kernel/gen_messaging',
- '../blenloader',
- '../inflate'])
-
-readstrgl_env.Append (CPPPATH = user_options_dict['Z_INCLUDE'])
-readstrgl_env.Append (CPPPATH = extra_includes)
-readstrgl_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_readstreamglue', source=source_files)
diff --git a/source/blender/readstreamglue/intern/BLO_keyStorePrivate.h b/source/blender/readstreamglue/intern/BLO_keyStorePrivate.h
deleted file mode 100644
index 8ec4099f2cd..00000000000
--- a/source/blender/readstreamglue/intern/BLO_keyStorePrivate.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BLO_KEYSTOREPRIVATE_H
-#define BLO_KEYSTOREPRIVATE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// TODO this must be made external in key.h
-#define MAXBYTEDATABLOCK 1000
-
-struct keyStoreStruct {
- UserStruct keyUserStruct;
-
- unsigned char *privKey;
- int privKeyLen;
-
- unsigned char *pubKey;
- int pubKeyLen;
-
- unsigned char ByteChecks[MAXBYTEDATABLOCK];
-
- unsigned char *PythonCode;
- int PythonCodeLen;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_KEYSTOREPRIVATE_H */
-
diff --git a/source/blender/readstreamglue/intern/BLO_readStreamGlue.c b/source/blender/readstreamglue/intern/BLO_readStreamGlue.c
deleted file mode 100644
index 9c9ee5cb204..00000000000
--- a/source/blender/readstreamglue/intern/BLO_readStreamGlue.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * connect the read stream data processors
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_readStreamGlue.h"
-
-#include "BLO_readStreamGlueLoopBack.h"
-#include "BLO_readfile.h"
-#include "BLO_inflate.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- unsigned int
-correctByteOrder(
- unsigned int x)
-{
- unsigned char *s = (unsigned char *)&x;
- return (unsigned int)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
-}
-
- int
-readStreamGlue(
- void * endControl,
- struct readStreamGlueStruct **control,
- unsigned char *data,
- unsigned int dataIn)
-{
- int err = 0;
-
- if (NULL == *control) {
- /* we are called for the first time; play constructor */
- *control = malloc(sizeof (struct readStreamGlueStruct));
- if (*control == NULL) {
- err = BRS_SETFUNCTION(BRS_READSTREAMGLUE) |
- BRS_SETGENERR(BRS_MALLOC);
- return err;
- }
- (*control)->totalStreamLength = 0;
- (*control)->streamDone = 0;
- (*control)->dataProcessorType = UNKNOWN;
- memset((*control)->headerbuffer, 0, STREAMGLUEHEADERSIZE);
- (*control)->begin = NULL;
- (*control)->process = NULL;
- (*control)->end = NULL;
- }
-
- /* First check if we have our header filled in yet */
- if ((dataIn > 0) && ((*control)->dataProcessorType == 0)) {
- unsigned int processed;
- processed = ((dataIn + (*control)->streamDone) <= STREAMGLUEHEADERSIZE)
- ? dataIn : STREAMGLUEHEADERSIZE;
- memcpy((*control)->headerbuffer + (*control)->streamDone,
- data, processed);
- (*control)->streamDone += processed;
- dataIn -= processed;
- data += processed;
-
- if ((*control)->streamDone == STREAMGLUEHEADERSIZE) {
- /* we have the whole header, absorb it */
- struct streamGlueHeaderStruct *header;
- uint32_t crc;
- header = (struct streamGlueHeaderStruct *)
- (*control)->headerbuffer;
- (*control)->totalStreamLength =
- ntohl(header->totalStreamLength);
- (*control)->dataProcessorType =
- ntohl(header->dataProcessorType);
- crc = crc32(0L, (const Bytef *) header, STREAMGLUEHEADERSIZE - 4);
-
- if (header->magic == 'A') {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "streamGlue header read. Magic confirmed\n");
-#endif
- } else {
- err = BRS_SETFUNCTION(BRS_READSTREAMGLUE) |
- BRS_SETGENERR(BRS_MAGIC);
- free(*control);
- (*control) = NULL;
- return err;
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR streamGlue header read. Magic NOT confirmed (%c)\n",
- header->magic);
-#endif
- }
-
- if (crc == ntohl(header->crc)) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "streamGlue header CRC correct\n");
-#endif
- } else {
- err = BRS_SETFUNCTION(BRS_READSTREAMGLUE) |
- BRS_SETGENERR(BRS_CRCHEADER);
- free(*control);
- (*control) = NULL;
- return err;
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "ERROR streamGlue header CRC NOT correct\n");
-#endif
- }
-
- // No more header-> usage from this point !
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "read action %d will get %u raw bytes\n",
- (*control)->dataProcessorType,
- (unsigned int) (*control)->totalStreamLength);
-#endif
-
- /* Set pointers to the correct dataprocessor functions */
- switch ((*control)->dataProcessorType) {
- case DUMPTOMEMORY:
- case DUMPFROMMEMORY:
- (*control)->begin = blo_readstreamfile_begin;
- (*control)->process = blo_readstreamfile_process;
- (*control)->end = blo_readstreamfile_end;
- break;
- case READBLENFILE:
- case WRITEBLENFILE:
- (*control)->begin = readStreamGlueLoopBack_begin;
- (*control)->process = readStreamGlueLoopBack_process;
- (*control)->end = readStreamGlueLoopBack_end;
- break;
- case INFLATE:
- case DEFLATE:
- (*control)->begin = BLO_inflate_begin;
- (*control)->process = BLO_inflate_process;
- (*control)->end = BLO_inflate_end;
- break;
- default:
- err = BRS_SETFUNCTION(BRS_READSTREAMGLUE) |
- BRS_SETSPECERR(BRS_UNKNOWN);
- (*control) = NULL;
- free(*control);
- return err;
- break;
- }
- /* Call the dataprocessors begin() and
- * store its (*control) struct pointer */
- (*control)->ProcessorTypeControlStruct =
- (*(*control)->begin)(endControl);
- if ((*control)->ProcessorTypeControlStruct == NULL) {
- free(*control);
- (*control) = NULL;
- return err;
- }
- }
-
- }
-
- /* Is there really (still) new data available ? */
- if (dataIn > 0) {
- err = (*(*control)->process)((*control)->ProcessorTypeControlStruct,
- data, dataIn);
- if (err) {
- free(*control);
- (*control) = NULL;
- return err;
- }
- (*control)->streamDone += dataIn;
- }
- if ((*control)->streamDone == (*control)->totalStreamLength +
- STREAMGLUEHEADERSIZE) {
- err = (*(*control)->end)((*control)->ProcessorTypeControlStruct);
- free(*control);
- (*control) = NULL;
- }
- return err;
-}
-
diff --git a/source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.c b/source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.c
deleted file mode 100644
index 84e74407034..00000000000
--- a/source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * streamglue loopback. Needed at start of Read stream.
- */
-
-#include <stdlib.h> // TODO use blender's
-
-#include "BLO_readStreamGlue.h"
-#include "BLO_readStreamGlueLoopBack.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- struct readStreamGlueLoopBackStruct *
-readStreamGlueLoopBack_begin(
- void *endControl)
-{
- struct readStreamGlueLoopBackStruct *control;
- control = malloc(sizeof(struct readStreamGlueLoopBackStruct));
- if (control == NULL) {
- return NULL;
- }
-
- control->streamGlue = NULL;
- control->endControl = endControl;
-
- return(control);
-}
-
- int
-readStreamGlueLoopBack_process(
- struct readStreamGlueLoopBackStruct *control,
- unsigned char *data,
- unsigned int dataIn)
-{
- int err = 0;
- /* Is there really new data available ? */
- if (dataIn > 0) {
- err = readStreamGlue(
- control->endControl,
- &(control->streamGlue),
- data,
- dataIn);
- }
- return err;
-}
-
- int
-readStreamGlueLoopBack_end(
- struct readStreamGlueLoopBackStruct *control)
-{
- free(control);
- return 0;
-}
-
diff --git a/source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.h b/source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.h
deleted file mode 100644
index 148b5016eb4..00000000000
--- a/source/blender/readstreamglue/intern/BLO_readStreamGlueLoopBack.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * streamglue loopback. Needed at start of Read stream.
- */
-
-struct readStreamGlueLoopBackStruct {
- struct readStreamGlueStruct *streamGlue;
- void *endControl;
-};
-
- struct readStreamGlueLoopBackStruct *
-readStreamGlueLoopBack_begin(
- void *endControl);
-
- int
-readStreamGlueLoopBack_process(
- struct readStreamGlueLoopBackStruct *control,
- unsigned char *data,
- unsigned int dataIn);
-
- int
-readStreamGlueLoopBack_end(
- struct readStreamGlueLoopBackStruct *control);
-
diff --git a/source/blender/readstreamglue/intern/Makefile b/source/blender/readstreamglue/intern/Makefile
deleted file mode 100644
index e17fdae0376..00000000000
--- a/source/blender/readstreamglue/intern/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = readstreamglue
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own private header files
-CPPFLAGS += -I.
-
-# path to our own external header files
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../blenloader
-CPPFLAGS += -I../../inflate
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/sign/BLO_sign.h b/source/blender/sign/BLO_sign.h
deleted file mode 100644
index eb2a859808a..00000000000
--- a/source/blender/sign/BLO_sign.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BLO_SIGN_H
-#define BLO_SIGN_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- int
-BLO_sign(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_SIGN_H */
-
diff --git a/source/blender/sign/Makefile b/source/blender/sign/Makefile
deleted file mode 100644
index aa4458ef678..00000000000
--- a/source/blender/sign/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/sign
-DIRS = intern
-
-include nan_subdirs.mk
diff --git a/source/blender/sign/intern/BLO_sign.c b/source/blender/sign/intern/BLO_sign.c
deleted file mode 100644
index 29bc00ebbd9..00000000000
--- a/source/blender/sign/intern/BLO_sign.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * openssl/crypt RSA signature wrapper library
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef _WIN32
-#include <winsock2.h>
-#include <windows.h>
-#endif
-
-#include "openssl/rsa.h"
-#include "openssl/ripemd.h"
-#include "openssl/objects.h"
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_keyStore.h"
-#include "BLO_writeStreamGlue.h"
-#include "BLO_sign_verify_Header.h"
-#include "BLO_sign.h"
-
- int
-BLO_sign(
- unsigned char *data2,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader)
-{
- int err = 0;
- struct writeStreamGlueStruct *streamGlue = NULL;
- struct BLO_sign_verify_HeaderStruct BLO_sign_verify_Header;
- struct BLO_SignerHeaderStruct BLO_SignerHeader;
- unsigned char *sigret = NULL;
- unsigned int siglen = 0;
- unsigned char *digest = NULL;
- byte *pubKey = NULL, *privKey = NULL;
- int pubKeyLen = 0, privKeyLen = 0;
- RSA *rsa = NULL;
- static unsigned char rsa_e[] = "\x01\x00\x01";
- int signSuccess = 0;
- unsigned char *data = NULL;
-
- // Update streamGlueHeader that initiated us and write it away
- streamGlueHeader->totalStreamLength =
- htonl(SIGNVERIFYHEADERSTRUCTSIZE + SIGNERHEADERSTRUCTSIZE + dataIn);
- streamGlueHeader->crc = htonl(crc32(0L,
- (const Bytef *) streamGlueHeader, STREAMGLUEHEADERSIZE - 4));
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) streamGlueHeader,
- STREAMGLUEHEADERSIZE,
- 0);
- if (err) return err;
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_sign writes streamGlueHeader of %u bytes\n",
- STREAMGLUEHEADERSIZE);
-#endif
-
- pubKeyLen = keyStoreGetPubKey(&pubKey);
- privKeyLen = keyStoreGetPrivKey(&privKey);
- if ((pubKeyLen == 0) || (privKeyLen == 0)) {
- err = BWS_SETFUNCTION(BWS_SIGN) |
- BWS_SETGENERR(BWS_RSA);
- return err;
- }
-
- rsa = RSA_new();
- if (rsa == NULL) {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error in RSA_new\n");
-#endif
- err = BWS_SETFUNCTION(BWS_SIGN) |
- BWS_SETSPECERR(BWS_RSANEWERROR);
- return err;
- }
- // static exponent
- rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e);
-
- // public part into rsa->n
- rsa->n = BN_bin2bn(pubKey, pubKeyLen, rsa->n);
- //rsa->n = BN_bin2bn(rsa_n, sizeof(rsa_n)-1, rsa->n);
-
- // private part into rsa->d
- rsa->d = BN_bin2bn(privKey, privKeyLen, rsa->d);
- //rsa->d = BN_bin2bn(rsa_d, sizeof(rsa_d)-1, rsa->d);
-
- //DEBUG RSA_print_fp(stdout, rsa, 0);
-
- sigret = malloc(RSA_size(rsa) * sizeof(byte));
- if (!sigret) {
- err = BWS_SETFUNCTION(BWS_SIGN) |
- BWS_SETGENERR(BWS_MALLOC);
- RSA_free(rsa);
- return err;
- }
-
- digest = malloc(RIPEMD160_DIGEST_LENGTH);
- if (!digest) {
- err = BWS_SETFUNCTION(BWS_SIGN) |
- BWS_SETGENERR(BWS_MALLOC);
- free(sigret);
- RSA_free(rsa);
- return err;
- }
-
- // Fill BLO_SignerHeader
- strcpy(BLO_SignerHeader.name, keyStoreGetUserName());
- strcpy(BLO_SignerHeader.email, keyStoreGetEmail());
- BLO_SignerHeader.homeUrl[0] = '\0';
- BLO_SignerHeader.text[0] = '\0';
- BLO_SignerHeader.pubKeyUrl1[0] = '\0';
- BLO_SignerHeader.pubKeyUrl2[0] = '\0';
-
- // prepend BLO_SignerStruct to data
- data = malloc(SIGNERHEADERSTRUCTSIZE + dataIn);
- if (!data) {
- err = BWS_SETFUNCTION(BWS_SIGN) |
- BWS_SETGENERR(BWS_MALLOC);
- free(sigret);
- free(digest);
- RSA_free(rsa);
- return err;
- }
- memcpy(data, &BLO_SignerHeader, SIGNERHEADERSTRUCTSIZE);
- memcpy(data + SIGNERHEADERSTRUCTSIZE, data2, dataIn);
- dataIn += SIGNERHEADERSTRUCTSIZE;
-
- RIPEMD160(data, dataIn, digest);
-
- signSuccess = RSA_sign(NID_ripemd160, digest,
- RIPEMD160_DIGEST_LENGTH, sigret, &siglen, rsa);
- if (signSuccess != 1) {
- err = BWS_SETFUNCTION(BWS_SIGN) |
- BWS_SETSPECERR(BWS_SIGNERROR);
- free(data);
- free(sigret);
- free(digest);
- RSA_free(rsa);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_sign writes BLO_sign_verify_Header of %u bytes\n",
- SIGNVERIFYHEADERSTRUCTSIZE);
-#endif
- // write out our header
- BLO_sign_verify_Header.magic = 'A';
- BLO_sign_verify_Header.length = htonl(dataIn);
- memcpy(BLO_sign_verify_Header.pubKey, pubKey, pubKeyLen);
- BLO_sign_verify_Header.pubKeyLen = htonl(pubKeyLen);
- memcpy(BLO_sign_verify_Header.signature, sigret, siglen);
- BLO_sign_verify_Header.signatureLen = htonl(siglen);
- BLO_sign_verify_Header.datacrc = htonl(crc32(0L,
- (const Bytef *) data, dataIn));
- BLO_sign_verify_Header.headercrc = htonl(crc32(0L,
- (const Bytef *) &BLO_sign_verify_Header, SIGNVERIFYHEADERSTRUCTSIZE-4));
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) &BLO_sign_verify_Header,
- SIGNVERIFYHEADERSTRUCTSIZE,
- 0);
- if (err) {
- free(data);
- free(sigret);
- free(digest);
- RSA_free(rsa);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_sign writes %u bytes raw data (plus its 2 headers totals to %u)\n",
- dataIn, STREAMGLUEHEADERSIZE + SIGNVERIFYHEADERSTRUCTSIZE + dataIn);
-#endif
- // finally write all signed data
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *) data,
- dataIn,
- 1);
-
- free(data); // NOTE: we must release because we made a copy
- free(digest);
- free(sigret);
- RSA_free(rsa);
-
- return err;
-}
-
diff --git a/source/blender/sign/intern/Makefile b/source/blender/sign/intern/Makefile
deleted file mode 100644
index 3ff0678ce22..00000000000
--- a/source/blender/sign/intern/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = sign
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../writestreamglue
-CPPFLAGS += -I../../readstreamglue
-CPPFLAGS += -I../../verify
-
-CPPFLAGS += -I$(NAN_OPENSSL)/include
-CPPFLAGS += -I$(NAN_BLENKEY)/include
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/writeblenfile/BLO_writeblenfile.h b/source/blender/writeblenfile/BLO_writeblenfile.h
deleted file mode 100644
index a87f294b417..00000000000
--- a/source/blender/writeblenfile/BLO_writeblenfile.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#ifndef BLO_WRITEBLENFILE_H
-#define BLO_WRITEBLENFILE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- * Writes a file from memory to disk. The filedescriptor of the
- * targetfile is taken from mywfile.
- *
- * @param data pointer to the datachunk to write
- * @param dataIn size of the datachunk to write (bytes)
- * @param streamGlueHeader the eader describing this datachunk
- * @returns 0 if the file was written correctly, non-0 if an error
- * occured. */
- int
-BLO_writeblenfile(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_WRITEBLENFILE_H */
-
diff --git a/source/blender/writeblenfile/Makefile b/source/blender/writeblenfile/Makefile
deleted file mode 100644
index 2b8539af7c5..00000000000
--- a/source/blender/writeblenfile/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/writeblenfile
-DIRS = intern
-
-include nan_subdirs.mk
diff --git a/source/blender/writeblenfile/SConscript b/source/blender/writeblenfile/SConscript
deleted file mode 100644
index 8e7efdaacf3..00000000000
--- a/source/blender/writeblenfile/SConscript
+++ /dev/null
@@ -1,18 +0,0 @@
-Import ('extra_includes')
-Import ('user_options_dict')
-Import ('library_env')
-
-wrblenfile_env = library_env.Copy ()
-
-source_files = ['intern/BLO_writeblenfile.c']
-
-wrblenfile_env.Append (CPPPATH = ['.',
- '../../kernel/gen_messaging',
- '../blenloader',
- '../writestreamglue',
- '../readstreamglue',
- '../readblenfile'])
-
-wrblenfile_env.Append (CPPPATH = user_options_dict['Z_INCLUDE'])
-wrblenfile_env.Append (CPPPATH = extra_includes)
-wrblenfile_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_writeblenfile', source=source_files)
diff --git a/source/blender/writeblenfile/intern/BLO_writeblenfile.c b/source/blender/writeblenfile/intern/BLO_writeblenfile.c
deleted file mode 100644
index ab459359822..00000000000
--- a/source/blender/writeblenfile/intern/BLO_writeblenfile.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h> // strlen
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef _WIN32
-#include <io.h> // open / write
-#else // WIN32
-#include <unistd.h> // write
-#endif // WIN32
-
-#include <fcntl.h> // open
-
-#include "zlib.h"
-
-#include "GEN_messaging.h"
-
-#include "BLO_readfile.h"
-
-#include "BLO_writeStreamGlue.h"
-#include "BLO_writeblenfile.h"
-#include "BLO_readblenfile.h"
-
-// some systems don't have / support O_BINARY
-// on those systems we define it to 0
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-struct BLO_writeblenfileStruct {
- struct writeStreamGlueStruct **streamGlue;
- int fileDes;
- unsigned int bufferSize;
- unsigned int inBuffer;
- char *writeBuffer;
- int filestartoffset;
- int filesizeoffset;
-};
-
- int
-BLO_writeblenfile_process(
- struct BLO_writeblenfileStruct *control,
- unsigned char *data,
- unsigned int dataIn);
-
-/**
- * Flushes buffered data to file
- * @param control structure holding all variables
- * @return 0 on success, 1 if write failed
- */
-
-static int flushbuffer(
- struct BLO_writeblenfileStruct *control)
-{
- int err = 0;
- unsigned int written;
-
- if (control->inBuffer) {
- written = write(control->fileDes, control->writeBuffer, control->inBuffer);
- if (written != control->inBuffer) {
- err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) |
- BWS_SETSPECERR(BWS_WRITE);
- } else {
- control->inBuffer = 0;
- }
- }
-
- return (err);
-}
-
-
-int BLO_writeblenfile(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader)
-{
- struct BLO_writeblenfileStruct *writeblenfileStruct = 0;
- int fileDes;
- extern int mywfile;
- int err = 0;
- char minversion[4];
- char version[4];
- char flags[4];
- unsigned int filesize;
- char reserved[BLO_RESERVEDSIZE];
-
- fileDes = mywfile;
-
- if (fileDes == -1) {
- /* The filedescriptor was bad: this is an internal error */
- err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) |
- BWS_SETSPECERR(BWS_FILEDES);
- return err;
- }
-
- writeblenfileStruct = calloc(1, sizeof(struct BLO_writeblenfileStruct));
- if (!writeblenfileStruct) {
- err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) |
- BWS_SETGENERR(BWS_MALLOC);
- return err;
- }
-
- writeblenfileStruct->bufferSize = 100000;
- writeblenfileStruct->writeBuffer = malloc(writeblenfileStruct->bufferSize);
- if (!writeblenfileStruct->writeBuffer) {
- err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) |
- BWS_SETGENERR(BWS_MALLOC);
- return err;
- }
-
- writeblenfileStruct->fileDes = fileDes;
- writeblenfileStruct->filestartoffset = lseek(fileDes, 0, SEEK_CUR);
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_writeblenfile writes headerMagic ...\n");
-#endif
-
- // write our own magic fileheader
- err = BLO_writeblenfile_process(writeblenfileStruct,
- headerMagic,
- strlen(headerMagic));
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- // write out the '\n' that we use for the
- // cr / nl conversion
- err = BLO_writeblenfile_process(writeblenfileStruct,
- "\n",
- 1);
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- BLO_setversionnumber(minversion, 221);
- err = BLO_writeblenfile_process(writeblenfileStruct,
- minversion,
- sizeof(minversion));
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- BLO_setcurrentversionnumber(version);
- err = BLO_writeblenfile_process(writeblenfileStruct,
- version,
- sizeof(version));
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- memset(flags, 0, sizeof(flags));
- err = BLO_writeblenfile_process(writeblenfileStruct,
- flags,
- sizeof(flags));
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- // we'll have to write out the filesize in the end
- // remember the location in the file but make sure to
- // flush all cached data first...
-
- flushbuffer(writeblenfileStruct);
- writeblenfileStruct->filesizeoffset = lseek(fileDes, 0, SEEK_CUR);
- memset(&filesize, 0, sizeof(filesize));
- err = BLO_writeblenfile_process(writeblenfileStruct,
- &filesize,
- sizeof(filesize));
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- memset(reserved, 0, sizeof(reserved));
- err = BLO_writeblenfile_process(writeblenfileStruct,
- reserved,
- sizeof(reserved));
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_writeblenfile writes streamGlueHeader of %u bytes\n",
- STREAMGLUEHEADERSIZE);
-#endif
-
- // Update streamGlueHeader that initiated us and write it away
- // Note that streamGlueHeader is *behind* the magic fileheader
- streamGlueHeader->totalStreamLength = htonl(0 + dataIn);
- streamGlueHeader->crc = htonl(crc32(0L,
- (const Bytef *) streamGlueHeader, STREAMGLUEHEADERSIZE - 4));
- err = BLO_writeblenfile_process(writeblenfileStruct,
- (unsigned char *) streamGlueHeader,
- STREAMGLUEHEADERSIZE);
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_writeblenfile writes %u bytes raw data\n",
- dataIn);
-#endif
-
- // write raw data
- err = BLO_writeblenfile_process(writeblenfileStruct,
- data,
- dataIn);
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- err = flushbuffer(writeblenfileStruct);
- if (err) {
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
- return err;
- }
-
- // write filesize in header
- // calculate filesize
- filesize = lseek(fileDes, 0, SEEK_CUR);
- filesize -= writeblenfileStruct->filestartoffset;
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_writeblenfile total file size %u bytes\n",
- filesize);
-#endif
-
- // TODO There should be error catching here as well.
- // goto filesize location in file
- lseek(fileDes, writeblenfileStruct->filesizeoffset, SEEK_SET);
- // and write out filesize in network byte order
- filesize = htonl(filesize);
- write(fileDes, &filesize, sizeof(filesize));
- // seek to end of file to cover up our tracks
- lseek(fileDes, 0, SEEK_END);
-
- // clean up
- free(writeblenfileStruct->writeBuffer);
- free(writeblenfileStruct);
-
- return (err);
-}
-
-/**
- * Buffers data and writes it to disk when necessary
- * @param control structure holding all variables
- * @param dataIn Length of new chunk of data
- * @param data Pointer to new chunk of data
- */
- int
-BLO_writeblenfile_process(
- struct BLO_writeblenfileStruct *control,
- unsigned char *data,
- unsigned int dataIn)
-{
- int err = 0;
- unsigned int written;
-
- if (control && data) {
- if (dataIn) {
- // do we need to flush data ?
- if ((dataIn + control->inBuffer) > control->bufferSize) {
- err = flushbuffer(control);
- }
-
- if (! err) {
- // do we now have enough space in the buffer ?
- if ((dataIn + control->inBuffer) <= control->bufferSize) {
- // yes, just copy it to the buffer
- memcpy(control->writeBuffer + control->inBuffer, data, dataIn);
- control->inBuffer += dataIn;
- } else {
- // write data out immediately
- written = write(control->fileDes, data, dataIn);
- if (written != dataIn) {
- err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) |
- BWS_SETSPECERR(BWS_WRITE);
- }
- }
- }
- }
- } else {
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_writeblenfile_process: invalid parameters\n");
-#endif
- err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) |
- BWS_SETSPECERR(BWS_PARAM);
- }
-
- return err;
-}
-
diff --git a/source/blender/writeblenfile/intern/Makefile b/source/blender/writeblenfile/intern/Makefile
deleted file mode 100644
index e5ac144195f..00000000000
--- a/source/blender/writeblenfile/intern/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = writeblenfile
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-# external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../writestreamglue
-CPPFLAGS += -I../../readstreamglue
-CPPFLAGS += -I../../readblenfile
-CPPFLAGS += -I../../blenloader
-
diff --git a/source/blender/writeblenfile/test/Makefile b/source/blender/writeblenfile/test/Makefile
deleted file mode 100644
index fe07aa8c9b4..00000000000
--- a/source/blender/writeblenfile/test/Makefile
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = writeblenfile
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-ALLTARGETS = $(OBJS) $(DIR)/$(DEBUG_DIR)test$(EXT)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-CPPFLAGS += -I../../streamglue
-
-# TODO include right .mk for ldflags
-$(DIR)/$(DEBUG_DIR)test$(EXT): $(OBJS) ../intern/BLO_writeblenfile.c
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(OCGDIR)/blender/writeblenfile/$(DEBUG_DIR)libwriteblenfile.a
- $(DIR)/$(DEBUG_DIR)test$(EXT)
-
diff --git a/source/blender/writeblenfile/test/test.c b/source/blender/writeblenfile/test/test.c
deleted file mode 100644
index 450176c0761..00000000000
--- a/source/blender/writeblenfile/test/test.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-#include <string.h> // strlen
-#include "BLO_writeblenfile.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-main()
-{
- struct BLO_writeblenfileStruct *control;
- char *string = "Hello world";
-
-
- control = BLO_writeblenfile_begin();
- BLO_writeblenfile_process(control, string, strlen(string));
- BLO_writeblenfile_end(control);
-}
diff --git a/source/blender/writestreamglue/BLO_getPubKey.h b/source/blender/writestreamglue/BLO_getPubKey.h
deleted file mode 100644
index 838da0c142d..00000000000
--- a/source/blender/writestreamglue/BLO_getPubKey.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * PUBLISHER: get the public key from the .BPkeyfile
- * STUB: give back the dataStreamPubKey
- */
-
-int getPubKey(unsigned char *dataStreamPubKey, int dataStreamPubKeyLen,
- unsigned char **publisherPubKey, int *publisherPubKeyLen);
-
diff --git a/source/blender/writestreamglue/BLO_writeStreamErrors.h b/source/blender/writestreamglue/BLO_writeStreamErrors.h
deleted file mode 100644
index cc86660b8d0..00000000000
--- a/source/blender/writestreamglue/BLO_writeStreamErrors.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * all Blender Write Stream errors
- * NOTE: adding stuff here means you also have to update the error
- * messages in writefile.c
- */
-
-#ifndef BLO_WRITESTREAMERRORS_H
-#define BLO_WRITESTREAMERRORS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BWS_SETFUNCTION(x) ( (int)(x) << 1)
-#define BWS_GETFUNCTION(x) (( (int)(x) >> 1) & 7)
-#define BWS_SETGENERR(x) ( (int)(x) << 4)
-#define BWS_GETGENERR(x) (( (int)(x) >> 4) & 7)
-#define BWS_SETSPECERR(x) ( (int)(x) << 7)
-#define BWS_GETSPECERR(x) (( (int)(x) >> 7) & 7)
-
-// FUNCTION
-#define BWS_WRITESTREAMGLUE 1
-#define BWS_DEFLATE 2
-#define BWS_ENCRYPT 3
-#define BWS_SIGN 4
-#define BWS_WRITEBLENFILE 5
-
-// GENeric errors
-#define BWS_MALLOC 1
-#define BWS_STUB 2
-#define BWS_RSA 3
-
-// WRITESTREAMGLUE specific
-#define BWS_UNKNOWN 1
-
-// DEFLATE specific
-#define BWS_DEFLATEERROR 1
-
-// ENCRYPT specific
-#define BWS_RSANEWERROR 1
-#define BWS_ENCRYPTERROR 2
-
-// SIGN specific
-#define BWS_RSANEWERROR 1
-#define BWS_SIGNERROR 2
-
-// WRITEBLENFILE specific
-#define BWS_FILEDES 1
-#define BWS_WRITE 2
-#define BWS_PARAM 3
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_WRITESTREAMERRORS_H */
-
diff --git a/source/blender/writestreamglue/BLO_writeStreamGlue.h b/source/blender/writestreamglue/BLO_writeStreamGlue.h
deleted file mode 100644
index 85101d8c79b..00000000000
--- a/source/blender/writestreamglue/BLO_writeStreamGlue.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * struct/function that connects the data stream processors
- */
-
-#ifndef BLO_WRITESTREAMGLUE_H
-#define BLO_WRITESTREAMGLUE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "BLO_readStreamGlue.h"
-#include "BLO_writeStreamErrors.h"
-
-/******************** start BLO_streamGlueControl.c part *****************/
-struct streamGlueControlStruct {
- int actions;
- int actionsDone;
- unsigned char action[MAXSTREAMLENGTH];
-};
-
- struct streamGlueControlStruct *
-streamGlueControlConstructor(
- void);
-
- void
-streamGlueControlDestructor(
- struct streamGlueControlStruct *streamControl);
-
- int
-streamGlueControlAppendAction(
- struct streamGlueControlStruct *streamControl,
- unsigned char nextAction);
-
- unsigned char
-streamGlueControlGetNextAction(
- struct streamGlueControlStruct *streamControl);
-
-// TODO avoid this global variable
-extern struct streamGlueControlStruct *Global_streamGlueControl;
-/******************** end BLO_streamGlueControl.c part *****************/
-
-struct writeStreamGlueStruct {
- int dataProcessorType;
- unsigned int streamBufferCount;
- unsigned char *streamBuffer;
-};
-
- int
-writeStreamGlue(
- struct streamGlueControlStruct *streamGlueControl,
- struct writeStreamGlueStruct **streamGlue,
- unsigned char *data,
- unsigned int dataIn,
- int finishUp);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLO_WRITESTREAMGLUE_H */
-
diff --git a/source/blender/writestreamglue/Makefile b/source/blender/writestreamglue/Makefile
deleted file mode 100644
index 22f3adb345e..00000000000
--- a/source/blender/writestreamglue/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/writestreamglue
-DIRS = intern stub
-TESTDIRS = test
-
-include nan_subdirs.mk
diff --git a/source/blender/writestreamglue/SConscript b/source/blender/writestreamglue/SConscript
deleted file mode 100644
index 1a41ecee12c..00000000000
--- a/source/blender/writestreamglue/SConscript
+++ /dev/null
@@ -1,20 +0,0 @@
-Import ('extra_includes')
-Import ('user_options_dict')
-Import ('library_env')
-
-wrstrgl_env = library_env.Copy ()
-
-source_files = ['intern/BLO_dumpFromMemory.c',
- 'intern/BLO_getPubKey.c',
- 'intern/BLO_streamGlueControl.c',
- 'intern/BLO_writeStreamGlue.c']
-
-wrstrgl_env.Append (CPPPATH = ['.',
- '../readstreamglue',
- '../deflate',
- '../writeblenfile',
- '../../kernel/gen_messaging'])
-wrstrgl_env.Append (CPPPATH = user_options_dict['Z_INCLUDE'])
-
-wrstrgl_env.Append (CPPPATH = extra_includes)
-wrstrgl_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_writestreamglue', source=source_files)
diff --git a/source/blender/writestreamglue/intern/BLO_dumpFromMemory.c b/source/blender/writestreamglue/intern/BLO_dumpFromMemory.c
deleted file mode 100644
index 52f8ac2e789..00000000000
--- a/source/blender/writestreamglue/intern/BLO_dumpFromMemory.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * streamglue loopback adds a streamGlueHeader to start of the write stream
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "GEN_messaging.h"
-#include "zlib.h"
-#include "BLO_writeStreamGlue.h"
-#include "BLO_dumpFromMemory.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- int
-BLO_dumpFromMemory(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader)
-{
- struct writeStreamGlueStruct *streamGlue = NULL;
- int err = 0;
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "BLO_dumpFromMemory: %u streamGlueHeader + %u data = %u\n",
- STREAMGLUEHEADERSIZE,
- dataIn,
- STREAMGLUEHEADERSIZE + dataIn);
-#endif
-
- // all data is in. set size in streamGlueHeader and write it out
- streamGlueHeader->totalStreamLength = htonl(dataIn);
- streamGlueHeader->crc = htonl(crc32(0L, (const Bytef *) streamGlueHeader,
- STREAMGLUEHEADERSIZE - 4));
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- (unsigned char *)streamGlueHeader,
- STREAMGLUEHEADERSIZE,
- 0);
- if (err) return err;
-
- // write out data
- err = writeStreamGlue(
- Global_streamGlueControl,
- &streamGlue,
- data,
- dataIn,
- 1);
-
- return err;
-}
-
diff --git a/source/blender/writestreamglue/intern/BLO_dumpFromMemory.h b/source/blender/writestreamglue/intern/BLO_dumpFromMemory.h
deleted file mode 100644
index cb418f67f01..00000000000
--- a/source/blender/writestreamglue/intern/BLO_dumpFromMemory.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * streamglue loopback adds a streamGlueHeader to start of the write stream
- */
-
- int
-BLO_dumpFromMemory(
- unsigned char *data,
- unsigned int dataIn,
- struct streamGlueHeaderStruct *streamGlueHeader);
-
diff --git a/source/blender/writestreamglue/intern/BLO_getPubKey.c b/source/blender/writestreamglue/intern/BLO_getPubKey.c
deleted file mode 100644
index 99193417591..00000000000
--- a/source/blender/writestreamglue/intern/BLO_getPubKey.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * Publisher only: get the public key from the .BPkeyfile
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "BLO_keyStore.h"
-#include "BLO_getPubKey.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- int
-getPubKey(byte *dataStreamPubKey,
- int dataStreamPubKeyLen,
- byte **publisherPubKey,
- int *publisherPubKeyLen)
-{
- int err = 0;
-
- *publisherPubKeyLen = keyStoreGetPubKey(publisherPubKey);
-
- if (*publisherPubKeyLen == 0) {
- // we're a publisher without .BPkey
- *publisherPubKey = NULL;
- return 1;
- }
-
- if (dataStreamPubKeyLen != *publisherPubKeyLen) {
- // different keys
- *publisherPubKeyLen = 0;
- *publisherPubKey = NULL;
- return 2;
- }
-
- if (memcmp(dataStreamPubKey, *publisherPubKey, *publisherPubKeyLen)
- != 0) {
- // different keys
- *publisherPubKeyLen = 0;
- *publisherPubKey = NULL;
- return 3;
- }
-
- return err;
-}
-
diff --git a/source/blender/writestreamglue/intern/BLO_streamGlueControl.c b/source/blender/writestreamglue/intern/BLO_streamGlueControl.c
deleted file mode 100644
index 2d4d408d848..00000000000
--- a/source/blender/writestreamglue/intern/BLO_streamGlueControl.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * define what actions a write stream should do
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "BLO_writeStreamGlue.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- struct streamGlueControlStruct *
-streamGlueControlConstructor(
- void)
-{
- struct streamGlueControlStruct *control;
- control = malloc(sizeof(struct streamGlueControlStruct));
- assert(control);
- // TODO handle malloc errors
- control->actions = 0;
- control->actionsDone = 0;
- memset(control->action, 0, MAXSTREAMLENGTH);
- return(control);
-}
-
- void
-streamGlueControlDestructor(
- struct streamGlueControlStruct *streamControl)
-{
- free(streamControl);
-}
-
- int
-streamGlueControlAppendAction(
- struct streamGlueControlStruct *streamControl,
- unsigned char nextAction)
-{
- assert(streamControl);
- assert(streamControl->actions < MAXSTREAMLENGTH);
- streamControl->action[streamControl->actions] = nextAction;
- streamControl->actions++;
- return(streamControl->actions);
-}
-
- unsigned char
-streamGlueControlGetNextAction(
- struct streamGlueControlStruct *streamControl)
-{
- unsigned char nextAction;
- assert(streamControl);
- assert(streamControl->actionsDone < streamControl->actions);
- if (streamControl->actionsDone >= streamControl->actions) {
- // the stream should have been terminated by a data
- // processor, but instead streamGlue is called again ...
- nextAction = UNKNOWN; // best guess ...
- } else {
- nextAction = streamControl->action[streamControl->actionsDone];
- streamControl->actionsDone++;
- }
- return(nextAction);
-}
-
diff --git a/source/blender/writestreamglue/intern/BLO_writeStreamGlue.c b/source/blender/writestreamglue/intern/BLO_writeStreamGlue.c
deleted file mode 100644
index 2da560b4278..00000000000
--- a/source/blender/writestreamglue/intern/BLO_writeStreamGlue.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * connect the data stream processors
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "zlib.h"
-#include "GEN_messaging.h"
-#include "BLO_writeStreamGlue.h"
-#include "BLO_dumpFromMemory.h"
-#include "BLO_writeblenfile.h"
-#include "BLO_deflate.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/**
- * streamGlueWrite does not really stream; it buffers all data it gets
- * because it needs everything to create the header, which is in front
- * of the data (to make reading easier, which occurs much more often
- * than writing and is thus more important to optimize for).
- * @param streamControl contains a list of Glue actions. Every
- * streamGlueWrite constructor eats up the next first action.
- */
- int
-writeStreamGlue(
- struct streamGlueControlStruct *streamGlueControl,
- struct writeStreamGlueStruct **streamGlue,
- unsigned char *data,
- unsigned int dataIn,
- int finishUp)
-{
- int err = 0;
-
- if (NULL == *streamGlue) {
- /* we are called for the first time; play constructor */
- (*streamGlue) = malloc(sizeof(struct writeStreamGlueStruct));
-
- if (!(*streamGlue)) {
- err = BWS_SETFUNCTION(BWS_WRITESTREAMGLUE) |
- BWS_SETGENERR(BWS_MALLOC);
- return err;
- }
-
- (*streamGlue)->dataProcessorType =
- streamGlueControlGetNextAction(streamGlueControl);
- (*streamGlue)->streamBufferCount = 0;
- (*streamGlue)->streamBuffer = NULL;
- }
- if (dataIn > 0) {
- /* simply buffer it */
- (*streamGlue)->streamBuffer = realloc((*streamGlue)->streamBuffer,
- dataIn + (*streamGlue)->streamBufferCount);
- if (!(*streamGlue)->streamBuffer) {
- err = BWS_SETFUNCTION(BWS_WRITESTREAMGLUE) |
- BWS_SETGENERR(BWS_MALLOC);
- free(*streamGlue);
- return err;
- }
- memcpy((*streamGlue)->streamBuffer + (*streamGlue)->streamBufferCount,
- data, dataIn);
- (*streamGlue)->streamBufferCount += dataIn;
- }
- if (finishUp) {
- /* all data is in, create header and call data processor */
-
- /* first create the streamGlueHeaderStruct */
- struct streamGlueHeaderStruct *streamGlueHeader;
- streamGlueHeader = malloc(STREAMGLUEHEADERSIZE);
- if (!streamGlueHeader) {
- err = BWS_SETFUNCTION(BWS_WRITESTREAMGLUE) |
- BWS_SETGENERR(BWS_MALLOC);
- free((*streamGlue)->streamBuffer);
- free(*streamGlue);
- return err;
- }
- streamGlueHeader->magic = 'A';
- streamGlueHeader->totalStreamLength = 0; // set in the actions _end
- streamGlueHeader->dataProcessorType =
- htonl((*streamGlue)->dataProcessorType);
- streamGlueHeader->crc = 0; // set in in the actions _end
-
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "streamGlue: write %d gets %u data + %u streamGlueHeader = %u\n",
- (*streamGlue)->dataProcessorType,
- (*streamGlue)->streamBufferCount,
- STREAMGLUEHEADERSIZE,
- (*streamGlue)->streamBufferCount + STREAMGLUEHEADERSIZE);
-#endif
-
- /* all data ready, start the right data processor */
- switch ((*streamGlue)->dataProcessorType) {
- case DUMPFROMMEMORY:
- err = BLO_dumpFromMemory((*streamGlue)->streamBuffer,
- (*streamGlue)->streamBufferCount,
- streamGlueHeader);
- break;
- case DEFLATE:
- err = BLO_deflate((*streamGlue)->streamBuffer,
- (*streamGlue)->streamBufferCount,
- streamGlueHeader);
- break;
- case WRITEBLENFILE:
- err = BLO_writeblenfile((*streamGlue)->streamBuffer,
- (*streamGlue)->streamBufferCount,
- streamGlueHeader);
- break;
- default:
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "unknown dataProcessorType %d\n",
- (*streamGlue)->dataProcessorType);
-#endif
- err = BWS_SETFUNCTION(BWS_WRITESTREAMGLUE) |
- BWS_SETSPECERR(BWS_UNKNOWN);
- break;
- }
-
- free(streamGlueHeader);
- free((*streamGlue)->streamBuffer);
- free(*streamGlue);
- }
- return err;
-}
-
diff --git a/source/blender/writestreamglue/intern/Makefile b/source/blender/writestreamglue/intern/Makefile
deleted file mode 100644
index 7388b338ca9..00000000000
--- a/source/blender/writestreamglue/intern/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = writestreamglue
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own private header files
-CPPFLAGS += -I.
-
-# path to our own external header files
-CPPFLAGS += -I..
-
-# path to external modules
-CPPFLAGS += -I../../../kernel/gen_messaging
-
-CPPFLAGS += -I../../readstreamglue
-
-CPPFLAGS += -I../../writeblenfile
-CPPFLAGS += -I../../blenloader
-
-CPPFLAGS += -I../../deflate
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/writestreamglue/stub/BLO_getPubKeySTUB.c b/source/blender/writestreamglue/stub/BLO_getPubKeySTUB.c
deleted file mode 100644
index 9a6e7e1bb21..00000000000
--- a/source/blender/writestreamglue/stub/BLO_getPubKeySTUB.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * player/plugin only: 'get' the public key from the datastream
- * note really a STUB eh ...
- */
-
-#include "BLO_getPubKey.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- int
-getPubKey(unsigned char *dataStreamPubKey,
- int dataStreamPubKeyLen,
- unsigned char **publisherPubKey,
- int *publisherPubKeyLen)
-{
- int err = 0;
-
- *publisherPubKeyLen = dataStreamPubKeyLen;
- *publisherPubKey = dataStreamPubKey;
-
- return err;
-}
-
diff --git a/source/blender/writestreamglue/stub/BLO_keyStoreSTUB.c b/source/blender/writestreamglue/stub/BLO_keyStoreSTUB.c
deleted file mode 100644
index a3a9fa14c9e..00000000000
--- a/source/blender/writestreamglue/stub/BLO_keyStoreSTUB.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * keyStore stubs
- */
-
-#include <stdio.h>
-
-#include "BLO_keyStore.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- void
-keyStoreConstructor(
- struct UserStruct *keyUserStruct,
- char *privHexKey,
- char *pubHexKey,
- unsigned char *ByteChecks,
- char *HexPython)
-{
- keyUserStruct = NULL;
- privHexKey = NULL;
- pubHexKey = NULL;
- ByteChecks = NULL;
- HexPython = NULL;
-}
-
- void
-keyStoreDestructor(
- void)
-{
-}
-
diff --git a/source/blender/writestreamglue/stub/BLO_streamGlueControlSTUB.c b/source/blender/writestreamglue/stub/BLO_streamGlueControlSTUB.c
deleted file mode 100644
index 8f4165c8c64..00000000000
--- a/source/blender/writestreamglue/stub/BLO_streamGlueControlSTUB.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- *
- */
-
-#include <stdio.h>
-#include "GEN_messaging.h"
-#include "BLO_writeStreamGlue.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- struct streamGlueControlStruct *
-streamGlueControlConstructor(
- void)
-{
-#ifdef NDEBUG
- fprintf(GEN_errorstream,
- "Error streamGlueControlConstructor is a stub\n");
-#endif
- return(NULL);
-}
-
- void
-streamGlueControlDestructor(
- struct streamGlueControlStruct *streamControl)
-{
- streamControl = NULL;
-#ifdef NDEBUG
- fprintf(GEN_errorstream,
- "Error streamGlueControlDestructor is a stub\n");
-#endif
-}
-
- int
-streamGlueControlAppendAction(
- struct streamGlueControlStruct *streamControl,
- unsigned char nextAction)
-{
- streamControl = NULL;
- nextAction = 0;
-#ifdef NDEBUG
- fprintf(GEN_errorstream,
- "Error streamGlueControlAppendAction is a stub\n");
-#endif
- return(0);
-}
-
- unsigned char
-streamGlueControlGetNextAction(
- struct streamGlueControlStruct *streamControl)
-{
- streamControl = NULL;
-#ifdef NDEBUG
- fprintf(GEN_errorstream,
- "Error streamGlueControlGetNextAction is a stub\n");
-#endif
- return(0);
-}
-
diff --git a/source/blender/writestreamglue/stub/BLO_writeStreamGlueSTUB.c b/source/blender/writestreamglue/stub/BLO_writeStreamGlueSTUB.c
deleted file mode 100644
index 07a7c48e6b6..00000000000
--- a/source/blender/writestreamglue/stub/BLO_writeStreamGlueSTUB.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * streamGlueRead stubs
- */
-
-#include <stdio.h>
-
-#include "GEN_messaging.h"
-#include "BLO_writeStreamGlue.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
- int
-writeStreamGlue(
- struct streamGlueControlStruct *streamGlueControl,
- struct writeStreamGlueStruct **streamGlue,
- unsigned char *data,
- unsigned int dataIn,
- int finishUp)
-{
- int err = 0;
- streamGlueControl = NULL;
- *streamGlue = NULL;
- data = NULL;
- dataIn = 0;
- finishUp = 0;
-#ifndef NDEBUG
- fprintf(GEN_errorstream,
- "Error writeStreamGlue is a stub\n");
-#endif
- err = BWS_SETFUNCTION(BWS_WRITESTREAMGLUE) |
- BWS_SETGENERR(BWS_STUB);
- return err;
-}
-
diff --git a/source/blender/writestreamglue/stub/Makefile b/source/blender/writestreamglue/stub/Makefile
deleted file mode 100644
index 8711941a06c..00000000000
--- a/source/blender/writestreamglue/stub/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = writestreamglueSTUB
-DIR = $(OCGDIR)/blender/$(LIBNAME)
-
-include nan_compile.mk
-
-ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
- CFLAGS += -funsigned-char
-endif
-
-CFLAGS += $(LEVEL_2_C_WARNINGS)
-
-# path to our own external headerfiles
-CPPFLAGS += -I..
-
-#
-CPPFLAGS += -I../../../kernel/gen_messaging
-CPPFLAGS += -I../../readstreamglue
-
-ifeq ($(OS),$(findstring $(OS), "solaris windows"))
- CPPFLAGS += -I$(NAN_ZLIB)/include
-endif
-
diff --git a/source/blender/writestreamglue/test/Makefile b/source/blender/writestreamglue/test/Makefile
deleted file mode 100644
index ee2708e55ff..00000000000
--- a/source/blender/writestreamglue/test/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Bounces make to subdirectories.
-
-SOURCEDIR = source/blender/writestreamglue/test
-DIRS = typetest #readwritetest
-
-include nan_subdirs.mk
diff --git a/source/blender/writestreamglue/test/readwritetest/Makefile b/source/blender/writestreamglue/test/readwritetest/Makefile
deleted file mode 100644
index bedb9f42a99..00000000000
--- a/source/blender/writestreamglue/test/readwritetest/Makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Streamglue read/write testing
-#
-
-DIR = $(OCGDIR)/blender/writestreamglue/readwritetest
-ALLTARGETS = $(OBJS) $(DIR)/$(DEBUG_DIR)readwritetest
-
-include nan_compile.mk
-
-CFLAGS += -funsigned-char -g
-
-# includes:
-CPPFLAGS += -I../..
-CPPFLAGS += -I../../../readstreamglue
-
-# libs:
-TESTLIBS += $(OCGDIR)/blender/readstreamglue/$(DEBUG_DIR)libreadstreamglue.a
-TESTLIBS += $(OCGDIR)/blender/writestreamglue/$(DEBUG_DIR)libwritestreamglue.a
-TESTLIBS += $(OCGDIR)/blender/inflate/$(DEBUG_DIR)libinflate.a
-TESTLIBS += $(OCGDIR)/blender/deflate/$(DEBUG_DIR)libdeflate.a
-TESTLIBS += $(OCGDIR)/blender/writeblenfile/$(DEBUG_DIR)libwriteblenfile.a
-TESTLIBS += $(OCGDIR)/blender/writestreamglue/$(DEBUG_DIR)libwritestreamglue.a
-TESTLIBS += $(OCGDIR)/blender/readstreamglue/$(DEBUG_DIR)libreadstreamglue.a
-TESTLIBS += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
-
-ifeq ($(OS),$(findstring $(OS), "linux freebsd"))
- TESTLIBS += -lz
-endif
-
-ifeq ($(OS),windows)
- TESTLIBS += ws2_32.lib
- TESTLIBS += $(NAN_ZLIB)/lib/libz.a
- TESTLIBS += kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
- TESTLIBS += advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
- TESTLIBS += winmm.lib opengl32.lib glu32.lib largeint.lib dxguid.lib
-endif
-
-
-$(DIR)/readwritetest: $(OBJS)
- $(CC) $(LDFLAGS) -o $(DIR)/readwritetest $(OBJS) $(TESTLIBS)
-
-clean::
- $(RM) $(DIR)/readwritetest
-
-test:: all
- $(DIR)/readwritetest $(NAN_TEST_VERBOSITY)
diff --git a/source/blender/writestreamglue/test/readwritetest/readwritetest.c b/source/blender/writestreamglue/test/readwritetest/readwritetest.c
deleted file mode 100644
index d0a8ddef50e..00000000000
--- a/source/blender/writestreamglue/test/readwritetest/readwritetest.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-/* Test for the streamglue read/write components
- *
- * The streamglue functions connect dataprocessors.
- *
- * Tested functions
- *
- * - streamGlueWrite (from BLO_streamglue.h)
- * - streamGlueRead (from BLO_streamglue.h)
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-#include "BLO_writeStreamGlue.h"
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#define O_BINARY 0
-#endif
-
-struct streamGlueControlStruct *Global_streamGlueControl;
-
-/* Some stubs here, because otherwise we have to link all of blender... */
-
-//FILE* mywfile = NULL;
-int mywfile = 0;
-
- void *
-BLO_readstreamfile_begin(
- void)
-{
- fprintf(stderr, "|--> BLO_readstreamfile_begin: local loopback\n");
- return NULL;
-}
-
- int
-BLO_readstreamfile_process(
- void *filedataVoidPtr,
- unsigned char *data,
- unsigned int dataIn)
-{
- fprintf(stderr, "|--> BLO_readstreamfile_process: local loopback\n");
- return 0;
-}
-
-
- int
-BLO_readstreamfile_end(
- void *filedataVoidPtr)
-{
- fprintf(stderr, "|--> BLO_readstreamfile_end: local loopback\n");
- return 0;
-}
-
-int main (int argc, char *argv[])
-{
- int verbose = 0;
- int error_status = 0;
- int retval = 0;
- int i = 0;
-
- int datachunksize = 12345;
- char* datachunk = NULL;
- char* dataptr = NULL;
- struct writeStreamGlueStruct *sgp = NULL;
-
- switch (argc) {
- case 2:
- verbose = atoi(argv[1]);
- if (verbose < 0) verbose = 0;
- break;
- case 1:
- default:
- verbose = 0;
- }
-
- /* ----------------------------------------------------------------- */
-
- if (verbose > 0) {
- fprintf(stderr,"\n*** Streamglue read/write test\n");
- }
-
- Global_streamGlueControl = streamGlueControlConstructor();
-
-// mywfile = fopen("readwritetestdump","wb");
- mywfile = open("readwritetestdump",O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
-
- error_status = (mywfile == NULL);
-// error_status |= fprintf(mywfile,"|\n|-- Opened file for testing: %d\n|\n", mywfile);
-
-
- if (verbose > 1) {
- fprintf(stderr,"|\n|-- Opened file for testing: %d with \n|\n", mywfile);
- }
-
-/* streamGlueControlAppendAction(Global_streamGlueControl, DUMPFROMMEMORY); */
-/* streamGlueControlAppendAction(Global_streamGlueControl, DEFLATE); */
-/* streamGlueControlAppendAction(Global_streamGlueControl, ENCRYPT); */
-/* streamGlueControlAppendAction(Global_streamGlueControl, SIGN); */
- streamGlueControlAppendAction(Global_streamGlueControl, WRITEBLENFILE);
-
- if (verbose >1) {
- fprintf(stderr,"|\n|-- Created and initialized streamGlueControl thingy \n");
- fflush(stderr);
- }
-
- /* 2: the size */
- datachunksize = 12345;
-
- /* 1: a data chunk. We fill it with some numbers */
- datachunk = (char*) malloc(datachunksize);
-
- /* an ascending-ish thingy */
- dataptr = datachunk;
- for (i = 0 ;
- i < datachunksize;
- i++, dataptr++) {
- *dataptr = (i % 0xFF);
- }
-
- if (verbose >1) {
- fprintf(stderr,"|\n|-- Calling streamGlueWrite\n");
- fflush(stderr);
- }
-
- retval =
- writeStreamGlue(
- Global_streamGlueControl, // general controller
- &sgp, // ie. construct this for me
- datachunk, // raw data
- datachunksize, // data size
- 1); // i.e. finalize this write
-
- if (verbose >1) {
- fprintf(stderr,"|\n|-- streamGlueWrite returned with %d\n", retval);
- }
-
- /* ----------------------------------------------------------------- */
-
- if (close(mywfile)) {
- error_status = 1;
- if (verbose > 1) {
- fprintf(stderr,"|\n|-- file close failed.\n");
- }
- }
-
- if (verbose > 0) {
- fprintf(stderr,"|\n*** Finished test\n\n");
- }
- exit(error_status);
-}
-
-
-/* eof */
diff --git a/source/blender/writestreamglue/test/typetest/Makefile b/source/blender/writestreamglue/test/typetest/Makefile
deleted file mode 100644
index 617e358bcce..00000000000
--- a/source/blender/writestreamglue/test/typetest/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version. The Blender
-# Foundation also sells licenses for use in proprietary software under
-# the Blender License. See http://www.blender.org/BL/ for information
-# about this.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL/BL DUAL LICENSE BLOCK *****
-#
-# Make a little test for the sys_types replacement.
-#
-
-DIR = $(OCGDIR)/blender/writestreamglue/test
-ALLTARGETS = $(OBJS) $(DIR)/typetest
-
-include nan_compile.mk
-
-$(DIR)/typetest: $(OBJS)
- $(CC) $(LDFLAGS) -o $(DIR)/typetest $(OBJS)
-
-clean::
- $(RM) $(DIR)/typetest
-
-test:: $(DIR)/typetest
- $(DIR)/typetest $(NAN_TEST_VERBOSITY)
-
diff --git a/source/blender/writestreamglue/test/typetest/typetest.c b/source/blender/writestreamglue/test/typetest/typetest.c
deleted file mode 100644
index 3bab75340c8..00000000000
--- a/source/blender/writestreamglue/test/typetest/typetest.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- * A little test to see how our type defines behave.
- */
-
-#include "../../../readstreamglue/BLO_sys_types.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-int main (int argc, char *argv[])
-{
- int verbose = 0;
- int error_status = 0;
- int char_size = 0;
- int short_size = 0;
- int int_size = 0;
- int long_size = 0;
-
- switch (argc) {
- case 2:
- verbose = atoi(argv[1]);
- if (verbose < 0) verbose = 0;
- break;
- case 1:
- default:
- verbose = 0;
- }
-
- /* ----------------------------------------------------------------- */
- if (verbose > 0) {
- printf("*** Type define size test\n|\n");
- }
- /* Check if these exist, and show their sizes. */
-
-
- char_size = sizeof(uint8_t);
- short_size = sizeof(uint16_t);
- int_size = sizeof(uint32_t);
- long_size = sizeof(uint64_t);
-
- if (verbose > 1) {
- printf("|- uint8_t : \t%4d, expected 1.\n", char_size);
- printf("|- uint16_t : \t%4d, expected 2.\n", short_size);
- printf("|- uint32_t : \t%4d, expected 4.\n", int_size);
- printf("|- uint64_t : \t%4d, expected 8.\n\n", long_size);
- }
-
- if ((char_size != 1)
- || (short_size != 2)
- || (int_size != 4)
- || (long_size != 8)
- ) {
- error_status = 1;
- }
-
- if (verbose > 0) {
- if (error_status) {
- printf("|-- Size mismatch detected !!!\n|\n");
- } else {
- printf("|-- Sizes are correct.\n");
- }
- printf("|\n*** End of type define size test\n");
- }
-
- exit(error_status);
-}