[asterisk-commits] russell: branch group/mime r61258 - in
/team/group/mime: ./ main/ main/minimime/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Apr 10 11:48:33 MST 2007
Author: russell
Date: Tue Apr 10 13:48:32 2007
New Revision: 61258
URL: http://svn.digium.com/view/asterisk?view=rev&rev=61258
Log:
Add stuff to demonstrate a problem ...
Added:
team/group/mime/main/minimime/ast_postdata.gz (with props)
team/group/mime/main/minimime/mytest.c (with props)
Modified:
team/group/mime/Makefile.moddir_rules
team/group/mime/main/Makefile
team/group/mime/main/minimime/ (props changed)
team/group/mime/main/minimime/Makefile
Modified: team/group/mime/Makefile.moddir_rules
URL: http://svn.digium.com/view/asterisk/team/group/mime/Makefile.moddir_rules?view=diff&rev=61258&r1=61257&r2=61258
==============================================================================
--- team/group/mime/Makefile.moddir_rules (original)
+++ team/group/mime/Makefile.moddir_rules Tue Apr 10 13:48:32 2007
@@ -13,7 +13,7 @@
ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
ifeq ($(findstring astmm.h,$(ASTCFLAGS)),)
- ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
+ #ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
endif
endif
Modified: team/group/mime/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/Makefile?view=diff&rev=61258&r1=61257&r2=61258
==============================================================================
--- team/group/mime/main/Makefile (original)
+++ team/group/mime/main/Makefile Tue Apr 10 13:48:32 2007
@@ -134,7 +134,7 @@
endif
minimime/libmmime.a:
- @cd minimime && $(MAKE) libmmime.a
+ @cd minimime && $(MAKE) all
asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS)
@$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
Propchange: team/group/mime/main/minimime/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Apr 10 13:48:32 2007
@@ -1,1 +1,3 @@
*.o.d
+libmmime.a
+mytest
Modified: team/group/mime/main/minimime/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/Makefile?view=diff&rev=61258&r1=61257&r2=61258
==============================================================================
--- team/group/mime/main/minimime/Makefile (original)
+++ team/group/mime/main/minimime/Makefile Tue Apr 10 13:48:32 2007
@@ -37,7 +37,20 @@
ASTCFLAGS:=$(filter-out -Werror -Wundef -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes,$(ASTCFLAGS))
-all: $(LIBMMIME)
+all: $(LIBMMIME) mytest
+
+strlcpy.o: strlcpy.c
+ $(CC) -c -o $@ $<
+
+strlcat.o: strlcat.c
+ $(CC) -c -o $@ $<
+
+mytest.o: mytest.c
+ $(CC) -c -o $@ $<
+
+mytest: mytest.o strlcat.o strlcpy.o
+ if [ -f ast_postdata.gz ] ; then gunzip ast_postdata.gz ; fi
+ $(CC) -o $@ $^ $(LIBMMIME)
$(LIBMMIME): $(MM_OBJS)
$(ECHO_PREFIX) echo " [AR] $^ -> $@"
Added: team/group/mime/main/minimime/ast_postdata.gz
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/ast_postdata.gz?view=auto&rev=61258
==============================================================================
Binary file - no diff available.
Propchange: team/group/mime/main/minimime/ast_postdata.gz
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: team/group/mime/main/minimime/mytest.c
URL: http://svn.digium.com/view/asterisk/team/group/mime/main/minimime/mytest.c?view=auto&rev=61258
==============================================================================
--- team/group/mime/main/minimime/mytest.c (added)
+++ team/group/mime/main/minimime/mytest.c Tue Apr 10 13:48:32 2007
@@ -1,0 +1,71 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "mm.h"
+
+int main(int argc, char *argv[])
+{
+ const char *filename = "ast_postdata";
+ MM_CTX *ctx;
+ struct mm_mimepart *part;
+ struct mm_content *cont;
+
+ int res = 0;
+ const char *disp;
+ int i;
+
+ mm_library_init();
+ mm_codec_registerdefaultcodecs();
+
+ printf("\nThe test should run 2 times with the same results.\n\n");
+
+ for (i = 0; i < 2; i++) {
+ printf("\nTest run #%d ...\n", i + 1);
+
+ if (!(ctx = mm_context_new())) {
+ printf("Failed to create MiniMIME context!\n\n");
+ break;
+ }
+
+ res = mm_parse_file(ctx, filename, MM_PARSE_LOOSE, 0);
+ if (res == -1) {
+ printf("Error parsing file %s\n\n", filename);
+ mm_context_free(ctx);
+ break;
+ }
+
+ res = mm_context_countparts(ctx);
+ if (res != 3) {
+ printf("This file should have 3 parts, but parser says %d\n\n", res);
+ res = -1;
+ mm_context_free(ctx);
+ break;
+ }
+
+ /* Part 2 is the file */
+ if (!(part = mm_context_getpart(ctx, 2))) {
+ printf("Failed to get a reference to part 2 of the MIME data\n\n");
+ res = -1;
+ mm_context_free(ctx);
+ break;
+ }
+
+ /* This is where the problems are demonstrated. */
+ cont = mm_mimepart_getcontent(part);
+
+ if ((disp = mm_content_getdispositiontype(cont)))
+ printf("SUCCESS: Got the Content-Disposition: %s\n", disp);
+ else
+ printf("FAILURE: Could not get the Content-Disposition value!\n");
+
+ res = mm_mimepart_getlength(part);
+ if (res == 1279)
+ printf("SUCCESS: Got the correct value for the body length: %d\n\n", res);
+ else
+ printf("FAILURE: The parser says this MIME part has %d length, but it should be 1279\n\n", res);
+
+ mm_context_free(ctx);
+ }
+
+ exit(res);
+}
Propchange: team/group/mime/main/minimime/mytest.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/group/mime/main/minimime/mytest.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/group/mime/main/minimime/mytest.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the asterisk-commits
mailing list