Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#Actualpolyfrag

Posted 28 March 2013 - 12:49 AM

There's a problem in here somewhere because it does show all chunks (I checked) of the file but at the end it shows only part of it.

 

Somewhere in the data copying... file size is alright.

	data = NULL;
	fsize = 0;
	position = 0;

	//zip_file* file = zip_fopen(APKArchive, filepath, 0);
	AAsset* asset_file = AAssetManager_open(g_amgr, filepath, AASSET_MODE_UNKNOWN); 

	//if(!file)
	if(!asset_file)
		return;

	unsigned char buff[257];
	unsigned char* oldbuf = NULL;
	unsigned char* newbuf = NULL;

	int r=0;
	//while((r=zip_fread(file, buff, 256)) > 0)
	while((r = AAsset_read(asset_file, buff, 256)) > 0)
	{
		newbuf = new unsigned char[fsize+r];

		//buff[r] = '\0';
		//LOGI("%s", buff);

		LOG("read %d", r);

		//if(oldbuf)
		if(fsize > 0)
		{
			memcpy(newbuf, oldbuf, fsize);
		}

		memcpy(&newbuf[fsize], buff, r);

		//if(oldbuf)
		if(fsize > 0)
		{
			delete [] oldbuf;
		}
		oldbuf = newbuf;

		fsize += r;
	}

	//LOGI("%s size=%d", filepath, fsize);
	data = newbuf;

	//char show[fsize];
	//memcpy(show, data, fsize);
	//LOGI("%s", show);

#4polyfrag

Posted 28 March 2013 - 12:46 AM

There's a problem in here somewhere because it does show all chunks (I checked) of the file but at the end it shows only part of it.

 

	data = NULL;
	fsize = 0;
	position = 0;

	//zip_file* file = zip_fopen(APKArchive, filepath, 0);
	AAsset* asset_file = AAssetManager_open(g_amgr, filepath, AASSET_MODE_UNKNOWN); 

	//if(!file)
	if(!asset_file)
		return;

	unsigned char buff[257];
	unsigned char* oldbuf = NULL;
	unsigned char* newbuf = NULL;

	int r=0;
	//while((r=zip_fread(file, buff, 256)) > 0)
	while((r = AAsset_read(asset_file, buff, 256)) > 0)
	{
		newbuf = new unsigned char[fsize+r];

		//buff[r] = '\0';
		//LOGI("%s", buff);

		LOG("read %d", r);

		//if(oldbuf)
		if(fsize > 0)
		{
			memcpy(newbuf, oldbuf, fsize);
		}

		memcpy(&newbuf[fsize], buff, r);

		//if(oldbuf)
		if(fsize > 0)
		{
			delete [] oldbuf;
		}
		oldbuf = newbuf;

		fsize += r;
	}

	//LOGI("%s size=%d", filepath, fsize);
	data = newbuf;

	//char show[fsize];
	//memcpy(show, data, fsize);
	//LOGI("%s", show);

#3polyfrag

Posted 28 March 2013 - 12:44 AM

There's a problem in here somewhere because it does show all chunks (I checked) of the file but at the end it shows only part of it.

 

	data = NULL;
	fsize = 0;
	position = 0;

	//zip_file* file = zip_fopen(APKArchive, filepath, 0);
	AAsset* asset_file = AAssetManager_open(g_amgr, filepath, AASSET_MODE_UNKNOWN); 

	//if(!file)
	if(!asset_file)
		return;

	unsigned char buff[257];
	unsigned char* oldbuf = NULL;
	unsigned char* newbuf = NULL;

	int r=0;
	//while((r=zip_fread(file, buff, 256)) > 0)
	while((r = AAsset_read(asset_file, buff, 256)) > 0)
	{
		newbuf = new unsigned char[fsize+r];

		//buff[r] = '\0';
		//LOGI("%s", buff);

		LOG("read %d", r);

		//if(oldbuf)
		if(fsize > 0)
		{
			memcpy(newbuf, oldbuf, fsize);
		}

		memcpy(&newbuf[fsize], buff, r);

		//if(oldbuf)
		if(fsize > 0)
		{
			delete [] oldbuf;
		}
		oldbuf = newbuf;

		fsize += r;
	}

	//LOGI("%s size=%d", filepath, fsize);
	data = newbuf;

#2polyfrag

Posted 28 March 2013 - 12:44 AM

There's a problem in here somewhere because it does show all chunks (I checked) of the file but at the end it shows only part of it.

 

	data = NULL;
	fsize = 0;
	position = 0;

	//zip_file* file = zip_fopen(APKArchive, filepath, 0);
	AAsset* asset_file = AAssetManager_open(g_amgr, filepath, AASSET_MODE_UNKNOWN); 

	//if(!file)
	if(!asset_file)
		return;

	unsigned char buff[256];
	unsigned char* oldbuf = NULL;
	unsigned char* newbuf = NULL;

	int r=0;
	//while((r=zip_fread(file, buff, 256)) > 0)
	while((r = AAsset_read(asset_file, buff, 256)) > 0)
	{
		newbuf = new unsigned char[fsize+r];

		//buff[r] = '\0';
		//LOGI("%s", buff);

		LOG("read %d", r);

		//if(oldbuf)
		if(fsize > 0)
		{
			memcpy(newbuf, oldbuf, fsize);
		}

		memcpy(&newbuf[fsize], buff, r);

		//if(oldbuf)
		if(fsize > 0)
		{
			delete [] oldbuf;
		}
		oldbuf = newbuf;

		fsize += r;
	}

	//LOGI("%s size=%d", filepath, fsize);
	data = newbuf;

#1polyfrag

Posted 28 March 2013 - 12:42 AM

There's a problem in it somewhere because it does show all chunks (I checked) of the file but at the end it shows only part of it.


PARTNERS