From 10827bf2df1c7b56416d32b70ba576c5394a7ad6 Mon Sep 17 00:00:00 2001 From: Fatbag Date: Mon, 4 Jun 2012 22:27:28 -0500 Subject: [PATCH] Added libpq to the Libraries folder. Finally, I have been waiting for this day. libpq is seriously unready out of the box; you have to edit 3 header files to get it to work outside the PostgreSQL build environment. Also, in iff2html, the directory name no longer appears as part of the IFF's file name on the web page. --- Libraries/CMakeLists.txt | 1 + Libraries/FileHandler/iff/spr.c | 6 ++---- Libraries/FileHandler/iff/spr2.c | 0 Tools/iff2html/iff2html.c | 19 ++++++++++++------- 4 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 Libraries/FileHandler/iff/spr2.c diff --git a/Libraries/CMakeLists.txt b/Libraries/CMakeLists.txt index 30bdcc5..4979e0a 100644 --- a/Libraries/CMakeLists.txt +++ b/Libraries/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(FileHandler) add_subdirectory(freetype) +add_subdirectory(libpq) add_subdirectory(libvitaboy) \ No newline at end of file diff --git a/Libraries/FileHandler/iff/spr.c b/Libraries/FileHandler/iff/spr.c index 0fbe940..b39bf80 100644 --- a/Libraries/FileHandler/iff/spr.c +++ b/Libraries/FileHandler/iff/spr.c @@ -146,8 +146,8 @@ int iff_parse_spr(IFFChunk * ChunkInfo, const uint8_t * Buffer){ Count = *(b.Buffer++); SpriteSize -= 2; - if(Command == 0){ - /* Do nothing */ + if(Command == 0 || Command == 16){ + /* Start marker */ }else if(Command == 4){ /* Pixel command: valid commands are 1, 2, and 3 */ unsigned pixel = 0; @@ -208,8 +208,6 @@ int iff_parse_spr(IFFChunk * ChunkInfo, const uint8_t * Buffer){ if(Count > Sprite->Height - row) {printf("Error %u\n", 9);return 0;} row += Count; - }else if(Command == 16){ - /* Do nothing */ }else {printf("Error %u\n", 10);return 0;} } } diff --git a/Libraries/FileHandler/iff/spr2.c b/Libraries/FileHandler/iff/spr2.c new file mode 100644 index 0000000..e69de29 diff --git a/Tools/iff2html/iff2html.c b/Tools/iff2html/iff2html.c index 421a05f..a9f2eef 100644 --- a/Tools/iff2html/iff2html.c +++ b/Tools/iff2html/iff2html.c @@ -50,10 +50,11 @@ static void printsize(FILE * hFile, size_t FileSize){ } int main(int argc, char *argv[]){ - unsigned c, slash; + unsigned c; + int slash; FILE * hFile; int overwrite = 0; - char *InFile, *OutFile = NULL, *OutDir = NULL; + char *InFile, *OutFile = NULL, *FileName, *OutDir = NULL; size_t FileSize; struct MD5Context md5c; unsigned char digest[16]; @@ -93,14 +94,18 @@ int main(int argc, char *argv[]){ strcpy(max(OutFile+length-4, OutFile), ".html"); } - for(c=0, slash=0; OutFile[c]; c++) + for(c=0, slash=-1; OutFile[c]; c++) if(OutFile[c] == '/' || OutFile[c] == '\\') slash = c; - if(slash != 0){ + if(slash >= 0){ OutDir = malloc(slash+2); memcpy(OutDir, OutFile, slash+1); OutDir[slash+1] = 0x00; }else OutDir = ""; + for(c=0, slash=-1; InFile[c]; c++) + if(InFile[c] == '/' || InFile[c] == '\\') slash = c; + FileName = InFile + slash + 1; + /**** ** Open the file and read in entire contents to memory */ @@ -195,9 +200,9 @@ int main(int argc, char *argv[]){ fprintf(hFile, "\n"); fprintf(hFile, "\n"); fprintf(hFile, "\n"); - fprintf(hFile, "\n", InFile); + fprintf(hFile, "\n", FileName); fprintf(hFile, "\n"); - fprintf(hFile, "%s (iff2html)\n", InFile); + fprintf(hFile, "%s (iff2html)\n", FileName); fprintf(hFile, "\n"); fprintf(hFile, "\n"); fprintf(hFile, "\n"); - fprintf(hFile, "

%s

\n", InFile); + fprintf(hFile, "

%s

\n", FileName); fprintf(hFile, "
\n"); fprintf(hFile, "
"); for(c=0; c<16; c++)