gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cleanup +1's in EncodeUDH


From: Pavel Machek
Subject: Cleanup +1's in EncodeUDH
Date: Mon, 3 Jun 2002 21:37:07 +0200
User-agent: Mutt/1.3.28i

Hi!

Now I know what +1 was for ;-) in EncodeUDH. It has only to be added
once. Replaced 3 with proper constant, commited.
                                                                Pavel

Index: common/gsm-sms.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-sms.c,v
retrieving revision 1.85
diff -u -u -r1.85 gsm-sms.c
--- common/gsm-sms.c    3 Jun 2002 09:59:43 -0000       1.85
+++ common/gsm-sms.c    3 Jun 2002 19:21:20 -0000
@@ -989,21 +989,24 @@
        case SMS_MultipartMessage:
                UDH[0] += headers[type].length;
                memcpy(UDH+pos+1, headers[type].header, headers[type].length);
-               rawsms->UserDataLength += headers[type].length + 1;     /* 
FIXME: I don't know why + 1 is needed */
-               rawsms->Length += headers[type].length + 1;     /* FIXME: I 
don't know why + 1 is needed */
+               rawsms->UserDataLength += headers[type].length;
+               rawsms->Length += headers[type].length;
                break;
        default:
                dprintf("Not supported User Data Header type\n");
                break;
        }
+       if (!rawsms->UDHIndicator) {
+               rawsms->UDHIndicator = 1;
+               rawsms->Length++;               /* Length takes one byte, too */
+               rawsms->UserDataLength++;
+       }
        return GE_NONE;
 }
 
 static GSM_Error EncodeConcatHeader(GSM_SMSMessage *rawsms, int this, int 
total)
 {
        EncodeUDH(rawsms, SMS_ConcatenatedMessages);
-       rawsms->Length --;
-       rawsms->UserDataLength --;
        rawsms->UserData[ 9] = 0xce;
        rawsms->UserData[10] = total;
        rawsms->UserData[11] = this;
@@ -1082,7 +1085,7 @@
 
        rawsms->Length = rawsms->UserDataLength = 0;
 
-       for (i=0; i<3; i++) {
+       for (i=0; i<SMS_MAX_PART_NUMBER; i++) {
                switch (sms->UserData[i].Type) {
                case SMS_BitmapData:
                        error = GE_NONE;
@@ -1156,7 +1159,6 @@
                        rawsms->Length += size;
                        rawsms->UserDataLength += size;
                        rawsms->DCS = 0xf5;
-                       rawsms->UDHIndicator = 1;
                        break;
 
                case SMS_RingtoneData:
@@ -1166,7 +1168,6 @@
                        rawsms->Length += size;
                        rawsms->UserDataLength += size;
                        rawsms->DCS = 0xf5;
-                       rawsms->UDHIndicator = 1;
                        break;
 
                case SMS_NoData:


-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa



reply via email to

[Prev in Thread] Current Thread [Next in Thread]