|
version 1.1.1.1.2.1, 2010/03/24 16:31:28
|
version 1.2.2.1, 2011/05/10 21:02:46
|
|
Line 5
|
Line 5
|
| * $Author$ |
* $Author$ |
| * $Id$ |
* $Id$ |
| * |
* |
| *************************************************************************/ | ************************************************************************** |
| | The ELWIX and AITNET software is distributed under the following |
| | terms: |
| | |
| | All of the documentation and software included in the ELWIX and AITNET |
| | Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| | |
| | Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
| | by Michael Pounov <misho@elwix.org>. All rights reserved. |
| | |
| | Redistribution and use in source and binary forms, with or without |
| | modification, are permitted provided that the following conditions |
| | are met: |
| | 1. Redistributions of source code must retain the above copyright |
| | notice, this list of conditions and the following disclaimer. |
| | 2. Redistributions in binary form must reproduce the above copyright |
| | notice, this list of conditions and the following disclaimer in the |
| | documentation and/or other materials provided with the distribution. |
| | 3. All advertising materials mentioning features or use of this software |
| | must display the following acknowledgement: |
| | This product includes software developed by Michael Pounov <misho@elwix.org> |
| | ELWIX - Embedded LightWeight unIX and its contributors. |
| | 4. Neither the name of AITNET nor the names of its contributors |
| | may be used to endorse or promote products derived from this software |
| | without specific prior written permission. |
| | |
| | THIS SOFTWARE IS PROVIDED BY AITNET AND CONTRIBUTORS ``AS IS'' AND |
| | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| | SUCH DAMAGE. |
| | */ |
| #include "global.h" |
#include "global.h" |
| #include "tool.h" |
#include "tool.h" |
| #include "zc.h" |
#include "zc.h" |
|
Line 17 static int sync_Errno;
|
Line 54 static int sync_Errno;
|
| static char sync_Error[STRSIZ]; |
static char sync_Error[STRSIZ]; |
| |
|
| |
|
| static inline int func_comp(sync_tag_t const *t1, sync_tag_t const *t2) | static inline int |
| | func_comp(sync_tag_t const *t1, sync_tag_t const *t2) |
| { |
{ |
| return t1->st_tag - t2->st_tag; |
return t1->st_tag - t2->st_tag; |
| } |
} |
|
Line 27 static inline int func_comp(sync_tag_t const *t1, sync
|
Line 65 static inline int func_comp(sync_tag_t const *t1, sync
|
| // |
// |
| |
|
| // sync_GetErrno() Get error code of last operation |
// sync_GetErrno() Get error code of last operation |
| inline int sync_GetErrno() | inline int |
| | sync_GetErrno() |
| { |
{ |
| return sync_Errno; |
return sync_Errno; |
| } |
} |
| |
|
| // sync_GetError() Get error text of last operation |
// sync_GetError() Get error text of last operation |
| inline const char *sync_GetError() | inline const char * |
| | sync_GetError() |
| { |
{ |
| return sync_Error; |
return sync_Error; |
| } |
} |
| |
|
| // sync_SetErr() Set error to variables for internal use!!! |
// sync_SetErr() Set error to variables for internal use!!! |
| inline void syncSetErr(int eno, char *estr, ...) | inline void |
| | syncSetErr(int eno, char *estr, ...) |
| { |
{ |
| va_list lst; |
va_list lst; |
| |
|
|
Line 59 inline void syncSetErr(int eno, char *estr, ...)
|
Line 100 inline void syncSetErr(int eno, char *estr, ...)
|
| * @compress = 2 compress signatures output, 0 not compressed |
* @compress = 2 compress signatures output, 0 not compressed |
| * return: -1 error, 0 ok |
* return: -1 error, 0 ok |
| */ |
*/ |
| int syncSignature(const char *csInput, const char *csSig, int compress) | int |
| | syncSignature(const char *csInput, const char *csSig, int compress) |
| { |
{ |
| int inf, outf, f, ret; |
int inf, outf, f, ret; |
| u_char buf[CHUNK_MAX]; |
u_char buf[CHUNK_MAX]; |
|
Line 131 end:
|
Line 173 end:
|
| * @compress = 3 everything compress, 2 compressed signatures, 1 compress delta output, 0 not compressed |
* @compress = 3 everything compress, 2 compressed signatures, 1 compress delta output, 0 not compressed |
| * return: -1 error, 0 ok |
* return: -1 error, 0 ok |
| */ |
*/ |
| int syncDelta(const char *csInput, const char *csSig, const char *csDelta, int compress) | int |
| | syncDelta(const char *csInput, const char *csSig, const char *csDelta, int compress) |
| { |
{ |
| int inf, outf, f, sigf, ret, cnt; |
int inf, outf, f, sigf, ret, cnt; |
| size_t blk; |
size_t blk; |
|
Line 384 end:
|
Line 427 end:
|
| * @compress = 1 compress delta input, 0 not compressed |
* @compress = 1 compress delta input, 0 not compressed |
| * return: -1 error, 0 ok, create delta patch, 1 ok, no differences and not create patch |
* return: -1 error, 0 ok, create delta patch, 1 ok, no differences and not create patch |
| */ |
*/ |
| int syncPatch(const char *csInput, const char *csDelta, const char *csPatch, int compress) | int |
| | syncPatch(const char *csInput, const char *csDelta, const char *csPatch, int compress) |
| { |
{ |
| int inf, outf, f, d, ret, readlen; |
int inf, outf, f, d, ret, readlen; |
| char szTemp[MAXPATHLEN]; |
char szTemp[MAXPATHLEN]; |