Merged 1018:23aee7da04e0 from default branch: fixed C++-style comments.
This commit is contained in:
parent
57a04afef5
commit
0310835418
|
@ -108,7 +108,7 @@ static void SzFreePhysicsFS(void *address)
|
||||||
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
|
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
|
||||||
size_t *processedSize)
|
size_t *processedSize)
|
||||||
{
|
{
|
||||||
FileInputStream *s = (FileInputStream *)(object - offsetof(FileInputStream, inStream)); // HACK!
|
FileInputStream *s = (FileInputStream *)(object - offsetof(FileInputStream, inStream)); /* HACK! */
|
||||||
PHYSFS_sint64 processedSizeLoc = 0;
|
PHYSFS_sint64 processedSizeLoc = 0;
|
||||||
|
|
||||||
if (maxReqSize > BUFFER_SIZE)
|
if (maxReqSize > BUFFER_SIZE)
|
||||||
|
@ -130,7 +130,7 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
|
||||||
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
|
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
|
||||||
size_t *processedSize)
|
size_t *processedSize)
|
||||||
{
|
{
|
||||||
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); // HACK!
|
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
|
||||||
size_t processedSizeLoc = __PHYSFS_platformRead(s->file, buffer, 1, size);
|
size_t processedSizeLoc = __PHYSFS_platformRead(s->file, buffer, 1, size);
|
||||||
if (processedSize != 0)
|
if (processedSize != 0)
|
||||||
*processedSize = processedSizeLoc;
|
*processedSize = processedSizeLoc;
|
||||||
|
@ -145,7 +145,7 @@ SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
|
||||||
*/
|
*/
|
||||||
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
|
||||||
{
|
{
|
||||||
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); // HACK!
|
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
|
||||||
if (__PHYSFS_platformSeek(s->file, (PHYSFS_uint64) pos))
|
if (__PHYSFS_platformSeek(s->file, (PHYSFS_uint64) pos))
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
return SZE_FAIL;
|
return SZE_FAIL;
|
||||||
|
@ -209,7 +209,7 @@ static void lzma_file_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
|
||||||
*/
|
*/
|
||||||
static LZMAfile * lzma_find_file(LZMAarchive *archive, const char *name)
|
static LZMAfile * lzma_find_file(LZMAarchive *archive, const char *name)
|
||||||
{
|
{
|
||||||
LZMAfile *file = bsearch(name, archive->files, archive->db.Database.NumFiles, sizeof(*archive->files), lzma_file_cmp_stdlib); // FIXME: Should become __PHYSFS_search!!!
|
LZMAfile *file = bsearch(name, archive->files, archive->db.Database.NumFiles, sizeof(*archive->files), lzma_file_cmp_stdlib); /* FIXME: Should become __PHYSFS_search!!! */
|
||||||
|
|
||||||
BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, NULL);
|
BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, NULL);
|
||||||
|
|
||||||
|
@ -225,10 +225,10 @@ static int lzma_file_init(LZMAarchive *archive, PHYSFS_uint32 fileIndex)
|
||||||
LZMAfile *file = &archive->files[fileIndex];
|
LZMAfile *file = &archive->files[fileIndex];
|
||||||
PHYSFS_uint32 folderIndex = archive->db.FileIndexToFolderIndexMap[fileIndex];
|
PHYSFS_uint32 folderIndex = archive->db.FileIndexToFolderIndexMap[fileIndex];
|
||||||
|
|
||||||
file->index = fileIndex; // Store index into 7z array, since we sort our own.
|
file->index = fileIndex; /* Store index into 7z array, since we sort our own. */
|
||||||
file->archive = archive;
|
file->archive = archive;
|
||||||
file->folder = (folderIndex != (PHYSFS_uint32)-1 ? &archive->folders[folderIndex] : NULL); // Directories don't have a folder (they contain no own data...)
|
file->folder = (folderIndex != (PHYSFS_uint32)-1 ? &archive->folders[folderIndex] : NULL); /* Directories don't have a folder (they contain no own data...) */
|
||||||
file->item = &archive->db.Database.Files[fileIndex]; // Holds crucial data and is often referenced -> Store link
|
file->item = &archive->db.Database.Files[fileIndex]; /* Holds crucial data and is often referenced -> Store link */
|
||||||
file->position = 0;
|
file->position = 0;
|
||||||
file->offset = 0; /* Offset will be set by LZMA_read() */
|
file->offset = 0; /* Offset will be set by LZMA_read() */
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ static int lzma_files_init(LZMAarchive *archive)
|
||||||
{
|
{
|
||||||
if (!lzma_file_init(archive, fileIndex))
|
if (!lzma_file_init(archive, fileIndex))
|
||||||
{
|
{
|
||||||
return(0); // FALSE on failure
|
return(0); /* FALSE on failure */
|
||||||
}
|
}
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ static int LZMA_isArchive(const char *filename, int forWriting)
|
||||||
/* Read signature bytes */
|
/* Read signature bytes */
|
||||||
if (__PHYSFS_platformRead(in, sig, k7zSignatureSize, 1) != 1)
|
if (__PHYSFS_platformRead(in, sig, k7zSignatureSize, 1) != 1)
|
||||||
{
|
{
|
||||||
__PHYSFS_platformClose(in); // Don't forget to close the file before returning...
|
__PHYSFS_platformClose(in); /* Don't forget to close the file before returning... */
|
||||||
BAIL_MACRO(NULL, 0);
|
BAIL_MACRO(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ static void *LZMA_openArchive(const char *name, int forWriting)
|
||||||
{
|
{
|
||||||
__PHYSFS_platformClose(archive->stream.file);
|
__PHYSFS_platformClose(archive->stream.file);
|
||||||
lzma_archive_exit(archive);
|
lzma_archive_exit(archive);
|
||||||
return(NULL); // Error is set by platformOpenRead!
|
return(NULL); /* Error is set by platformOpenRead! */
|
||||||
}
|
}
|
||||||
|
|
||||||
CrcGenerateTable();
|
CrcGenerateTable();
|
||||||
|
@ -491,7 +491,7 @@ static void *LZMA_openArchive(const char *name, int forWriting)
|
||||||
SzArDbExFree(&archive->db, SzFreePhysicsFS);
|
SzArDbExFree(&archive->db, SzFreePhysicsFS);
|
||||||
__PHYSFS_platformClose(archive->stream.file);
|
__PHYSFS_platformClose(archive->stream.file);
|
||||||
lzma_archive_exit(archive);
|
lzma_archive_exit(archive);
|
||||||
return NULL; // Error is set by lzma_err!
|
return NULL; /* Error is set by lzma_err! */
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
len = archive->db.Database.NumFiles * sizeof (LZMAfile);
|
len = archive->db.Database.NumFiles * sizeof (LZMAfile);
|
||||||
|
@ -568,7 +568,7 @@ static void LZMA_enumerateFiles(dvoid *opaque, const char *dname,
|
||||||
if (dlen)
|
if (dlen)
|
||||||
{
|
{
|
||||||
file = lzma_find_file(archive, dname);
|
file = lzma_find_file(archive, dname);
|
||||||
if (file != NULL) // if 'file' is NULL it should stay so, otherwise errors will not be handled
|
if (file != NULL) /* if 'file' is NULL it should stay so, otherwise errors will not be handled */
|
||||||
file += 1;
|
file += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -617,7 +617,7 @@ static PHYSFS_sint64 LZMA_getLastModTime(dvoid *opaque,
|
||||||
*fileExists = (file != NULL);
|
*fileExists = (file != NULL);
|
||||||
|
|
||||||
BAIL_IF_MACRO(file == NULL, NULL, -1);
|
BAIL_IF_MACRO(file == NULL, NULL, -1);
|
||||||
BAIL_IF_MACRO(!file->item->IsLastWriteTimeDefined, NULL, -1); // write-time may not be defined for every file
|
BAIL_IF_MACRO(!file->item->IsLastWriteTimeDefined, NULL, -1); /* write-time may not be defined for every file */
|
||||||
|
|
||||||
return(lzma_filetime_to_unix_timestamp(&file->item->LastWriteTime));
|
return(lzma_filetime_to_unix_timestamp(&file->item->LastWriteTime));
|
||||||
} /* LZMA_getLastModTime */
|
} /* LZMA_getLastModTime */
|
||||||
|
@ -650,7 +650,7 @@ static fvoid *LZMA_openRead(dvoid *opaque, const char *name, int *fileExists)
|
||||||
BAIL_IF_MACRO(file->folder == NULL, ERR_NOT_A_FILE, NULL);
|
BAIL_IF_MACRO(file->folder == NULL, ERR_NOT_A_FILE, NULL);
|
||||||
|
|
||||||
file->position = 0;
|
file->position = 0;
|
||||||
file->folder->references++; // Increase refcount for automatic cleanup...
|
file->folder->references++; /* Increase refcount for automatic cleanup... */
|
||||||
|
|
||||||
return(file);
|
return(file);
|
||||||
} /* LZMA_openRead */
|
} /* LZMA_openRead */
|
||||||
|
|
|
@ -156,14 +156,14 @@ static void serve_http_request(int sock, struct sockaddr *addr,
|
||||||
{
|
{
|
||||||
printf("out of memory.\n");
|
printf("out of memory.\n");
|
||||||
return;
|
return;
|
||||||
} // if
|
} /* if */
|
||||||
args->addr = (struct sockaddr *) malloc(addrlen);
|
args->addr = (struct sockaddr *) malloc(addrlen);
|
||||||
if (args->addr == NULL)
|
if (args->addr == NULL)
|
||||||
{
|
{
|
||||||
free(args);
|
free(args);
|
||||||
printf("out of memory.\n");
|
printf("out of memory.\n");
|
||||||
return;
|
return;
|
||||||
} // if
|
} /* if */
|
||||||
|
|
||||||
args->sock = sock;
|
args->sock = sock;
|
||||||
args->addrlen = addrlen;
|
args->addrlen = addrlen;
|
||||||
|
|
Loading…
Reference in New Issue