diff options
author | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-08 16:43:27 +0000 |
---|---|---|
committer | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-08 16:43:27 +0000 |
commit | d2fec012063ade5737c7075758574137e4d18410 (patch) | |
tree | c146eeb0aa3306931c044a569d5905698d91fef4 /o3d/import | |
parent | d1d12f3e73ab60a2bea0ad380cc227dbd165c3a6 (diff) | |
download | chromium_src-d2fec012063ade5737c7075758574137e4d18410.zip chromium_src-d2fec012063ade5737c7075758574137e4d18410.tar.gz chromium_src-d2fec012063ade5737c7075758574137e4d18410.tar.bz2 |
This fixes a bunch of warnings that are in our code, in order for the GYP build to succeed.
Review URL: http://codereview.chromium.org/118346
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/import')
-rw-r--r-- | o3d/import/cross/archive_processor.cc | 2 | ||||
-rw-r--r-- | o3d/import/cross/archive_processor.h | 2 | ||||
-rw-r--r-- | o3d/import/cross/archive_request.cc | 37 | ||||
-rw-r--r-- | o3d/import/cross/archive_request.h | 2 | ||||
-rw-r--r-- | o3d/import/cross/collada.cc | 4 | ||||
-rw-r--r-- | o3d/import/cross/collada_conditioner.cc | 2 | ||||
-rw-r--r-- | o3d/import/cross/collada_zip_archive.cc | 2 | ||||
-rw-r--r-- | o3d/import/cross/gz_compressor.cc | 4 | ||||
-rw-r--r-- | o3d/import/cross/gz_compressor.h | 2 | ||||
-rw-r--r-- | o3d/import/cross/gz_decompressor.cc | 2 | ||||
-rw-r--r-- | o3d/import/cross/gz_decompressor.h | 2 | ||||
-rw-r--r-- | o3d/import/cross/raw_data.cc | 7 | ||||
-rw-r--r-- | o3d/import/cross/tar_generator.cc | 22 | ||||
-rw-r--r-- | o3d/import/cross/tar_processor_test.cc | 4 | ||||
-rw-r--r-- | o3d/import/cross/targz_processor.h | 3 | ||||
-rw-r--r-- | o3d/import/cross/targz_processor_test.cc | 5 | ||||
-rw-r--r-- | o3d/import/cross/zip_archive.cc | 59 | ||||
-rw-r--r-- | o3d/import/cross/zip_archive.h | 9 | ||||
-rw-r--r-- | o3d/import/win/collada_conditioner_win.cc | 2 |
19 files changed, 111 insertions, 61 deletions
diff --git a/o3d/import/cross/archive_processor.cc b/o3d/import/cross/archive_processor.cc index f02ef6d..b3abd87 100644 --- a/o3d/import/cross/archive_processor.cc +++ b/o3d/import/cross/archive_processor.cc @@ -38,7 +38,7 @@ #include "base/logging.h" #include "import/cross/memory_buffer.h" -#include "third_party/zlib/files/zlib.h" +#include "zlib.h" const int kChunkSize = 16384; diff --git a/o3d/import/cross/archive_processor.h b/o3d/import/cross/archive_processor.h index 9bc5368..8380c37 100644 --- a/o3d/import/cross/archive_processor.h +++ b/o3d/import/cross/archive_processor.h @@ -62,7 +62,7 @@ class ArchiveCallbackClient { public: virtual ~ArchiveCallbackClient() {} virtual void ReceiveFileHeader(const ArchiveFileInfo &file_info) = 0; - virtual bool ReceiveFileData(MemoryReadStream *stream, int nbytes) = 0; + virtual bool ReceiveFileData(MemoryReadStream *stream, size_t nbytes) = 0; }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/o3d/import/cross/archive_request.cc b/o3d/import/cross/archive_request.cc index 4ced695..fd75413 100644 --- a/o3d/import/cross/archive_request.cc +++ b/o3d/import/cross/archive_request.cc @@ -1,8 +1,33 @@ -// @@REWRITE(insert c-copyright) -// @@REWRITE(delete-start) -// Copyright 2009 Google Inc. All Rights Reserved. -// Author: crogers@google.com (Chris Rogers) -// @@REWRITE(delete-end) +/* + * Copyright 2009, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ // This file contains the definition of the ArchiveRequest class. @@ -142,7 +167,7 @@ void ArchiveRequest::ReceiveFileHeader(const ArchiveFileInfo &file_info) { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bool ArchiveRequest::ReceiveFileData(MemoryReadStream *input_stream, - int nbytes) { + size_t nbytes) { assert(input_stream->GetRemainingByteCount() >= nbytes); assert(file_memory_stream_.GetRemainingByteCount() >= nbytes); diff --git a/o3d/import/cross/archive_request.h b/o3d/import/cross/archive_request.h index 2a29bde..0a73864 100644 --- a/o3d/import/cross/archive_request.h +++ b/o3d/import/cross/archive_request.h @@ -103,7 +103,7 @@ class ArchiveRequest : public ObjectBase, public ArchiveCallbackClient { // ArchiveCallbackClient methods virtual void ReceiveFileHeader(const ArchiveFileInfo &file_info); - virtual bool ReceiveFileData(MemoryReadStream *stream, int nbytes); + virtual bool ReceiveFileData(MemoryReadStream *stream, size_t nbytes); Pack *pack() { return pack_.Get(); // Set at creation time and never changed. diff --git a/o3d/import/cross/collada.cc b/o3d/import/cross/collada.cc index a9cc2e1..b62ae8f 100644 --- a/o3d/import/cross/collada.cc +++ b/o3d/import/cross/collada.cc @@ -344,7 +344,7 @@ bool Collada::ImportDAEDocument(FCDocument* doc, // TODO: Add option to skip this step if user just wants what's // actually used by models. The rest of the code already deals with this. FCDImageLibrary* image_library = doc->GetImageLibrary(); - for (int i = 0; i < image_library->GetEntityCount(); i++) { + for (uint32 i = 0; i < image_library->GetEntityCount(); i++) { FCDEntity* entity = image_library->GetEntity(i); LOG_ASSERT(entity); LOG_ASSERT(entity->GetType() == FCDEntity::IMAGE); @@ -358,7 +358,7 @@ bool Collada::ImportDAEDocument(FCDocument* doc, // TODO: Add option to skip this step if user just wants what's // actually used by models. The rest of the code already deals with this. FCDMaterialLibrary* material_library = doc->GetMaterialLibrary(); - for (int i = 0; i < material_library->GetEntityCount(); i++) { + for (uint32 i = 0; i < material_library->GetEntityCount(); i++) { FCDEntity* entity = material_library->GetEntity(i); LOG_ASSERT(entity); LOG_ASSERT(entity->GetType() == FCDEntity::MATERIAL); diff --git a/o3d/import/cross/collada_conditioner.cc b/o3d/import/cross/collada_conditioner.cc index 484865f..8ba9661 100644 --- a/o3d/import/cross/collada_conditioner.cc +++ b/o3d/import/cross/collada_conditioner.cc @@ -330,7 +330,7 @@ bool ColladaConditioner::HandleNVImport(FCDocument* doc, // For each material which uses this effect, FCDMaterialLibrary* lib = doc->GetMaterialLibrary(); - for (int i = 0; i < lib->GetEntityCount(); ++i) { + for (size_t i = 0; i < lib->GetEntityCount(); ++i) { FCDMaterial* material = lib->GetEntity(i); LOG_ASSERT(material != 0); if (material->GetEffect() == collada_effect) { diff --git a/o3d/import/cross/collada_zip_archive.cc b/o3d/import/cross/collada_zip_archive.cc index 45bc523..f150a4c 100644 --- a/o3d/import/cross/collada_zip_archive.cc +++ b/o3d/import/cross/collada_zip_archive.cc @@ -52,7 +52,7 @@ ColladaZipArchive::ColladaZipArchive(const std::string &zip_filename, GetInformationList(&infolist); bool dae_found = false; - for (int i = 0; i < infolist.size(); ++i) { + for (vector<ZipFileInfo>::size_type i = 0; i < infolist.size(); ++i) { const char *name = infolist[i].name.c_str(); int length = strlen(name); diff --git a/o3d/import/cross/gz_compressor.cc b/o3d/import/cross/gz_compressor.cc index 2352405..6c853e1 100644 --- a/o3d/import/cross/gz_compressor.cc +++ b/o3d/import/cross/gz_compressor.cc @@ -39,7 +39,7 @@ #include <assert.h> #include "import/cross/memory_buffer.h" #include "import/cross/memory_stream.h" -#include "third_party/zlib/files/zutil.h" +#include "zutil.h" const size_t kChunkSize = 16384; @@ -104,7 +104,7 @@ int GzCompressor::CompressBytes(MemoryReadStream *stream, int result = Z_OK; // Don't try to read more than our stream has - int remaining = stream->GetRemainingByteCount(); + size_t remaining = stream->GetRemainingByteCount(); if (bytes_to_process > remaining) { return Z_STREAM_ERROR; } diff --git a/o3d/import/cross/gz_compressor.h b/o3d/import/cross/gz_compressor.h index 7c88657..bdf13a1 100644 --- a/o3d/import/cross/gz_compressor.h +++ b/o3d/import/cross/gz_compressor.h @@ -38,7 +38,7 @@ #define O3D_IMPORT_CROSS_GZ_COMPRESSOR_H_ #include "base/basictypes.h" -#include "third_party/zlib/files/zlib.h" +#include "zlib.h" #include "import/cross/memory_stream.h" namespace o3d { diff --git a/o3d/import/cross/gz_decompressor.cc b/o3d/import/cross/gz_decompressor.cc index 333a999..7fa7fee 100644 --- a/o3d/import/cross/gz_decompressor.cc +++ b/o3d/import/cross/gz_decompressor.cc @@ -74,7 +74,7 @@ int GzDecompressor::ProcessBytes(MemoryReadStream *stream, size_t have; // Don't try to read more than our stream has - int remaining = stream->GetRemainingByteCount(); + size_t remaining = stream->GetRemainingByteCount(); if (bytes_to_process > remaining) { return Z_STREAM_ERROR; // could have our own error code, but good enough... } diff --git a/o3d/import/cross/gz_decompressor.h b/o3d/import/cross/gz_decompressor.h index 833a7b3..bd56687 100644 --- a/o3d/import/cross/gz_decompressor.h +++ b/o3d/import/cross/gz_decompressor.h @@ -38,7 +38,7 @@ #define O3D_IMPORT_CROSS_GZ_DECOMPRESSOR_H_ #include "base/basictypes.h" -#include "third_party/zlib/files/zlib.h" +#include "zlib.h" #include "import/cross/memory_stream.h" namespace o3d { diff --git a/o3d/import/cross/raw_data.cc b/o3d/import/cross/raw_data.cc index 067ff70..53039c2 100644 --- a/o3d/import/cross/raw_data.cc +++ b/o3d/import/cross/raw_data.cc @@ -145,7 +145,7 @@ const char* GetValidUTF8(const RawData& data, size_t* utf8_length) { // It's a multi-byte character if (c >= 0xC2 && c <= 0xF4) { uint32 codepoint; - int remaining_code_length = 0; + size_t remaining_code_length = 0; if ((c & 0xE0) == 0xC0) { codepoint = c & 0x1F; remaining_code_length = 1; @@ -161,7 +161,7 @@ const char* GetValidUTF8(const RawData& data, size_t* utf8_length) { return NULL; } length -= remaining_code_length; - for (int cc = 0; cc < remaining_code_length; ++cc) { + for (size_t cc = 0; cc < remaining_code_length; ++cc) { c = *s++; if ((c & 0xC0) != 0x80) { // Not valid UTF-8 @@ -268,6 +268,9 @@ static String GetUUIDString() { // and format into a wide-string char guid_string[37]; +#if defined(OS_WIN) +#define snprintf _snprintf +#endif snprintf( guid_string, sizeof(guid_string) / sizeof(guid_string[0]), "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", diff --git a/o3d/import/cross/tar_generator.cc b/o3d/import/cross/tar_generator.cc index 019ec0e..f59306d 100644 --- a/o3d/import/cross/tar_generator.cc +++ b/o3d/import/cross/tar_generator.cc @@ -35,6 +35,10 @@ using std::string; +#if defined(OS_WIN) + #define snprintf _snprintf +#endif + namespace o3d { const int kMaxFilenameSize = 100; @@ -94,24 +98,24 @@ void TarGenerator::AddEntry(const String &file_name, strncpy(p, file_name.c_str(), kMaxFilenameSize - 1); // File mode - snprintf(p + kFileModeOffset, 8, "%07o", is_directory ? 0755 : 0644); + ::snprintf(p + kFileModeOffset, 8, "%07o", is_directory ? 0755 : 0644); // UserID - snprintf(p + kUserIDOffset, 8, "%07o", 0765); + ::snprintf(p + kUserIDOffset, 8, "%07o", 0765); // GroupID - snprintf(p + kGroupIDOffset, 8, "%07o", 0204); + ::snprintf(p + kGroupIDOffset, 8, "%07o", 0204); // File size - snprintf(p + kFileSizeOffset, 12, "%011o", file_size); + ::snprintf(p + kFileSizeOffset, 12, "%011o", file_size); // Modification time // TODO: write the correct current time here... - snprintf(p + kModifyTimeOffset, 12, "%07o", 011131753141); + ::snprintf(p + kModifyTimeOffset, 12, "%07o", 011131753141); // Initialize Header checksum so check sum can be computed // by ComputeCheckSum() which will fill in the value here - memset(p + kHeaderCheckSumOffset, 32, 8); + ::memset(p + kHeaderCheckSumOffset, 32, 8); // We only support ordinary files and directories, which is fine // for our use case @@ -119,13 +123,13 @@ void TarGenerator::AddEntry(const String &file_name, p[kLinkFlagOffset] = link_flag; // Magic offset - snprintf(p + kMagicOffset, 8, "ustar "); + ::snprintf(p + kMagicOffset, 8, "ustar "); // User name - snprintf(p + kUserNameOffset, 32, "guest"); + ::snprintf(p + kUserNameOffset, 32, "guest"); // Group name - snprintf(p + kGroupNameOffset, 32, "staff"); + ::snprintf(p + kGroupNameOffset, 32, "staff"); // This has to be done at the end diff --git a/o3d/import/cross/tar_processor_test.cc b/o3d/import/cross/tar_processor_test.cc index 120aef3..3e7afaa 100644 --- a/o3d/import/cross/tar_processor_test.cc +++ b/o3d/import/cross/tar_processor_test.cc @@ -60,7 +60,7 @@ class TarTestClient : public ArchiveCallbackClient { explicit TarTestClient() : file_count_(0), index_(0) {} // ArchiveCallbackClient methods virtual void ReceiveFileHeader(const ArchiveFileInfo &file_info); - virtual bool ReceiveFileData(MemoryReadStream *stream, int nbytes); + virtual bool ReceiveFileData(MemoryReadStream *stream, size_t nbytes); int GetFileCount() const { return file_count_; } size_t GetNumTotalBytesReceived() const { return index_; } @@ -91,7 +91,7 @@ void TarTestClient::ReceiveFileHeader(const ArchiveFileInfo &file_info) { } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -bool TarTestClient::ReceiveFileData(MemoryReadStream *stream, int nbytes) { +bool TarTestClient::ReceiveFileData(MemoryReadStream *stream, size_t nbytes) { const char *p = reinterpret_cast<const char*>( stream->GetDirectMemoryPointer()); diff --git a/o3d/import/cross/targz_processor.h b/o3d/import/cross/targz_processor.h index 56b5427..ef83278 100644 --- a/o3d/import/cross/targz_processor.h +++ b/o3d/import/cross/targz_processor.h @@ -41,8 +41,7 @@ #include "import/cross/archive_processor.h" #include "import/cross/gz_decompressor.h" #include "import/cross/tar_processor.h" - -#include "third_party/zlib/files/zlib.h" +#include "zlib.h" namespace o3d { diff --git a/o3d/import/cross/targz_processor_test.cc b/o3d/import/cross/targz_processor_test.cc index fd98f27..5fc5914 100644 --- a/o3d/import/cross/targz_processor_test.cc +++ b/o3d/import/cross/targz_processor_test.cc @@ -59,7 +59,7 @@ class ArchiveTestClient : public ArchiveCallbackClient { explicit ArchiveTestClient() : file_count_(0), index_(0) {} // ArchiveCallbackClient methods virtual void ReceiveFileHeader(const ArchiveFileInfo &file_info); - virtual bool ReceiveFileData(MemoryReadStream *stream, int nbytes); + virtual bool ReceiveFileData(MemoryReadStream *stream, size_t nbytes); int GetFileCount() const { return file_count_; } size_t GetNumTotalBytesReceived() const { return index_; } @@ -90,7 +90,8 @@ void ArchiveTestClient::ReceiveFileHeader(const ArchiveFileInfo &file_info) { } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -bool ArchiveTestClient::ReceiveFileData(MemoryReadStream *stream, int nbytes) { +bool ArchiveTestClient::ReceiveFileData(MemoryReadStream *stream, + size_t nbytes) { const char *p = reinterpret_cast<const char*>( stream->GetDirectMemoryPointer()); diff --git a/o3d/import/cross/zip_archive.cc b/o3d/import/cross/zip_archive.cc index 275722f..cd7f0455 100644 --- a/o3d/import/cross/zip_archive.cc +++ b/o3d/import/cross/zip_archive.cc @@ -58,6 +58,11 @@ using std::vector; using std::string; +#if defined(OS_WIN) +// Windows #defines this... +#undef DeleteFile +#endif + #ifndef ALLOW_USER_QUERY #define ALLOW_USER_QUERY 0 // 1: ask before overwriting files #endif @@ -203,10 +208,17 @@ int ZipArchive::Extract() { const char *dirname = NULL; if (opt_do_extract == 1) { - if (opt_extractdir && chdir(dirname)) { +#if defined(OS_WIN) + if (opt_extractdir && ::_chdir(dirname)) { + DEBUGLOG("Error changing into %s, aborting\n", dirname); + exit(-1); + } +#else + if (opt_extractdir && ::chdir(dirname)) { DEBUGLOG("Error changing into %s, aborting\n", dirname); exit(-1); } +#endif if (filename_to_extract == NULL) { return DoExtract(opt_do_extract_withoutpath, @@ -221,6 +233,7 @@ int ZipArchive::Extract() { } unzCloseCurrentFile(zip_file_ref_); + return 1; } // Extracts a single file to disk @@ -294,9 +307,9 @@ char *ZipArchive::GetFileData(const string &filename, size_t *size) { // as string data and doesn't harm anything else buffer = reinterpret_cast<char*>(malloc(file_info.uncompressed_size + 1)); buffer[file_info.uncompressed_size] = 0; - int buffer_index = 0; + uint32 buffer_index = 0; - int nbytes; + uint32 nbytes; do { nbytes = unzReadCurrentFile(uf, temp_buffer, kBufferChunkSize); if (nbytes < 0) { @@ -511,7 +524,7 @@ int ZipArchive::DoExtract(int opt_extract_without_path, int result = unzGetGlobalInfo(zip_file_ref_, &gi); if (result != UNZ_OK) - DEBUGLOG("error %d with zipfile in unzGetGlobalInfo \n", result); + DEBUGLOG("error %d with zipfile in unzGetGlobalInfo \n", result) for (uLong i = 0; i < gi.number_entry; ++i) { if (ExtractCurrentFile(&opt_extract_without_path, @@ -522,7 +535,7 @@ int ZipArchive::DoExtract(int opt_extract_without_path, if ((i + 1) < gi.number_entry) { result = unzGoToNextFile(zip_file_ref_); if (result != UNZ_OK) { - DEBUGLOG("error %d with zipfile in unzGoToNextFile\n", result); + DEBUGLOG("error %d with zipfile in unzGoToNextFile\n", result) break; } } @@ -551,7 +564,7 @@ void ZipArchive::ChangeFileDate(const char *filename, SetFileTime(hFile, &ftm, &ftLastAcc, &ftm); CloseHandle(hFile); #else -#ifdef unix +#if defined(OS_LINUX) || defined(OS_MACOSX) struct utimbuf ut; struct tm newdate; newdate.tm_sec = tmu_date.tm_sec; @@ -577,11 +590,11 @@ void ZipArchive::ChangeFileDate(const char *filename, int ZipArchive::MyMkDir(const char *dirname) { int ret = 0; -#ifdef WIN32 - ret = mkdir(dirname); +#if defined(OS_WIN) + ret = ::_mkdir(dirname); #else -#ifdef unix - ret = mkdir(dirname, 0775); +#if defined(OS_LINUX) || defined(OS_MACOSX) + ret = ::mkdir(dirname, 0775); #endif #endif return ret; @@ -642,7 +655,7 @@ int ZipArchive::Print() { printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); - for (int i = 0; i < gi.number_entry; ++i) { + for (uint32 i = 0; i < gi.number_entry; ++i) { char filename_inzip[MAXFILENAME]; ZipFileInfo file_info; result = unzGetCurrentFileInfo(zip_file_ref_, @@ -801,7 +814,7 @@ bool ZipArchive::GetTempFileFromFile(const string &filename, char *data = GetFileData(filename, &data_size); if (data) { -#ifdef OS_WIN +#if defined(OS_WIN) // get the temp directory char temp_path[MAX_PATH]; if (!GetTempPathA(MAX_PATH, temp_path)) { @@ -814,7 +827,7 @@ bool ZipArchive::GetTempFileFromFile(const string &filename, // and format into a wide-string char guid_string[37]; - snprintf( + ::_snprintf( guid_string, sizeof(guid_string) / sizeof(guid_string[0]), "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", guid.Data1, guid.Data2, guid.Data3, @@ -828,14 +841,14 @@ bool ZipArchive::GetTempFileFromFile(const string &filename, int dot_position = filename.rfind('.'); if (dot_position != string::npos) { // try to retain the original file suffix (.jpg, etc.) - snprintf(fullpath, MAX_PATH, "%s%s%s", - temp_path, - guid_string, - filename.substr(dot_position).c_str()); + ::_snprintf(fullpath, MAX_PATH, "%s%s%s", + temp_path, + guid_string, + filename.substr(dot_position).c_str()); } else { - snprintf(fullpath, MAX_PATH, "%s\\%s", - temp_path, - guid_string); + ::_snprintf(fullpath, MAX_PATH, "%s\\%s", + temp_path, + guid_string); } FILE *tempfile = fopen(fullpath, "wb"); @@ -872,5 +885,9 @@ bool ZipArchive::GetTempFileFromFile(const string &filename, } void ZipArchive::DeleteFile(const string &filename) { - unlink(filename.c_str()); +#if defined(OS_WIN) + ::_unlink(filename.c_str()); +#else + ::unlink(filename.c_str()); +#endif } diff --git a/o3d/import/cross/zip_archive.h b/o3d/import/cross/zip_archive.h index 4c55539..aa3f9bc 100644 --- a/o3d/import/cross/zip_archive.h +++ b/o3d/import/cross/zip_archive.h @@ -108,11 +108,12 @@ #include <string> #include <vector> -#ifdef OS_MACOSX -#define unix -#endif +#include "contrib/minizip/unzip.h" -#include "third_party/zlib/files/contrib/minizip/unzip.h" +#if defined(OS_WIN) +// Windows #defines this. +#undef DeleteFile +#endif // structure containing the unz_file_info information plus the file name struct ZipFileInfo : public unz_file_info { diff --git a/o3d/import/win/collada_conditioner_win.cc b/o3d/import/win/collada_conditioner_win.cc index e9d3ebb..0d99319 100644 --- a/o3d/import/win/collada_conditioner_win.cc +++ b/o3d/import/win/collada_conditioner_win.cc @@ -114,7 +114,7 @@ bool ColladaConditioner::PreprocessShaderFile(const FilePath& in_filename, // Have to dup the string because CreateProcessW might modify the // contents. - wchar_t* buf = ::wcsdup(cmd.c_str()); + wchar_t* buf = ::_wcsdup(cmd.c_str()); // Initialize structure to zero with default array initializer. PROCESS_INFORMATION process_info = {0}; |