aboutsummaryrefslogtreecommitdiff
path: root/lib/cpluff/libcpluff
diff options
context:
space:
mode:
authortaxigps <taxigps@svn>2010-07-09 15:51:15 +0000
committertaxigps <taxigps@svn>2010-07-09 15:51:15 +0000
commit3e713414c0f052ebf6d5f7f0ab0fe47cdc40aaa3 (patch)
treea4ababc00a83b656456b6ce9326a67927588dd19 /lib/cpluff/libcpluff
parent9c2f306eeb77265f2bf08c17e462efdf3295c4b1 (diff)
reverted: r31675 (can't work properly)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31678 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'lib/cpluff/libcpluff')
-rw-r--r--lib/cpluff/libcpluff/ploader.c11
-rw-r--r--lib/cpluff/libcpluff/win32/cpluff.vcproj10
-rw-r--r--lib/cpluff/libcpluff/win32/dirent.c36
-rw-r--r--lib/cpluff/libcpluff/win32/utf8.c116
-rw-r--r--lib/cpluff/libcpluff/win32/utf8.h20
5 files changed, 13 insertions, 180 deletions
diff --git a/lib/cpluff/libcpluff/ploader.c b/lib/cpluff/libcpluff/ploader.c
index 815d31f781..6c9a741f1d 100644
--- a/lib/cpluff/libcpluff/ploader.c
+++ b/lib/cpluff/libcpluff/ploader.c
@@ -37,9 +37,6 @@
#include "defines.h"
#include "util.h"
#include "internal.h"
-#ifdef _WIN32
-#include "utf8.h"
-#endif
// Use XMLCALL if available
#ifdef XMLCALL
@@ -981,9 +978,6 @@ static void dealloc_plugin_info(cp_context_t *ctx, cp_plugin_info_t *plugin) {
CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor(cp_context_t *context, const char *path, cp_status_t *error) {
char *file = NULL;
-#ifdef _WIN32
- wchar_t *wfile;
-#endif
cp_status_t status = CP_OK;
FILE *fh = NULL;
XML_Parser parser = NULL;
@@ -1016,12 +1010,7 @@ CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor(cp_context_t *context, con
strcpy(file + path_len + 1, CP_PLUGIN_DESCRIPTOR);
// Open the file
-#ifdef _WIN32
- wfile = make_unicode_string(file);
- if ((fh = _wfopen(wfile, L"rb")) == NULL) {
-#else
if ((fh = fopen(file, "rb")) == NULL) {
-#endif
status = CP_ERR_IO;
break;
}
diff --git a/lib/cpluff/libcpluff/win32/cpluff.vcproj b/lib/cpluff/libcpluff/win32/cpluff.vcproj
index 37d3be5e8e..cd8947f29f 100644
--- a/lib/cpluff/libcpluff/win32/cpluff.vcproj
+++ b/lib/cpluff/libcpluff/win32/cpluff.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="cpluff"
ProjectGUID="{88968763-3D6B-48A8-B495-CC8C187FAC02}"
RootNamespace="cpluff"
@@ -234,10 +234,6 @@
>
</File>
<File
- RelativePath=".\utf8.c"
- >
- </File>
- <File
RelativePath="..\util.c"
>
</File>
@@ -280,10 +276,6 @@
>
</File>
<File
- RelativePath=".\utf8.h"
- >
- </File>
- <File
RelativePath="..\util.h"
>
</File>
diff --git a/lib/cpluff/libcpluff/win32/dirent.c b/lib/cpluff/libcpluff/win32/dirent.c
index 9111e38dcc..db72f39d37 100644
--- a/lib/cpluff/libcpluff/win32/dirent.c
+++ b/lib/cpluff/libcpluff/win32/dirent.c
@@ -13,7 +13,6 @@
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
#include <stdlib.h>
#include <string.h>
-#include "utf8.h"
#ifdef __cplusplus
extern "C"
@@ -23,9 +22,9 @@ extern "C"
struct DIR
{
long handle; /* -1 for failed rewind */
- struct _wfinddata_t info;
+ struct _finddata_t info;
struct dirent result; /* d_name null iff first time */
- wchar_t *name; /* null-terminated char string */
+ char *name; /* null-terminated char string */
};
DIR *opendir(const char *name)
@@ -34,17 +33,16 @@ DIR *opendir(const char *name)
if(name && name[0])
{
- wchar_t *wname = make_unicode_string(name);
- size_t base_length = wcslen(wname);
- const wchar_t *all = /* search pattern must end with suitable wildcard */
- wcschr(L"/\\", wname[base_length - 1]) ? L"*" : L"/*";
+ size_t base_length = strlen(name);
+ const char *all = /* search pattern must end with suitable wildcard */
+ strchr("/\\", name[base_length - 1]) ? "*" : "/*";
if((dir = (DIR *) malloc(sizeof *dir)) != 0 &&
- (dir->name = (wchar_t *) calloc(base_length + wcslen(all) + 1, sizeof(wchar_t))) != 0)
+ (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0)
{
- wcscat(wcscpy(dir->name, wname), all);
+ strcat(strcpy(dir->name, name), all);
- if((dir->handle = (long) _wfindfirst(dir->name, &dir->info)) != -1)
+ if((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1)
{
dir->result.d_name = 0;
}
@@ -61,7 +59,6 @@ DIR *opendir(const char *name)
dir = 0;
errno = ENOMEM;
}
- free(wname);
}
else
{
@@ -82,11 +79,6 @@ int closedir(DIR *dir)
result = _findclose(dir->handle);
}
- if(dir->result.d_name)
- {
- free(dir->result.d_name);
- dir->result.d_name = 0;
- }
free(dir->name);
free(dir);
}
@@ -105,10 +97,10 @@ struct dirent *readdir(DIR *dir)
if(dir && dir->handle != -1)
{
- if(!dir->result.d_name || _wfindnext(dir->handle, &dir->info) != -1)
+ if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
{
result = &dir->result;
- result->d_name = make_utf8_string(dir->info.name);
+ result->d_name = dir->info.name;
}
}
else
@@ -124,12 +116,8 @@ void rewinddir(DIR *dir)
if(dir && dir->handle != -1)
{
_findclose(dir->handle);
- dir->handle = (long) _wfindfirst(dir->name, &dir->info);
- if(dir->result.d_name)
- {
- free(dir->result.d_name);
- dir->result.d_name = 0;
- }
+ dir->handle = (long) _findfirst(dir->name, &dir->info);
+ dir->result.d_name = 0;
}
else
{
diff --git a/lib/cpluff/libcpluff/win32/utf8.c b/lib/cpluff/libcpluff/win32/utf8.c
deleted file mode 100644
index 61630bd269..0000000000
--- a/lib/cpluff/libcpluff/win32/utf8.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2001 Peter Harris <peter.harris@hummingbird.com>
- * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * Convert a string between UTF-8 and unicode.
- */
-
-#include <stdlib.h>
-
-unsigned char *make_utf8_string(const wchar_t *unicode)
-{
- int size = 0, index = 0, out_index = 0;
- unsigned char *out;
- unsigned short c;
-
- /* first calculate the size of the target string */
- c = unicode[index++];
- while(c) {
- if(c < 0x0080) {
- size += 1;
- } else if(c < 0x0800) {
- size += 2;
- } else {
- size += 3;
- }
- c = unicode[index++];
- }
-
- out = malloc(size + 1);
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = unicode[index++];
- while(c)
- {
- if(c < 0x080) {
- out[out_index++] = (unsigned char)c;
- } else if(c < 0x800) {
- out[out_index++] = 0xc0 | (c >> 6);
- out[out_index++] = 0x80 | (c & 0x3f);
- } else {
- out[out_index++] = 0xe0 | (c >> 12);
- out[out_index++] = 0x80 | ((c >> 6) & 0x3f);
- out[out_index++] = 0x80 | (c & 0x3f);
- }
- c = unicode[index++];
- }
- out[out_index] = 0x00;
-
- return out;
-}
-
-wchar_t *make_unicode_string(const unsigned char *utf8)
-{
- int size = 0, index = 0, out_index = 0;
- wchar_t *out;
- unsigned char c;
-
- /* first calculate the size of the target string */
- c = utf8[index++];
- while(c) {
- if((c & 0x80) == 0) {
- index += 0;
- } else if((c & 0xe0) == 0xe0) {
- index += 2;
- } else {
- index += 1;
- }
- size += 1;
- c = utf8[index++];
- }
-
- out = malloc((size + 1) * sizeof(wchar_t));
- if (out == NULL)
- return NULL;
- index = 0;
-
- c = utf8[index++];
- while(c)
- {
- if((c & 0x80) == 0) {
- out[out_index++] = c;
- } else if((c & 0xe0) == 0xe0) {
- out[out_index] = (c & 0x1F) << 12;
- c = utf8[index++];
- out[out_index] |= (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- } else {
- out[out_index] = (c & 0x3F) << 6;
- c = utf8[index++];
- out[out_index++] |= (c & 0x3F);
- }
- c = utf8[index++];
- }
- out[out_index] = 0;
-
- return out;
-}
diff --git a/lib/cpluff/libcpluff/win32/utf8.h b/lib/cpluff/libcpluff/win32/utf8.h
deleted file mode 100644
index 37edbefd75..0000000000
--- a/lib/cpluff/libcpluff/win32/utf8.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Convert a string between UTF-8 and unicode.
- */
-
-#ifndef __UTF8_H
-#define __UTF8_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-unsigned char *make_utf8_string(const wchar_t *unicode);
-wchar_t *make_unicode_string(const unsigned char *utf8);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __UTF8_H */