Branch update for mygnokii2002_03_17_19_29nl
[gnokii.git] / common / gsm-sms.c
index cfc0061..0f9756e 100644 (file)
@@ -494,7 +494,7 @@ GSM_Error GSM_DecodeETSISMSSubmitData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *E
       fprintf(stdout, "   7 bit SMS, body is (length %i): ",SMS->Length);
 #endif /* DEBUG */
 
       fprintf(stdout, "   7 bit SMS, body is (length %i): ",SMS->Length);
 #endif /* DEBUG */
 
-      DecodeDefault (SMS->MessageText, output, tmp);
+      DecodeDefault (SMS->MessageText, output, SMS->Length);
 
 #ifdef DEBUG
       fprintf(stdout, "%s\n",SMS->MessageText);          
 
 #ifdef DEBUG
       fprintf(stdout, "%s\n",SMS->MessageText);          
@@ -733,6 +733,7 @@ GSM_Error GSM_EncodeETSISMSSubmitValidity(GSM_SMSMessage *SMS,GSM_ETSISMSMessage
 GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_MessageType PDU, int *length)
 {
   int size=0;
 GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_MessageType PDU, int *length)
 {
   int size=0;
+  GSM_Error error;
 
   ETSI->firstbyte=0;
   ETSI->TPPID=0;
 
   ETSI->firstbyte=0;
   ETSI->TPPID=0;
@@ -752,8 +753,10 @@ GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_M
       /* Mask for request for delivery report from SMSC */
       if (SMS->Type == GST_DR) ETSI->firstbyte |= 32;
 
       /* Mask for request for delivery report from SMSC */
       if (SMS->Type == GST_DR) ETSI->firstbyte |= 32;
 
-      GSM_EncodeETSISMSSubmitHeader(SMS, ETSI);
-      GSM_EncodeETSISMSSubmitValidity(SMS, ETSI);
+      error=GSM_EncodeETSISMSSubmitHeader(SMS, ETSI);
+      if (error!=GE_NONE) return error;
+      error=GSM_EncodeETSISMSSubmitValidity(SMS, ETSI);
+      if (error!=GE_NONE) return error;
       size=GSM_EncodeETSISMSSubmitData(SMS, ETSI);
 
       break;
       size=GSM_EncodeETSISMSSubmitData(SMS, ETSI);
 
       break;
@@ -763,7 +766,8 @@ GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_M
       /* Bits 1 and 0: 00. SMS-Deliver */
       ETSI->firstbyte |= 0x00;
 
       /* Bits 1 and 0: 00. SMS-Deliver */
       ETSI->firstbyte |= 0x00;
 
-      GSM_EncodeETSISMSSubmitHeader(SMS, ETSI);
+      error=GSM_EncodeETSISMSSubmitHeader(SMS, ETSI);
+      if (error!=GE_NONE) return error;
       GSM_EncodeSMSDateTime(&SMS->Time, ETSI->DeliveryDateTime);
       size=GSM_EncodeETSISMSSubmitData(SMS, ETSI);
 
       GSM_EncodeSMSDateTime(&SMS->Time, ETSI->DeliveryDateTime);
       size=GSM_EncodeETSISMSSubmitData(SMS, ETSI);