Indent/style cleanups
This commit is contained in:
parent
8e27d23bd5
commit
3d931d946e
|
@ -46,7 +46,8 @@ static int Buf_EnsureSize(CBuf *dest, size_t size)
|
||||||
|
|
||||||
static Byte kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
static Byte kUtf8Limits[5] = { 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||||
|
|
||||||
static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t srcLen)
|
static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen,
|
||||||
|
const UInt16 *src, size_t srcLen)
|
||||||
{
|
{
|
||||||
size_t destPos = 0, srcPos = 0;
|
size_t destPos = 0, srcPos = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -80,13 +81,15 @@ static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t
|
||||||
if (value < (((UInt32)1) << (numAdds * 5 + 6)))
|
if (value < (((UInt32)1) << (numAdds * 5 + 6)))
|
||||||
break;
|
break;
|
||||||
if (dest)
|
if (dest)
|
||||||
dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
|
dest[destPos] = (char)(kUtf8Limits[numAdds - 1]
|
||||||
|
+ (value >> (6 * numAdds)));
|
||||||
destPos++;
|
destPos++;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
numAdds--;
|
numAdds--;
|
||||||
if (dest)
|
if (dest)
|
||||||
dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
|
dest[destPos] = (char)(0x80
|
||||||
|
+ ((value >> (6 * numAdds)) & 0x3F));
|
||||||
destPos++;
|
destPos++;
|
||||||
}
|
}
|
||||||
while (numAdds != 0);
|
while (numAdds != 0);
|
||||||
|
@ -95,7 +98,8 @@ static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SRes Utf16_To_Utf8Buf(CBuf *dest, const UInt16 *src, size_t srcLen)
|
static SRes Utf16_To_Utf8Buf(CBuf *dest,
|
||||||
|
const UInt16 *src, size_t srcLen)
|
||||||
{
|
{
|
||||||
size_t destLen = 0;
|
size_t destLen = 0;
|
||||||
Bool res;
|
Bool res;
|
||||||
|
@ -158,9 +162,10 @@ static SRes ConvertUtf16toCharString(const UInt16 *s, char *outstring)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Extract the relative path relative_path from a 7z archive
|
||||||
// Extract the relative path relative_path from a 7z archive archive_path and allocate a buf for it to write it in.
|
* archive_path and allocate a buf for it to write it in. */
|
||||||
int read_7zip_file(const char * archive_path, const char *relative_path, void **buf)
|
int read_7zip_file(const char * archive_path,
|
||||||
|
const char *relative_path, void **buf)
|
||||||
{
|
{
|
||||||
CFileInStream archiveStream;
|
CFileInStream archiveStream;
|
||||||
CLookToRead lookStream;
|
CLookToRead lookStream;
|
||||||
|
@ -172,7 +177,8 @@ int read_7zip_file(const char * archive_path, const char *relative_path, void **
|
||||||
size_t tempSize = 0;
|
size_t tempSize = 0;
|
||||||
long outsize = -1;
|
long outsize = -1;
|
||||||
|
|
||||||
//These are the allocation routines - currently using the non-standard 7zip choices.
|
/*These are the allocation routines.
|
||||||
|
* Currently using the non-standard 7zip choices. */
|
||||||
allocImp.Alloc = SzAlloc;
|
allocImp.Alloc = SzAlloc;
|
||||||
allocImp.Free = SzFree;
|
allocImp.Free = SzFree;
|
||||||
allocTempImp.Alloc = SzAllocTemp;
|
allocTempImp.Alloc = SzAllocTemp;
|
||||||
|
@ -185,7 +191,8 @@ int read_7zip_file(const char * archive_path, const char *relative_path, void **
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RARCH_LOG_OUTPUT("Openend archive %s. Now trying to extract %s\n",archive_path,relative_path);
|
RARCH_LOG_OUTPUT("Openend archive %s. Now trying to extract %s\n",
|
||||||
|
archive_path,relative_path);
|
||||||
}
|
}
|
||||||
FileInStream_CreateVTable(&archiveStream);
|
FileInStream_CreateVTable(&archiveStream);
|
||||||
LookToRead_CreateVTable(&lookStream, False);
|
LookToRead_CreateVTable(&lookStream, False);
|
||||||
|
@ -209,9 +216,11 @@ int read_7zip_file(const char * archive_path, const char *relative_path, void **
|
||||||
size_t len;
|
size_t len;
|
||||||
if (f->IsDir)
|
if (f->IsDir)
|
||||||
{
|
{
|
||||||
//we skip over everything, which is not a directory.
|
/* We skip over everything which is not a directory.
|
||||||
|
* FIXME: Why continue then if f->IsDir is true?*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
|
len = SzArEx_GetFileNameUtf16(&db, i, NULL);
|
||||||
if (len > tempSize)
|
if (len > tempSize)
|
||||||
{
|
{
|
||||||
|
@ -234,16 +243,21 @@ int read_7zip_file(const char * archive_path, const char *relative_path, void **
|
||||||
|
|
||||||
if (strcmp(infile,relative_path) == 0)
|
if (strcmp(infile,relative_path) == 0)
|
||||||
{
|
{
|
||||||
res = SzArEx_Extract(&db, &lookStream.s, i,&blockIndex, &outBuffer, &outBufferSize,&offset, &outSizeProcessed,&allocImp, &allocTempImp);
|
res = SzArEx_Extract(&db, &lookStream.s, i,&blockIndex,
|
||||||
|
&outBuffer, &outBufferSize,&offset, &outSizeProcessed,
|
||||||
|
&allocImp, &allocTempImp);
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
{
|
{
|
||||||
break; //This goes to the error section.
|
break; /* This goes to the error section. */
|
||||||
}
|
}
|
||||||
outsize = outSizeProcessed;
|
outsize = outSizeProcessed;
|
||||||
*buf = outBuffer+offset;
|
*buf = outBuffer+offset;
|
||||||
|
|
||||||
//We could either use the 7Zip allocated buffer or create our own and use it.
|
/*We could either use the 7Zip allocated buffer,
|
||||||
//We would however need to realloc anyways, because RetroArch expects a \0 at the end, therefore we allocate new, copy and free the old one.
|
* or create our own and use it.
|
||||||
|
* We would however need to realloc anyways, because RetroArch
|
||||||
|
* expects a \0 at the end, therefore we allocate new,
|
||||||
|
* copy and free the old one. */
|
||||||
*buf = malloc(outsize + 1);
|
*buf = malloc(outsize + 1);
|
||||||
|
|
||||||
((char*)(*buf))[outsize] = '\0';
|
((char*)(*buf))[outsize] = '\0';
|
||||||
|
@ -301,7 +315,8 @@ struct string_list *compressed_7zip_file_list_new(const char *path,
|
||||||
|
|
||||||
(void)outsize;
|
(void)outsize;
|
||||||
|
|
||||||
//These are the allocation routines - currently using the non-standard 7zip choices.
|
/* These are the allocation routines - currently using
|
||||||
|
* the non-standard 7zip choices. */
|
||||||
allocImp.Alloc = SzAlloc;
|
allocImp.Alloc = SzAlloc;
|
||||||
allocImp.Free = SzFree;
|
allocImp.Free = SzFree;
|
||||||
allocTempImp.Alloc = SzAllocTemp;
|
allocTempImp.Alloc = SzAllocTemp;
|
||||||
|
@ -391,7 +406,7 @@ struct string_list *compressed_7zip_file_list_new(const char *path,
|
||||||
|
|
||||||
if (res != SZ_OK)
|
if (res != SZ_OK)
|
||||||
{
|
{
|
||||||
//Error handling:
|
/* Error handling */
|
||||||
if (res == SZ_ERROR_UNSUPPORTED)
|
if (res == SZ_ERROR_UNSUPPORTED)
|
||||||
{
|
{
|
||||||
RARCH_ERR("7Zip decoder doesn't support this archive\n");
|
RARCH_ERR("7Zip decoder doesn't support this archive\n");
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overlay driver acts as a medium between input drivers and video driver.
|
/* Overlay driver acts as a medium between input drivers
|
||||||
* Coordinates are fetched from input driver, and an overlay with pressable actions are
|
* and video driver.
|
||||||
* displayed on-screen.
|
|
||||||
*
|
*
|
||||||
* This interface requires that the video driver has support for the overlay interface.
|
* Coordinates are fetched from input driver, and an
|
||||||
|
* overlay with pressable actions are displayed on-screen.
|
||||||
|
*
|
||||||
|
* This interface requires that the video driver has support
|
||||||
|
* for the overlay interface.
|
||||||
*/
|
*/
|
||||||
typedef struct input_overlay input_overlay_t;
|
typedef struct input_overlay input_overlay_t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue