[Amizilla-cvs] amizilla/netwerk/base/src amigaSetFileSize.c,NONE,1.1 amigaSetFileSize.h,NONE,1.1 nsF
Brought to you by:
maxlarsson
From: Oliver B. <o1...@us...> - 2005-05-24 07:30:17
|
Update of /cvsroot/amizilla/amizilla/netwerk/base/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5739 Modified Files: nsFileStreams.cpp Added Files: amigaSetFileSize.c amigaSetFileSize.h Log Message: Can't use dos includes in the Mozilla cpp sources, as stuff like ACCESS_WRITE collides with Mozilla includes. Maybe move this to the AmigaOS part of nspr later. --- NEW FILE: amigaSetFileSize.h --- /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Oliver Brunner <ami...@ol...> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* AmigaDos includes conflict with Mozilla includes at various places. * This stuff should better go to nspr in the Mozilla sources. * This more a hack than a clean solution ;). */ #if defined(XP_AMIGAOS) extern "C" { int AmigaSetFileSize( int fh, int pos); } #endif --- NEW FILE: amigaSetFileSize.c --- /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Oliver Brunner <ami...@ol...> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* AmigaDos includes conflict with Mozilla includes at various places. * This stuff should better go to nspr in the Mozilla sources. * This more a hack than a clean solution ;). */ #if defined(XP_AMIGAOS) #include <proto/dos.h> #include <dos/dos.h> int AmigaSetFileSize(int fh,int length) { return ((int) SetFileSize((BPTR) fh, (LONG) length, OFFSET_BEGINNING) == -1 ); } #endif Index: nsFileStreams.cpp =================================================================== RCS file: /cvsroot/amizilla/amizilla/netwerk/base/src/nsFileStreams.cpp,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -C2 -d -r1.1.1.2 -r1.2 *** nsFileStreams.cpp 29 Jun 2004 11:07:09 -0000 1.1.1.2 --- nsFileStreams.cpp 24 May 2005 07:30:07 -0000 1.2 *************** *** 36,40 **** * ***** END LICENSE BLOCK ***** */ ! #if defined(XP_UNIX) || defined(XP_BEOS) #include <unistd.h> #elif defined(XP_MAC) --- 36,40 ---- * ***** END LICENSE BLOCK ***** */ ! #if (defined(XP_UNIX) || defined(XP_BEOS)) && !(defined XP_AMIGAOS) #include <unistd.h> #elif defined(XP_MAC) *************** *** 45,48 **** --- 45,50 ---- #define INCL_DOSERRORS #include <os2.h> + #elif defined (XP_AMIGAOS) + #include "amigaSetFileSize.h" #else // XXX add necessary include file for ftruncate (or equivalent) *************** *** 169,173 **** #endif ! #if defined(XP_UNIX) || defined(XP_BEOS) if (ftruncate(PR_FileDesc2NativeHandle(mFD), offset) != 0) { NS_ERROR("ftruncate failed"); --- 171,175 ---- #endif ! #if (defined(XP_UNIX) || defined(XP_BEOS)) && !(defined XP_AMIGAOS) if (ftruncate(PR_FileDesc2NativeHandle(mFD), offset) != 0) { NS_ERROR("ftruncate failed"); *************** *** 189,192 **** --- 191,199 ---- return NS_ERROR_FAILURE; } + #elif defined(XP_AMIGAOS) + if (AmigaSetFileSize(PR_FileDesc2NativeHandle(mFD),offset) == -1 ) { + NS_ERROR("AmigaSetFileSize failed"); + return NS_ERROR_FAILURE; + } #else // XXX not implemented |