linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06030
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3047: Fix GeoIP problems with wide character paths
------------------------------------------------------------
revno: 3047
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2012-09-13 21:36:06 +0200
message:
Fix GeoIP problems with wide character paths
modified:
changelog.txt
dcpp/GeoIP.cpp
geoip/GeoIP.c
geoip/GeoIP.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2012-09-13 17:19:06 +0000
+++ changelog.txt 2012-09-13 19:36:06 +0000
@@ -39,7 +39,7 @@
* Fix NAT-PMP renewal (poy)
* [L#226968] Remember list sorting & splitter positions (poy)
* [L#1041553] Fix help tooltips in Windows 8 (poy)
-* Fix GeoIP decompression with wide character paths (poy)
+* Fix GeoIP problems with wide character paths (poy)
-- 0.799 2012-05-05 --
* Add icons (iceman50)
=== modified file 'dcpp/GeoIP.cpp'
--- dcpp/GeoIP.cpp 2012-06-18 15:56:01 +0000
+++ dcpp/GeoIP.cpp 2012-09-13 19:36:06 +0000
@@ -130,7 +130,7 @@
}
void GeoIP::open() {
- geo = GeoIP_open(path.c_str(), GEOIP_STANDARD);
+ geo = GeoIP_open(Text::toT(path).c_str(), GEOIP_STANDARD);
if(geo) {
GeoIP_set_charset(geo, GEOIP_CHARSET_UTF8);
}
=== modified file 'geoip/GeoIP.c'
--- geoip/GeoIP.c 2011-10-06 18:58:07 +0000
+++ geoip/GeoIP.c 2012-09-13 19:36:06 +0000
@@ -937,7 +937,11 @@
return gi;
}
+#ifdef _WIN32
+GeoIP* GeoIP_open (const wchar_t * filename, int flags) {
+#else
GeoIP* GeoIP_open (const char * filename, int flags) {
+#endif
struct stat buf;
GeoIP * gi;
size_t len;
@@ -945,6 +949,10 @@
gi = (GeoIP *)malloc(sizeof(GeoIP));
if (gi == NULL)
return NULL;
+#ifdef _WIN32
+ gi->GeoIPDatabase = _wfopen(filename,L"rb");
+ gi->file_path = malloc(0);
+#else
len = sizeof(char) * (strlen(filename)+1);
gi->file_path = malloc(len);
if (gi->file_path == NULL) {
@@ -953,6 +961,7 @@
}
strncpy(gi->file_path, filename, len);
gi->GeoIPDatabase = fopen(filename,"rb");
+#endif
if (gi->GeoIPDatabase == NULL) {
fprintf(stderr,"Error Opening file %s\n",filename);
free(gi->file_path);
=== modified file 'geoip/GeoIP.h'
--- geoip/GeoIP.h 2011-10-06 18:58:07 +0000
+++ geoip/GeoIP.h 2012-09-13 19:36:06 +0000
@@ -158,7 +158,11 @@
GEOIP_API void GeoIP_setup_custom_directory(char *dir);
GEOIP_API GeoIP* GeoIP_open_type (int type, int flags);
GEOIP_API GeoIP* GeoIP_new(int flags);
+#ifdef _WIN32
+GEOIP_API GeoIP* GeoIP_open(const wchar_t * filename, int flags);
+#else
GEOIP_API GeoIP* GeoIP_open(const char * filename, int flags);
+#endif
GEOIP_API int GeoIP_db_avail(int type);
GEOIP_API void GeoIP_delete(GeoIP* gi);
GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);