Hi

 

I have got following code.

 

#include “xml.h”

#define bufferSize = 2048

 

void SendDefaultPage(int fp)

{

      MemHandle h;

      Err errno;

      UInt16 i=0;

     

      h = MemHandleNew (bufferSize);

     

      StartElement(h, "Contact", &errno);

      for (i=0; i<1000; i++)

      {

            StartElement(h, "Item", &errno);

            ElementData(h, "Something", &errno);

            EndElement(h, "Item", &errno);

      }

      EndElement(h, "Contact", &errno);

      EndXmlDocument(h, &errno);

      if (h)

            MemHandleFree(h);

}

 

 

In xml.c I have

 

void StartElement (MemHandle h, const Char* eleName, Err* err)

{

      StringCopy(h, lt); // lt = <

      StringCopy(h, eleName);

      StringCopy(h, gt); // gt = >

}

 

void ElementData(MemHandle h, const Char* data, Err* err)

{

      StringCopy(h, cdatast);

      StringCopy(h, data);

      StringCopy(h, cdataen);

}

 

void EndElement(MemHandle h, const Char* eleName, Err* err)

{

      StringCopy(h, lt);

      StringCopy(h, div); //div = /

      StringCopy(h, eleName);

      StringCopy(h, gt);

}

 

Err StringCopy(MemHandle h, const Char* aChar)

{

      Err err=-1;

      Int32 timeout;

      Char* aBuffer;

     

      timeout = SysTicksPerSecond()*2;

     

      aBuffer = MemHandleLock(h);

      if (!aBuffer)

            return -1;

           

      if (StrLen(aBuffer) == 0)

      {

            StrCopy(aBuffer, aChar);

            MemHandleUnlock(h);

            return errNone;

      }

      else if (StrLen(aBuffer) + StrLen(aChar) <= bufferSize)

      {

            StrCat(aBuffer, aChar);

            MemHandleUnlock(h);

            return errNone;

      }

      else if (StrLen(aBuffer) + StrLen(aChar) > bufferSize)

      {

            if (ref != 0 && fp != -1)

                   NetLibSend(ref, fp, aBuffer, StrLen(aBuffer), 0,0,0,timeout,&err);

            StrCopy(aBuffer, aChar);

            MemHandleUnlock(h);

            return errNone;

      }

      return err;

}

 

When I run the above code on Palm TX

And I come out of the application and try to access some other application Palm gets hanges

 

Please help

 

Thanks and Regards,

Micky Menezes


--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to