Crash while using jason lib for yahoo login. | developer.brewmp.com Crash while using jason lib for yahoo login. | developer.brewmp.com

Developer

Crash while using jason lib for yahoo login.

Forums:

Hi,

 

My app is an IM client where one of the IM cient is yahoo. While login in to yahoo service i am end up with a crash while creating a session request content. The same is working in simulator. The jason libraries i was using was along with the SDK 1.0.4.433 Pro. please find the code below i was using.

 

JSONGen_Ctor(&gen, 0,0, MunduIterOPUtil::JSONGen_ReallocFunc,(void

*)GETIENV());

 

nStatus = JSONGen_BeginObject(&gen);

 

 

int iLen = STRLEN(KJSON_PRESENCESTATE);

 

 

JSONGen_PutKey(&gen, KJSON_PRESENCESTATE, iLen ); "In this API the crash is happenning" 

  

int MunduIterOPUtil::JSONGen_ReallocFunc(void *pv, int nSize, void**ppv)

 

{

 

 

int iResult = 0;

DBGPRINTF(" JSONGen_ReallocFunc >>>> Entry size[%d]" , nSize);

iResult = IEnv_ErrRealloc((IEnv *)pv, nSize, ppv);

DBGPRINTF(" JSONGen_ReallocFunc >>>> Exit Status[%d]" , iResult);

 

 

return iResult;

}

 

please help me why crash is happenning in this API.

 

 

Can you name the device model and device software build?

Can you name the device model and device software build?

I am using qualcomm QRD6240/QRD6270. 
Brewmp version 1.0.3.916. UI firmware version : Q6270B-KPXZL-3.0.33161RT.
As i said i took the jason librires from SDK 1.0.4.433 Pro and using it in SDK 1.0.2.549.1.

I am using qualcomm QRD6240/QRD6270. 
Brewmp version 1.0.3.916. UI firmware version : Q6270B-KPXZL-3.0.33161RT.
As i said i took the jason librires from SDK 1.0.4.433 Pro and using it in SDK 1.0.2.549.1.

I am using qualcomm QRD6240/QRD6270. 
Brewmp version 1.0.3.916. UI firmware version : Q6270B-KPXZL-3.0.33161RT.
As i said i took the jason librires from SDK 1.0.4.433 Pro and using it in SDK 1.0.2.549.1.

I am using qualcomm QRD6240/QRD6270. 
Brewmp version 1.0.3.916. UI firmware version : Q6270B-KPXZL-3.0.33161RT.
As i said i took the jason librires from SDK 1.0.4.433 Pro and using it in SDK 1.0.2.549.1.

 
I tried to reproduced the issue with my sample application on QRD 6270 and it didn't produce any crash on both device/simulator.Can you please try running below sample code on your side, may be the application issue, if still you see the crash can you please send device to qualcomm phone center to flash with RD9670_DS_V0.1.0. Also follow below given configuration for genarating MOD.
Device : QRD 6270
Latest Build: RD9670_DS_V0.1.0
Also below is the configuration in MSVS in order to genarate MOD using LIB files.
Open BrewMP properties-> Go to Advanced-> Uncheck Disable Automatic Makefile Generation-> enter the Libraries
ex. jsongen.lib;jsonparser.lib;a1std.lib
 
Select Appropriate configuration and compiler
Browse for Library directories
ex.
C:\Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.2.549.1\platform\languages\lib\Win32_Release;
Click on Apply and OK button.
below is the sample code:
#include "AEEModGen.h"
#include "AEEAppGen.h"
#include "AEEShell.h"
#include "AEEIEnv.h"
#include "AEEEnv.bid"
#include "myhelloworld.bid"
#include "myhelloworld_res.h"
#include "aeestdlib.h"
#include "AEEFile.h"
#include "AEEJSONGen.h"
#include "AEEIEnv.h"
#include "AEEStdErr.h"
#include "AEEstd.h"
#include "AEEIEnv.h"
#include "AEEIJSONTree.h"
#include "AEEJSONParser.h"
#include "AEEJSONGen.h"
#include "AEEJSONTree.bid"

typedef struct _myhelloworld {
AEEApplet applet;
IDisplay * piDisplay;
IShell * piShell;
AEEDeviceInfo deviceInfo;
IEnv* piEnv;
myhelloworld;

static boolean myhelloworld_HandleEvent(myhelloworld* pMe, AEEEvent eCode,

uint16 wParam, uint32 dwParam);

boolean myhelloworld_InitAppData(myhelloworld* pMe);

void myhelloworld_FreeAppData(myhelloworld* pMe);

static void myhelloworld_DrawScreen(myhelloworld * pMe);

static void jsoncheck(myhelloworld *me);

static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv);

int AEEClsCreateInstance(AEECLSID ClsId, IShell * piShell, IModule * piModule,

void ** ppObj)

{

*ppObj = NULL;

// Confirm this applet is the one intended to be created (classID matches):

if( AEECLSID_MYHELLOWORLD == ClsId ) {

// Create the applet and make room for the applet structure.

// NOTE: FreeAppData is called after EVT_APP_STOP is sent to HandleEvent.

if( TRUE == AEEApplet_New(sizeof(myhelloworld),

ClsId,

piShell,

piModule,

(IApplet**)ppObj,

(AEEHANDLER)myhelloworld_HandleEvent,

(PFNFREEAPPDATA)myhelloworld_FreeAppData) ) {

// Initialize applet data. This is called before EVT_APP_START is

// sent to the HandleEvent function.

if(TRUE == myhelloworld_InitAppData((myhelloworld*)*ppObj)) {

return AEE_SUCCESS; // Data initialized successfully.

}

else {

// Release the applet. This will free the memory allocated for

// the applet when AEEApplet_New was called.

IApplet_Release((IApplet*)*ppObj);

return AEE_EFAILED;

}

} // End AEEApplet_New

}

return AEE_EFAILED;

boolean myhelloworld_InitAppData(myhelloworld * pMe)

{

// Save local copy for easy access:

int err=0;

pMe->piDisplay = pMe->applet.m_pIDisplay;

pMe->piShell = pMe->applet.m_pIShell;

// Get the device information for this handset.

// Reference all the data by looking at the pMe->deviceInfo structure.

// Check the API reference guide for all the handy device info you can get.

pMe->deviceInfo.wStructSize = sizeof(pMe->deviceInfo);

ISHELL_GetDeviceInfo(pMe->applet.m_pIShell,&pMe->deviceInfo);

if ((err = ISHELL_CreateInstance(pMe->piShell, AEECLSID_Env , (void**)&pMe->piEnv)) != SUCCESS )

{

DBGPRINTF("AEECLSID_Env instance failed");

return FALSE;

}

return TRUE;// No failures up to this point, so return success.

void myhelloworld_FreeAppData(myhelloworld * pMe)

{

static boolean myhelloworld_HandleEvent(myhelloworld* pMe,

AEEEvent eCode, uint16 wParam, uint32 dwParam)

{
DBGPRINTF("####ecode=%d wparam=%d",eCode,wParam);
switch (eCode) {

case EVT_APP_START:
jsoncheck(pMe);
return TRUE;

case EVT_APP_STOP:
DBGPRINTF("####EVT_APP_STOP");
return TRUE;

case EVT_APP_SUSPEND:
DBGPRINTF("####EVT_APP_SUSPEND");
return TRUE;

case EVT_APP_RESUME:
return TRUE;

case EVT_APP_MESSAGE:
return TRUE;

case EVT_KEY:
return TRUE;

default:

break;

}

return FALSE; // Event wasn't handled.

static void jsoncheck(myhelloworld *me)
{
JSONGen gen = {0};

int nErr=AEE_EFAILED;

char szBuf[256];

const char *psz;

int nSize;

DBGPRINTF("####START");

JSONGen_Ctor(&gen, 0,0, JSONGen_ReallocFunc, (void *)me->piEnv);

nErr = JSONGen_BeginObject(&gen);

DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_EndObject(&gen);

DBGPRINTF("#######JSONGen_EndObject=%d",nErr);
nErr = JSONGen_GetJSON(&gen, &psz, &nSize);

DBGPRINTF("#######JSONGen_GetJSON=%d",nErr);
if (0 != std_strncmp(psz, "{}", nSize)) {
DBGPRINTF("####IF- JSONGen_GetJSON"); } else {
DBGPRINTF("####ELSE- JSONGen_GetJSON"); }

JSONGen_Dtor(&gen);
JSONGen_Ctor(&gen, szBuf, 256, 0, 0);

nErr = JSONGen_BeginObject(&gen);

DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_PutKey(&gen, "my int", std_strlen("my int"));

DBGPRINTF("#######JSONGen_PutKey=%d",nErr);

nErr = JSONGen_PutInt(&gen, 123456);

DBGPRINTF("#######JSONGen_PutInt=%d",nErr);

nErr = JSONGen_EndObject(&gen);

DBGPRINTF("#######JSONGen_EndObject=%d",nErr);

JSONGen_GetJSON(&gen, &psz, &nSize);

if (0 != std_strncmp(psz, "{\"my int\"": 123456}"", nSize)) {
DBGPRINTF(""####IF- JSONGen_GetJSON"");
} else {
DBGPRINTF(""####ELSE- JSONGen_GetJSON"");
}

JSONGen_Dtor(&gen);

DBGPRINTF(""####END"");

static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv)
{
return IEnv_ErrRealloc((IEnv *)pv, nSize, ppv);

Logs:
1980/02/05 08:18:43 3058 ####ecode=20 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:01 7666 ####ecode=0 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:03 8178 #####myhelloworld myhelloworld.c 472 3
1980/02/05 08:19:26 14066 ####START myhelloworld.c 918 3
1980/02/05 08:19:26 14066 #######JSONGen_BeginObject=0 myhelloworld.c 922 3
1980/02/05 08:19:34 16114 #######JSONGen_EndObject=0 myhelloworld.c 925 3
1980/02/05 08:19:34 16114 #######JSONGen_GetJSON=0 myhelloworld.c 928 3
1980/02/05 08:19:37 16882 ####ELSE- JSONGen_GetJSON myhelloworld.c 933 3
1980/02/05 08:19:38 17138 #######JSONGen_BeginObject=0 myhelloworld.c 939 3
1980/02/05 08:19:38 17138 #######JSONGen_PutKey=0 myhelloworld.c 942 3
1980/02/05 08:19:38 17138 #######JSONGen_PutInt=0 myhelloworld.c 945 3
1980/02/05 08:19:38 17138 #######JSONGen_EndObject=0 myhelloworld.c 948 3
1980/02/05 08:19:38 17138 ####ELSE- JSONGen_GetJSON myhelloworld.c 954 3
1980/02/05 08:19:38 17138 ####END myhelloworld.c 957 3
Thanks
 "

 
I tried to reproduced the issue with my sample application on QRD 6270 and it didn't produce any crash on both device/simulator.Can you please try running below sample code on your side, may be the application issue, if still you see the crash can you please send device to qualcomm phone center to flash with RD9670_DS_V0.1.0. Also follow below given configuration for genarating MOD.
Device : QRD 6270
Latest Build: RD9670_DS_V0.1.0
Also below is the configuration in MSVS in order to genarate MOD using LIB files.
Open BrewMP properties-> Go to Advanced-> Uncheck Disable Automatic Makefile Generation-> enter the Libraries
ex. jsongen.lib;jsonparser.lib;a1std.lib
 
Select Appropriate configuration and compiler
Browse for Library directories
ex.
C:\Program Files\Qualcomm\Brew MP SDK\Platforms\1.0.2.549.1\platform\languages\lib\Win32_Release;
Click on Apply and OK button.
below is the sample code:
#include "AEEModGen.h"
#include "AEEAppGen.h"
#include "AEEShell.h"
#include "AEEIEnv.h"
#include "AEEEnv.bid"
#include "myhelloworld.bid"
#include "myhelloworld_res.h"
#include "aeestdlib.h"
#include "AEEFile.h"
#include "AEEJSONGen.h"
#include "AEEIEnv.h"
#include "AEEStdErr.h"
#include "AEEstd.h"
#include "AEEIEnv.h"
#include "AEEIJSONTree.h"
#include "AEEJSONParser.h"
#include "AEEJSONGen.h"
#include "AEEJSONTree.bid"

typedef struct _myhelloworld {
AEEApplet applet;
IDisplay * piDisplay;
IShell * piShell;
AEEDeviceInfo deviceInfo;
IEnv* piEnv;
myhelloworld;

static boolean myhelloworld_HandleEvent(myhelloworld* pMe, AEEEvent eCode,

uint16 wParam, uint32 dwParam);

boolean myhelloworld_InitAppData(myhelloworld* pMe);

void myhelloworld_FreeAppData(myhelloworld* pMe);

static void myhelloworld_DrawScreen(myhelloworld * pMe);

static void jsoncheck(myhelloworld *me);

static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv);

int AEEClsCreateInstance(AEECLSID ClsId, IShell * piShell, IModule * piModule,

void ** ppObj)

{

*ppObj = NULL;

// Confirm this applet is the one intended to be created (classID matches):

if( AEECLSID_MYHELLOWORLD == ClsId ) {

// Create the applet and make room for the applet structure.

// NOTE: FreeAppData is called after EVT_APP_STOP is sent to HandleEvent.

if( TRUE == AEEApplet_New(sizeof(myhelloworld),

ClsId,

piShell,

piModule,

(IApplet**)ppObj,

(AEEHANDLER)myhelloworld_HandleEvent,

(PFNFREEAPPDATA)myhelloworld_FreeAppData) ) {

// Initialize applet data. This is called before EVT_APP_START is

// sent to the HandleEvent function.

if(TRUE == myhelloworld_InitAppData((myhelloworld*)*ppObj)) {

return AEE_SUCCESS; // Data initialized successfully.

}

else {

// Release the applet. This will free the memory allocated for

// the applet when AEEApplet_New was called.

IApplet_Release((IApplet*)*ppObj);

return AEE_EFAILED;

}

} // End AEEApplet_New

}

return AEE_EFAILED;

boolean myhelloworld_InitAppData(myhelloworld * pMe)

{

// Save local copy for easy access:

int err=0;

pMe->piDisplay = pMe->applet.m_pIDisplay;

pMe->piShell = pMe->applet.m_pIShell;

// Get the device information for this handset.

// Reference all the data by looking at the pMe->deviceInfo structure.

// Check the API reference guide for all the handy device info you can get.

pMe->deviceInfo.wStructSize = sizeof(pMe->deviceInfo);

ISHELL_GetDeviceInfo(pMe->applet.m_pIShell,&pMe->deviceInfo);

if ((err = ISHELL_CreateInstance(pMe->piShell, AEECLSID_Env , (void**)&pMe->piEnv)) != SUCCESS )

{

DBGPRINTF("AEECLSID_Env instance failed");

return FALSE;

}

return TRUE;// No failures up to this point, so return success.

void myhelloworld_FreeAppData(myhelloworld * pMe)

{

static boolean myhelloworld_HandleEvent(myhelloworld* pMe,

AEEEvent eCode, uint16 wParam, uint32 dwParam)

{
DBGPRINTF("####ecode=%d wparam=%d",eCode,wParam);
switch (eCode) {

case EVT_APP_START:
jsoncheck(pMe);
return TRUE;

case EVT_APP_STOP:
DBGPRINTF("####EVT_APP_STOP");
return TRUE;

case EVT_APP_SUSPEND:
DBGPRINTF("####EVT_APP_SUSPEND");
return TRUE;

case EVT_APP_RESUME:
return TRUE;

case EVT_APP_MESSAGE:
return TRUE;

case EVT_KEY:
return TRUE;

default:

break;

}

return FALSE; // Event wasn't handled.

static void jsoncheck(myhelloworld *me)
{
JSONGen gen = {0};

int nErr=AEE_EFAILED;

char szBuf[256];

const char *psz;

int nSize;

DBGPRINTF("####START");

JSONGen_Ctor(&gen, 0,0, JSONGen_ReallocFunc, (void *)me->piEnv);

nErr = JSONGen_BeginObject(&gen);

DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_EndObject(&gen);

DBGPRINTF("#######JSONGen_EndObject=%d",nErr);
nErr = JSONGen_GetJSON(&gen, &psz, &nSize);

DBGPRINTF("#######JSONGen_GetJSON=%d",nErr);
if (0 != std_strncmp(psz, "{}", nSize)) {
DBGPRINTF("####IF- JSONGen_GetJSON"); } else {
DBGPRINTF("####ELSE- JSONGen_GetJSON"); }

JSONGen_Dtor(&gen);
JSONGen_Ctor(&gen, szBuf, 256, 0, 0);

nErr = JSONGen_BeginObject(&gen);

DBGPRINTF("#######JSONGen_BeginObject=%d",nErr);

nErr = JSONGen_PutKey(&gen, "my int", std_strlen("my int"));

DBGPRINTF("#######JSONGen_PutKey=%d",nErr);

nErr = JSONGen_PutInt(&gen, 123456);

DBGPRINTF("#######JSONGen_PutInt=%d",nErr);

nErr = JSONGen_EndObject(&gen);

DBGPRINTF("#######JSONGen_EndObject=%d",nErr);

JSONGen_GetJSON(&gen, &psz, &nSize);

if (0 != std_strncmp(psz, "{\"my int\"": 123456}"", nSize)) {
DBGPRINTF(""####IF- JSONGen_GetJSON"");
} else {
DBGPRINTF(""####ELSE- JSONGen_GetJSON"");
}

JSONGen_Dtor(&gen);

DBGPRINTF(""####END"");

static int JSONGen_ReallocFunc(void *pv, int nSize, void **ppv)
{
return IEnv_ErrRealloc((IEnv *)pv, nSize, ppv);

Logs:
1980/02/05 08:18:43 3058 ####ecode=20 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:01 7666 ####ecode=0 wparam=0 myhelloworld.c 330 3
1980/02/05 08:19:03 8178 #####myhelloworld myhelloworld.c 472 3
1980/02/05 08:19:26 14066 ####START myhelloworld.c 918 3
1980/02/05 08:19:26 14066 #######JSONGen_BeginObject=0 myhelloworld.c 922 3
1980/02/05 08:19:34 16114 #######JSONGen_EndObject=0 myhelloworld.c 925 3
1980/02/05 08:19:34 16114 #######JSONGen_GetJSON=0 myhelloworld.c 928 3
1980/02/05 08:19:37 16882 ####ELSE- JSONGen_GetJSON myhelloworld.c 933 3
1980/02/05 08:19:38 17138 #######JSONGen_BeginObject=0 myhelloworld.c 939 3
1980/02/05 08:19:38 17138 #######JSONGen_PutKey=0 myhelloworld.c 942 3
1980/02/05 08:19:38 17138 #######JSONGen_PutInt=0 myhelloworld.c 945 3
1980/02/05 08:19:38 17138 #######JSONGen_EndObject=0 myhelloworld.c 948 3
1980/02/05 08:19:38 17138 ####ELSE- JSONGen_GetJSON myhelloworld.c 954 3
1980/02/05 08:19:38 17138 ####END myhelloworld.c 957 3
Thanks
 "