Commit 33cf1e21 authored by Slava Monich's avatar Slava Monich

[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)
parent 1f462c1f
......@@ -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)
......
Copyright (C) 2010-2011 Intel Corporation. All rights reserved.
Copyright (C) 2013 Jolla Ltd.
Copyright (C) 2013-2014 Jolla Ltd.
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.
......
Name: libwspcodec
Version: 2.1
Version: 2.2
Release: 0
Summary: WSP encoder and decoder library
Group: Development/Libraries
......@@ -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
......@@ -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
......@@ -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)
......
......@@ -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
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment