mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 20:00:58 +01:00
finally fixed all stream related problems, z85 transparent en/decoding works, unittests all ok.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of Pretty Curved Privacy (pcp1).
|
||||
|
||||
Copyright (C) 2013 T.Linden.
|
||||
Copyright (C) 2013-2014 T.v.Dein.
|
||||
|
||||
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
|
||||
@@ -16,7 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact me by mail: <tlinden AT cpan DOT org>.
|
||||
You can contact me by mail: <tom AT vondein DOT org>.
|
||||
*/
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ typedef unsigned short dbyte; /* Double byte = 16 bits */
|
||||
typedef unsigned int qbyte; /* Quad byte = 32 bits */
|
||||
|
||||
/* key stuff, deprecated. */
|
||||
#define PCP_ENFILE_HEADER "~~~~~ BEGIN PCP ENCRYPTED FILE ~~~~~"
|
||||
#define PCP_ENFILE_FOOTER "~~~~~ END PCP ENCRYPTED FILE ~~~~~"
|
||||
#define PCP_ENFILE_HEADER "~~~~~ BEGIN PCP ENCRYPTED FILE ~~~~~\r\n"
|
||||
#define PCP_ENFILE_FOOTER "\r\n~~~~~ END PCP ENCRYPTED FILE ~~~~~\r\n"
|
||||
|
||||
#define PCP_ZFILE_HEADER "~~~~~ BEGIN Z85 ENCODED FILE ~~~~~"
|
||||
#define PCP_ZFILE_FOOTER "~~~~~ END Z85 ENCODED FILE ~~~~~"
|
||||
|
||||
@@ -70,6 +70,8 @@ struct _pcp_stream_t {
|
||||
uint8_t firstread; /**< Internal flag, will be set after first read() */
|
||||
size_t linewr; /**< Used for Z85 writing, number of chars written on last line */
|
||||
size_t blocksize; /**< Blocksize used for z85, if requested */
|
||||
uint8_t is_output; /**< marks the stream as output stream */
|
||||
size_t pos; /**< remember i/o position */
|
||||
};
|
||||
|
||||
/** The name used everywhere */
|
||||
@@ -254,6 +256,15 @@ void ps_setdetermine(Pcpstream *stream, size_t blocksize);
|
||||
*/
|
||||
void ps_armor(Pcpstream *stream, size_t blocksize);
|
||||
|
||||
|
||||
/** Disable Z85 encoding for an output stream.
|
||||
|
||||
\param[in] stream The stream object.
|
||||
*/
|
||||
void ps_unarmor(Pcpstream *stream);
|
||||
|
||||
|
||||
|
||||
/* read from primary source, decode z85 and out into cache.
|
||||
if buf != NULL, consider it as the start of encoded data
|
||||
and remove headers and comments, then continue as normal. */
|
||||
@@ -280,6 +291,9 @@ void ps_write_encode(Pcpstream *stream, Buffer *dst);
|
||||
/* really write the buffer z into the output stream */
|
||||
size_t ps_write_buf(Pcpstream *stream, Buffer *z);
|
||||
|
||||
/* tell if we really reached eof, caching or not. 1=eof, 0=ok */
|
||||
int ps_left(Pcpstream *stream);
|
||||
|
||||
#endif // HAVE_PCP_PCPSTEAM_H
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of Pretty Curved Privacy (pcp1).
|
||||
|
||||
Copyright (C) 2013 T.Linden.
|
||||
Copyright (C) 2013-2014 T.v.Dein.
|
||||
|
||||
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
|
||||
@@ -16,7 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact me by mail: <tlinden AT cpan DOT org>.
|
||||
You can contact me by mail: <tom AT vondein DOT org>.
|
||||
*/
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#define PCP_VERSION_MAJOR 0
|
||||
#define PCP_VERSION_MINOR 2
|
||||
#define PCP_VERSION_PATCH 1
|
||||
#define PCP_VERSION_PATCH 2
|
||||
|
||||
#define PCP_MAKE_VERSION(major, minor, patch) \
|
||||
((major) * 10000 + (minor) * 100 + (patch))
|
||||
|
||||
Reference in New Issue
Block a user