Patch: smsc_smpp.c

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <008801ca50d9$7a9fd1a0$02b2a8c0@tardis>
Hi,

A trivial patch, that should be able to handle all DLRs as long as they keep formal tags.

Please test.

BR,
Nikos
smsc_smpp.diff (application/octet-stream, 2 KB)
--- gw/smsc/smsc_smpp.c	2009-10-19 17:20:55.000000000 +0300
+++ gw/smsc/smsc_smpp.c	2009-10-19 17:19:09.000000000 +0300
@@ -1312,9 +1312,9 @@
                 /* only if not already here */
                 if (msgid == NULL) {
                     if ((curr = octstr_search(respstr, octstr_imm("id:"), 0)) != -1) {
-                        vpos = octstr_search_char(respstr, ' ', curr);
-                        if ((vpos-curr >0) && (vpos != -1))
-                            msgid = octstr_copy(respstr, curr+3, vpos-curr-3);
+                        if ((vpos = octstr_search_char(respstr, ' ', curr)) == -1)
+                           vpos = octstr_len(respstr) + 1;
+                        msgid = octstr_copy(respstr, curr+3, vpos-curr-3);
                     } else {
                         msgid = NULL;
                     }
@@ -1322,16 +1322,16 @@
 
                 /* get err & status code */
                 if ((curr = octstr_search(respstr, octstr_imm("stat:"), 0)) != -1) {
-                    vpos = octstr_search_char(respstr, ' ', curr);
-                    if ((vpos-curr >0) && (vpos != -1))
-                        stat = octstr_copy(respstr, curr+5, vpos-curr-5);
+                    if ((vpos = octstr_search_char(respstr, ' ', curr)) == -1)
+                        vpos = octstr_len(respstr) + 1;
+                    stat = octstr_copy(respstr, curr+5, vpos-curr-5);
                 } else {
                     stat = NULL;
                 }
                 if ((curr = octstr_search(respstr, octstr_imm("err:"), 0)) != -1) {
-                    vpos = octstr_search_char(respstr, ' ', curr);
-                    if ((vpos-curr >0) && (vpos != -1))
-                        err = octstr_copy(respstr, curr+4, vpos-curr-4);
+                    if ((vpos = octstr_search_char(respstr, ' ', curr)) == -1)
+                        vpos = octstr_len(respstr) + 1;
+                    err = octstr_copy(respstr, curr+4, vpos-curr-4);
                 } else {
                     err = NULL;
                 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.