gmime r1322 - in trunk: . docs/reference gmime mono src tests
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: gmime r1322 - in trunk: . docs/reference gmime mono src tests
- Date: Sun, 1 Jun 2008 02:38:01 +0000 (UTC)
Author: fejj
Date: Sun Jun 1 02:38:01 2008
New Revision: 1322
URL: http://svn.gnome.org/viewvc/gmime?rev=1322&view=rev
Log:
2008-05-31 Jeffrey Stedfast <fejj novell com>
* tests/test-html.c (main): Updated.
* tests/test-best.c (main): Updated.
* src/uuencode.c (uuencode): Updated.
* gmime/gmime-part.c: Updated for filter stream change.
* gmime/gmime-multipart-signed.c (g_mime_multipart_signed_sign):
Updated for filter stream change.
* gmime/gmime-multipart-encrypted.c: Updated for filter stream
change.
* gmime/gmime-gpg-context.c (gpg_ctx_new): Updated for filter
stream change.
* gmime/gmime-filter-yenc.c (g_mime_filter_yenc_new): Now takes a
bool encode argument rather than a GMimeFilterYencDirection - no
sense making this more complicated than it needs to be.
* gmime/gmime-stream-filter.c (g_mime_stream_filter_new): Renamed
from g_mime_stream_filter_new_with_stream(). This is the only
constructor, so should be named _new().
Modified:
trunk/ChangeLog
trunk/docs/reference/gmime-sections.txt
trunk/gmime/gmime-data-wrapper.c
trunk/gmime/gmime-filter-yenc.c
trunk/gmime/gmime-filter-yenc.h
trunk/gmime/gmime-gpg-context.c
trunk/gmime/gmime-multipart-encrypted.c
trunk/gmime/gmime-multipart-signed.c
trunk/gmime/gmime-part.c
trunk/gmime/gmime-stream-filter.c
trunk/gmime/gmime-stream-filter.h
trunk/mono/gmime-api.raw
trunk/src/uudecode.c
trunk/src/uuencode.c
trunk/tests/test-best.c
trunk/tests/test-html.c
Modified: trunk/docs/reference/gmime-sections.txt
==============================================================================
--- trunk/docs/reference/gmime-sections.txt (original)
+++ trunk/docs/reference/gmime-sections.txt Sun Jun 1 02:38:01 2008
@@ -239,7 +239,7 @@
<SECTION>
<FILE>gmime-stream-filter</FILE>
GMimeStreamFilter
-g_mime_stream_filter_new_with_stream
+g_mime_stream_filter_new
g_mime_stream_filter_add
g_mime_stream_filter_remove
@@ -498,6 +498,14 @@
<SECTION>
<FILE>gmime-filter-yenc</FILE>
+GMimeFilterYenc
+g_mime_filter_yenc_new
+g_mime_filter_yenc_set_state
+g_mime_filter_yenc_set_crc
+g_mime_filter_yenc_get_crc
+g_mime_filter_yenc_get_pcrc
+
+<SUBSECTION>
GMIME_YENCODE_CRC_INIT
GMIME_YENCODE_CRC_FINAL
GMIME_YENCODE_STATE_INIT
@@ -511,13 +519,6 @@
g_mime_ydecode_step
g_mime_yencode_step
g_mime_yencode_close
-GMimeFilterYenc
-GMimeFilterYencDirection
-g_mime_filter_yenc_new
-g_mime_filter_yenc_set_state
-g_mime_filter_yenc_set_crc
-g_mime_filter_yenc_get_crc
-g_mime_filter_yenc_get_pcrc
<SUBSECTION Private>
g_mime_filter_yenc_get_type
Modified: trunk/gmime/gmime-data-wrapper.c
==============================================================================
--- trunk/gmime/gmime-data-wrapper.c (original)
+++ trunk/gmime/gmime-data-wrapper.c Sun Jun 1 02:38:01 2008
@@ -248,7 +248,7 @@
case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
case GMIME_CONTENT_ENCODING_UUENCODE:
filter = g_mime_filter_basic_new (wrapper->encoding, FALSE);
- filtered_stream = g_mime_stream_filter_new_with_stream (wrapper->stream);
+ filtered_stream = g_mime_stream_filter_new (wrapper->stream);
g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
g_object_unref (filter);
break;
Modified: trunk/gmime/gmime-filter-yenc.c
==============================================================================
--- trunk/gmime/gmime-filter-yenc.c (original)
+++ trunk/gmime/gmime-filter-yenc.c Sun Jun 1 02:38:01 2008
@@ -114,7 +114,7 @@
{
GMimeFilterYenc *yenc = (GMimeFilterYenc *) filter;
- return g_mime_filter_yenc_new (yenc->direction);
+ return g_mime_filter_yenc_new (yenc->encode);
}
/* here we do all of the basic yEnc filtering */
@@ -127,8 +127,7 @@
unsigned char *outbuf;
size_t newlen = 0;
- switch (yenc->direction) {
- case GMIME_FILTER_YENC_DIRECTION_ENCODE:
+ if (yenc->encode) {
/* won't go to more than 2 * (x + 2) + 62 */
g_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
outbuf = (unsigned char *) filter->outbuf;
@@ -136,8 +135,7 @@
newlen = g_mime_yencode_step (inbuf, len, outbuf, ¥c->state,
¥c->pcrc, ¥c->crc);
g_assert (newlen <= (len + 2) * 2 + 62);
- break;
- case GMIME_FILTER_YENC_DIRECTION_DECODE:
+ } else {
if (!(yenc->state & GMIME_YDECODE_STATE_DECODE)) {
register char *inptr, *inend;
size_t left;
@@ -212,12 +210,11 @@
} else {
newlen = 0;
}
- break;
}
+ *outprespace = filter->outpre;
*out = filter->outbuf;
*outlen = newlen;
- *outprespace = filter->outpre;
}
static void
@@ -229,8 +226,7 @@
unsigned char *outbuf;
size_t newlen = 0;
- switch (yenc->direction) {
- case GMIME_FILTER_YENC_DIRECTION_ENCODE:
+ if (yenc->encode) {
/* won't go to more than 2 * (x + 2) + 62 */
g_mime_filter_set_size (filter, (len + 2) * 2 + 62, FALSE);
outbuf = (unsigned char *) filter->outbuf;
@@ -238,8 +234,7 @@
newlen = g_mime_yencode_close (inbuf, len, outbuf, ¥c->state,
¥c->pcrc, ¥c->crc);
g_assert (newlen <= (len + 2) * 2 + 62);
- break;
- case GMIME_FILTER_YENC_DIRECTION_DECODE:
+ } else {
if ((yenc->state & GMIME_YDECODE_STATE_DECODE) && !(yenc->state & GMIME_YDECODE_STATE_END)) {
/* all yEnc headers have been found so we can now start decoding */
g_mime_filter_set_size (filter, len + 3, FALSE);
@@ -251,12 +246,11 @@
} else {
newlen = 0;
}
- break;
}
+ *outprespace = filter->outpre;
*out = filter->outbuf;
*outlen = newlen;
- *outprespace = filter->outpre;
}
/* should this 'flush' outstanding state/data bytes? */
@@ -265,14 +259,11 @@
{
GMimeFilterYenc *yenc = (GMimeFilterYenc *) filter;
- switch (yenc->direction) {
- case GMIME_FILTER_YENC_DIRECTION_ENCODE:
+ if (yenc->encode)
yenc->state = GMIME_YENCODE_STATE_INIT;
- break;
- case GMIME_FILTER_YENC_DIRECTION_DECODE:
+ else
yenc->state = GMIME_YDECODE_STATE_INIT;
- break;
- }
+
yenc->pcrc = GMIME_YENCODE_CRC_INIT;
yenc->crc = GMIME_YENCODE_CRC_INIT;
}
@@ -280,30 +271,24 @@
/**
* g_mime_filter_yenc_new:
- * @direction: encode direction
+ * @encode: encode vs decode
*
* Creates a new yEnc filter.
*
* Returns: a new yEnc filter.
**/
GMimeFilter *
-g_mime_filter_yenc_new (GMimeFilterYencDirection direction)
+g_mime_filter_yenc_new (gboolean encode)
{
GMimeFilterYenc *new;
new = g_object_new (GMIME_TYPE_FILTER_YENC, NULL);
- new->direction = direction;
+ new->encode = encode;
- switch (direction) {
- case GMIME_FILTER_YENC_DIRECTION_ENCODE:
+ if (encode)
new->state = GMIME_YENCODE_STATE_INIT;
- break;
- case GMIME_FILTER_YENC_DIRECTION_DECODE:
+ else
new->state = GMIME_YDECODE_STATE_INIT;
- break;
- default:
- g_assert_not_reached ();
- }
return (GMimeFilter *) new;
}
Modified: trunk/gmime/gmime-filter-yenc.h
==============================================================================
--- trunk/gmime/gmime-filter-yenc.h (original)
+++ trunk/gmime/gmime-filter-yenc.h Sun Jun 1 02:38:01 2008
@@ -38,19 +38,6 @@
/**
- * GMimeFilterYencDirection:
- * @GMIME_FILTER_YENC_DIRECTION_ENCODE: yEncode.
- * @GMIME_FILTER_YENC_DIRECTION_DECODE: yDecode.
- *
- * The direction the #GMimeFilterYenc should convert.
- **/
-typedef enum {
- GMIME_FILTER_YENC_DIRECTION_ENCODE,
- GMIME_FILTER_YENC_DIRECTION_DECODE
-} GMimeFilterYencDirection;
-
-
-/**
* GMIME_YDECODE_STATE_INIT:
*
* Initial state for the g_mime_ydecode_step() function.
@@ -137,7 +124,7 @@
struct _GMimeFilterYenc {
GMimeFilter parent_object;
- GMimeFilterYencDirection direction;
+ gboolean encode;
int part;
@@ -154,7 +141,7 @@
GType g_mime_filter_yenc_get_type (void);
-GMimeFilter *g_mime_filter_yenc_new (GMimeFilterYencDirection direction);
+GMimeFilter *g_mime_filter_yenc_new (gboolean encode);
void g_mime_filter_yenc_set_state (GMimeFilterYenc *yenc, int state);
void g_mime_filter_yenc_set_crc (GMimeFilterYenc *yenc, guint32 crc);
Modified: trunk/gmime/gmime-gpg-context.c
==============================================================================
--- trunk/gmime/gmime-gpg-context.c (original)
+++ trunk/gmime/gmime-gpg-context.c Sun Jun 1 02:38:01 2008
@@ -365,8 +365,8 @@
GMimeStream *fstream;
GMimeFilter *filter;
+ fstream = g_mime_stream_filter_new (stream);
filter = g_mime_filter_charset_new (charset, "UTF-8");
- fstream = g_mime_stream_filter_new_with_stream (stream);
g_mime_stream_filter_add ((GMimeStreamFilter *) fstream, filter);
g_object_unref (stream);
g_object_unref (filter);
Modified: trunk/gmime/gmime-multipart-encrypted.c
==============================================================================
--- trunk/gmime/gmime-multipart-encrypted.c (original)
+++ trunk/gmime/gmime-multipart-encrypted.c Sun Jun 1 02:38:01 2008
@@ -258,7 +258,7 @@
/* get the cleartext */
stream = g_mime_stream_mem_new ();
- filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = g_mime_stream_filter_new (stream);
crlf_filter = g_mime_filter_crlf_new (GMIME_FILTER_CRLF_ENCODE,
GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
@@ -404,7 +404,7 @@
g_object_unref (wrapper);
stream = g_mime_stream_mem_new ();
- filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = g_mime_stream_filter_new (stream);
crlf_filter = g_mime_filter_crlf_new (GMIME_FILTER_CRLF_DECODE,
GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), crlf_filter);
Modified: trunk/gmime/gmime-multipart-signed.c
==============================================================================
--- trunk/gmime/gmime-multipart-signed.c (original)
+++ trunk/gmime/gmime-multipart-signed.c Sun Jun 1 02:38:01 2008
@@ -308,7 +308,7 @@
/* get the cleartext */
stream = g_mime_stream_mem_new ();
- filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = g_mime_stream_filter_new (stream);
/* Note: see rfc3156, section 3 - second note */
from_filter = g_mime_filter_from_new (GMIME_FILTER_FROM_MODE_ARMOR);
@@ -326,7 +326,7 @@
g_mime_stream_reset (stream);
/* Note: see rfc2015 or rfc3156, section 5.1 */
- filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = g_mime_stream_filter_new (stream);
crlf_filter = g_mime_filter_crlf_new (GMIME_FILTER_CRLF_ENCODE,
GMIME_FILTER_CRLF_MODE_CRLF_ONLY);
g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), crlf_filter);
@@ -457,7 +457,7 @@
/* get the content stream */
stream = g_mime_stream_mem_new ();
- filtered_stream = g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = g_mime_stream_filter_new (stream);
/* Note: see rfc2015 or rfc3156, section 5.1 */
crlf_filter = g_mime_filter_crlf_new (GMIME_FILTER_CRLF_ENCODE,
Modified: trunk/gmime/gmime-part.c
==============================================================================
--- trunk/gmime/gmime-part.c (original)
+++ trunk/gmime/gmime-part.c Sun Jun 1 02:38:01 2008
@@ -339,8 +339,8 @@
/* fall thru... */
case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
case GMIME_CONTENT_ENCODING_BASE64:
+ filtered_stream = g_mime_stream_filter_new (stream);
filter = g_mime_filter_basic_new (part->encoding, TRUE);
- filtered_stream = g_mime_stream_filter_new_with_stream (stream);
g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
g_object_unref (filter);
break;
@@ -596,7 +596,7 @@
if (!content_md5) {
/* compute a md5sum */
stream = g_mime_stream_null_new ();
- filtered_stream = (GMimeStreamFilter *) g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = (GMimeStreamFilter *) g_mime_stream_filter_new (stream);
g_object_unref (stream);
content_type = g_mime_object_get_content_type ((GMimeObject *) mime_part);
@@ -661,7 +661,7 @@
return FALSE;
stream = g_mime_stream_null_new ();
- filtered_stream = (GMimeStreamFilter *) g_mime_stream_filter_new_with_stream (stream);
+ filtered_stream = (GMimeStreamFilter *) g_mime_stream_filter_new (stream);
g_object_unref (stream);
content_type = g_mime_object_get_content_type ((GMimeObject *) mime_part);
Modified: trunk/gmime/gmime-stream-filter.c
==============================================================================
--- trunk/gmime/gmime-stream-filter.c (original)
+++ trunk/gmime/gmime-stream-filter.c Sun Jun 1 02:38:01 2008
@@ -399,16 +399,16 @@
/**
- * g_mime_stream_filter_new_with_stream:
+ * g_mime_stream_filter_new:
* @stream: source stream
*
- * Creates a new GMimeStreamFilter object using @stream as the source
+ * Creates a new #GMimeStreamFilter object using @stream as the source
* stream.
*
* Returns: a new filter stream with @stream as its source.
**/
GMimeStream *
-g_mime_stream_filter_new_with_stream (GMimeStream *stream)
+g_mime_stream_filter_new (GMimeStream *stream)
{
GMimeStreamFilter *filter;
Modified: trunk/gmime/gmime-stream-filter.h
==============================================================================
--- trunk/gmime/gmime-stream-filter.h (original)
+++ trunk/gmime/gmime-stream-filter.h Sun Jun 1 02:38:01 2008
@@ -53,7 +53,7 @@
GType g_mime_stream_filter_get_type (void);
-GMimeStream *g_mime_stream_filter_new_with_stream (GMimeStream *stream);
+GMimeStream *g_mime_stream_filter_new (GMimeStream *stream);
int g_mime_stream_filter_add (GMimeStreamFilter *fstream, GMimeFilter *filter);
void g_mime_stream_filter_remove (GMimeStreamFilter *fstream, int id);
Modified: trunk/mono/gmime-api.raw
==============================================================================
--- trunk/mono/gmime-api.raw (original)
+++ trunk/mono/gmime-api.raw Sun Jun 1 02:38:01 2008
@@ -51,10 +51,6 @@
<member cname="GMIME_FILTER_GZIP_MODE_ZIP" name="Zip" />
<member cname="GMIME_FILTER_GZIP_MODE_UNZIP" name="Unzip" />
</enum>
- <enum name="FilterYencDirection" cname="GMimeFilterYencDirection" type="enum">
- <member cname="GMIME_FILTER_YENC_DIRECTION_ENCODE" name="Encode" />
- <member cname="GMIME_FILTER_YENC_DIRECTION_DECODE" name="Decode" />
- </enum>
<enum name="SeekWhence" cname="GMimeSeekWhence" type="enum">
<member cname="GMIME_STREAM_SEEK_SET" name="Set" value="SEEK_SET" />
<member cname="GMIME_STREAM_SEEK_CUR" name="Cur" value="SEEK_CUR" />
@@ -588,7 +584,7 @@
</method>
</object>
<object name="FilterYenc" cname="GMimeFilterYenc" parent="GMimeFilter">
- <field name="Direction" cname="direction" type="GMimeFilterYencDirection" />
+ <field name="Encode" cname="encode" type="gboolean" />
<field name="Part" cname="part" type="int" />
<field name="State" cname="state" type="int" />
<field name="Pcrc" cname="pcrc" type="guint32" />
@@ -604,7 +600,7 @@
</method>
<constructor cname="g_mime_filter_yenc_new">
<parameters>
- <parameter type="GMimeFilterYencDirection" name="direction" />
+ <parameter type="gboolean" name="encode" />
</parameters>
</constructor>
<method name="SetCrc" cname="g_mime_filter_yenc_set_crc">
@@ -1704,7 +1700,7 @@
<method name="GetType" cname="g_mime_stream_filter_get_type" shared="true">
<return-type type="GType" />
</method>
- <constructor cname="g_mime_stream_filter_new_with_stream">
+ <constructor cname="g_mime_stream_filter_new">
<parameters>
<parameter type="GMimeStream*" name="stream" />
</parameters>
Modified: trunk/src/uudecode.c
==============================================================================
--- trunk/src/uudecode.c (original)
+++ trunk/src/uudecode.c Sun Jun 1 02:38:01 2008
@@ -201,7 +201,7 @@
istream = g_mime_stream_file_new (fp);
ostream = g_mime_stream_fs_new (fd);
- fstream = g_mime_stream_filter_new_with_stream (ostream);
+ fstream = g_mime_stream_filter_new (ostream);
filter = g_mime_filter_basic_new (encoding, FALSE);
g_mime_stream_filter_add ((GMimeStreamFilter *) fstream, filter);
g_object_unref (ostream);
Modified: trunk/src/uuencode.c
==============================================================================
--- trunk/src/uuencode.c (original)
+++ trunk/src/uuencode.c Sun Jun 1 02:38:01 2008
@@ -171,7 +171,7 @@
istream = g_mime_stream_fs_new (fd);
- fstream = g_mime_stream_filter_new_with_stream (ostream);
+ fstream = g_mime_stream_filter_new (ostream);
filter = g_mime_filter_basic_new (encoding, TRUE);
g_mime_stream_filter_add ((GMimeStreamFilter *) fstream, filter);
Modified: trunk/tests/test-best.c
==============================================================================
--- trunk/tests/test-best.c (original)
+++ trunk/tests/test-best.c Sun Jun 1 02:38:01 2008
@@ -41,7 +41,7 @@
g_mime_init (0);
stream = g_mime_stream_fs_new (fd);
- istream = g_mime_stream_filter_new_with_stream (stream);
+ istream = g_mime_stream_filter_new (stream);
g_object_unref (stream);
best = (GMimeFilterBest *) g_mime_filter_best_new (GMIME_FILTER_BEST_CHARSET |
GMIME_FILTER_BEST_ENCODING);
Modified: trunk/tests/test-html.c
==============================================================================
--- trunk/tests/test-html.c (original)
+++ trunk/tests/test-html.c Sun Jun 1 02:38:01 2008
@@ -32,7 +32,7 @@
g_mime_init (0);
fstream = g_mime_stream_file_new (stdout);
- ostream = g_mime_stream_filter_new_with_stream (fstream);
+ ostream = g_mime_stream_filter_new (fstream);
g_object_unref (fstream);
html = g_mime_filter_html_new (GMIME_FILTER_HTML_CONVERT_NL |
GMIME_FILTER_HTML_CONVERT_SPACES |
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]