Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: import/cross/zip_archive.cc

Issue 159168: This fixes a number of things that are warnings in the Mac compiler.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 if (tempfile) { 856 if (tempfile) {
857 fwrite(data, 1, data_size, tempfile); 857 fwrite(data, 1, data_size, tempfile);
858 fclose(tempfile); 858 fclose(tempfile);
859 *temp_filename = fullpath; 859 *temp_filename = fullpath;
860 } else { 860 } else {
861 return false; 861 return false;
862 } 862 }
863 863
864 #else 864 #else
865 // get just the final path component 865 // get just the final path component
866 int pos = filename.rfind('/'); 866 string::size_type pos = filename.rfind('/');
867 if (pos != string::npos) { 867 if (pos != string::npos) {
868 // TODO : need to get "proper" temp dir for user 868 // TODO : need to get "proper" temp dir for user
869 // TODO : need to append GUID to filename 869 // TODO : need to append GUID to filename
870 std::string tmp = "/tmp/" + filename.substr(pos + 1); 870 std::string tmp = "/tmp/" + filename.substr(pos + 1);
871 FILE *fp = fopen(tmp.c_str(), "w"); 871 FILE *fp = fopen(tmp.c_str(), "w");
872 872
873 if (fp) { 873 if (fp) {
874 fwrite(data, 1, data_size, fp); 874 fwrite(data, 1, data_size, fp);
875 fclose(fp); 875 fclose(fp);
876 *temp_filename = tmp; 876 *temp_filename = tmp;
877 } else { 877 } else {
878 return false; 878 return false;
879 } 879 }
880 } 880 }
881 #endif 881 #endif
882 } 882 }
883 883
884 return true; 884 return true;
885 } 885 }
886 886
887 void ZipArchive::DeleteFile(const string &filename) { 887 void ZipArchive::DeleteFile(const string &filename) {
888 #if defined(OS_WIN) 888 #if defined(OS_WIN)
889 ::_unlink(filename.c_str()); 889 ::_unlink(filename.c_str());
890 #else 890 #else
891 ::unlink(filename.c_str()); 891 ::unlink(filename.c_str());
892 #endif 892 #endif
893 } 893 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698