Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[libwspcodec] Added wsp_header_iter_is_content_type()
Also, made wsp_header_iter_is_multipart() check stricter.
(actually check that it's one of application/vnd.wap.multipart content types)
  • Loading branch information
monich committed Apr 21, 2014
1 parent 1f462c1 commit 33cf1e2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -16,7 +16,7 @@ all: debug release pkgconfig
#

VERSION_MAJOR = 2
VERSION_MINOR = 1
VERSION_MINOR = 2
VERSION_RELEASE = 0
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)

Expand Down
2 changes: 1 addition & 1 deletion README
@@ -1,2 +1,2 @@
Copyright (C) 2010-2011 Intel Corporation. All rights reserved.
Copyright (C) 2013 Jolla Ltd.
Copyright (C) 2013-2014 Jolla Ltd.
7 changes: 7 additions & 0 deletions debian/changelog
@@ -1,3 +1,10 @@
libwspcodec (2.2.0) unstable; urgency=low

* Added wsp_header_iter_is_content_type()
* Made wsp_header_iter_is_multipart() check stricter

-- Slava Monich <slava.monich@jolla.com> Mon, 21 Apr 2014 01:04:25 +0300

libwspcodec (2.1.0) unstable; urgency=low

* Took out wsp_text_header_iter stuff.
Expand Down
4 changes: 2 additions & 2 deletions rpm/libwspcodec.spec
@@ -1,5 +1,5 @@
Name: libwspcodec
Version: 2.1
Version: 2.2
Release: 0
Summary: WSP encoder and decoder library
Group: Development/Libraries
Expand Down Expand Up @@ -42,7 +42,7 @@ make install-dev DESTDIR=%{buildroot}

%files devel
%defattr(-,root,root,-)
%{_libdir}/%{name}-2.1.so
%{_libdir}/%{name}-2.2.so
%{_libdir}/pkgconfig/libwspcodec.pc
%{_includedir}/libwspcodec/wspcodec/wsputil.h
%{_includedir}/libwspcodec/wspcodec/wspcodec.h
18 changes: 16 additions & 2 deletions wspcodec/wsputil.c
Expand Up @@ -3,6 +3,7 @@
* Multimedia Messaging Service
*
* Copyright (C) 2010-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2013-2014 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -739,11 +740,24 @@ gboolean wsp_header_iter_at_end(struct wsp_header_iter *iter)
return FALSE;
}

gboolean wsp_header_iter_is_content_type(struct wsp_header_iter *iter)
{
return iter->max > iter->pos &&
is_content_type_header(iter->pdu + iter->pos, iter);
}

gboolean wsp_header_iter_is_multipart(struct wsp_header_iter *iter)
{
const unsigned char *pdu = iter->pdu + iter->pos;
const void *value;

if (!wsp_header_iter_is_content_type(iter))
return FALSE;

if (!wsp_decode_content_type(iter->pdu + iter->pos + 1,
iter->max - iter->pos - 1, &value, NULL, NULL))
return FALSE;

return is_content_type_header(pdu, iter);
return strstr(value, "application/vnd.wap.multipart.") == value;
}

enum wsp_header_type wsp_header_iter_get_hdr_type(struct wsp_header_iter *iter)
Expand Down
2 changes: 2 additions & 0 deletions wspcodec/wsputil.h
Expand Up @@ -3,6 +3,7 @@
* Multimedia Messaging Service
*
* Copyright (C) 2010-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2013-2014 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -172,6 +173,7 @@ gboolean wsp_header_iter_next(struct wsp_header_iter *iter);
unsigned char wsp_header_iter_get_code_page(struct wsp_header_iter *iter);

gboolean wsp_header_iter_at_end(struct wsp_header_iter *iter);
gboolean wsp_header_iter_is_content_type(struct wsp_header_iter *iter);
gboolean wsp_header_iter_is_multipart(struct wsp_header_iter *iter);

enum wsp_header_type wsp_header_iter_get_hdr_type(struct wsp_header_iter *iter);
Expand Down

0 comments on commit 33cf1e2

Please sign in to comment.