From 696fce4f9acb86d86d4e8b02f92fb398f4629c45 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 6 Jan 2002 09:17:59 +0000 Subject: [PATCH] 2002-01-06 10:00 UTC+0100 Viktor Szakats --- harbour/ChangeLog | 35 +++ harbour/include/error.ch | 2 + harbour/include/hbapilng.h | 4 +- harbour/source/lang/msg_tpl.c | 2 + harbour/source/lang/msgca.c | 2 + harbour/source/lang/msgcs852.c | 43 +++- harbour/source/lang/msgcsiso.c | 43 +++- harbour/source/lang/msgcskam.c | 43 +++- harbour/source/lang/msgcswin.c | 43 +++- harbour/source/lang/msgde.c | 43 +++- harbour/source/lang/msgen.c | 4 +- harbour/source/lang/msgeo.c | 2 + harbour/source/lang/msges.c | 2 + harbour/source/lang/msgeu.c | 2 + harbour/source/lang/msgfr.c | 2 + harbour/source/lang/msggl.c | 2 + harbour/source/lang/msghe862.c | 2 + harbour/source/lang/msghewin.c | 2 + harbour/source/lang/msghr852.c | 43 +++- harbour/source/lang/msghriso.c | 43 +++- harbour/source/lang/msghu852.c | 2 + harbour/source/lang/msghucwi.c | 2 + harbour/source/lang/msghuwin.c | 2 + harbour/source/lang/msgid.c | 2 + harbour/source/lang/msgis850.c | 43 +++- harbour/source/lang/msgit.c | 2 + harbour/source/lang/msgko.c | 2 + harbour/source/lang/msgnl.c | 92 ------- harbour/source/lang/msgpl852.c | 43 +++- harbour/source/lang/msgpliso.c | 43 +++- harbour/source/lang/msgplmaz.c | 43 +++- harbour/source/lang/msgpt.c | 2 + harbour/source/lang/msgro.c | 2 + harbour/source/lang/msgru866.c | 2 + harbour/source/lang/msgruwin.c | 2 + harbour/source/lang/msgsr852.c | 2 + harbour/source/lang/msgsriso.c | 2 + harbour/source/rtl/descend.c | 14 +- harbour/source/rtl/isprint.c | 458 +++++++++++++-------------------- harbour/source/rtl/transfrm.c | 2 +- harbour/source/vm/fm.c | 6 + 41 files changed, 624 insertions(+), 508 deletions(-) delete mode 100644 harbour/source/lang/msgnl.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 78db62776e..1e96b302d8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,41 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ + * change definition of INIT/EXIT PROCEDURE from HB_FUNC_STATIC() + to HB_FUNC_INIT()/HB_FUNC_EXIT() to avoid ambiguity + * include/hbdefs.h + + Added checking of ulSize == 0, only when + +2002-01-06 09:55 UTC-0300 Luiz Rafael Culik + * source/rtl/isprint.c + * Fixed an small typo + * utils/hbmake/hbmake.prg + * Updated the date + NOTE to translators or language file maintainers: + The two new strings should be translated to the proper + * source/lang/msgpt.c + * Updated copyright headers to the new one in some language + * source/rtl/isprint.c + * Change IsPrinter() logic for Win32;If no Printer is passed, it check the + default instaled printer.If an Printer name is passed, the name should match + ! Made more multiplatform by passing the complete printer + +2002-01-06 10:00 UTC+0100 Viktor Szakats + + + Added a C callable interface hb_printerIsReady() (not + + Added checking of ulSize == 0, only when + + Win32 version reworked so that it checks for the printer + name passed to the function. This also made the program + * include/error.ch + * include/hbapilng.h + * source/lang/*.c + + Added two new internal errors. + NOTE to translators or language file maintainers: + The two new strings should be translated to the proper + languages from English. + * Updated copyright headers to the new one in some language + files, where I either hold copyright, or the holder is unknown. + * source/rtl/isprint.c ! Made more multiplatform by passing the complete printer name to the fsOpen() function. diff --git a/harbour/include/error.ch b/harbour/include/error.ch index 313898845c..17cd36c1e5 100644 --- a/harbour/include/error.ch +++ b/harbour/include/error.ch @@ -131,6 +131,8 @@ #define HB_EI_ITEMBADCOPY 9020 /* "An item was going to be copied to itself from %s" */ #define HB_EI_MVBADSYMBOL 9021 /* "Invalid symbol item passed as memvar %s" */ #define HB_EI_XMEMOVERFLOW 9022 /* "Memory buffer overflow" */ +#define HB_EI_XGRABNULLSIZE 9023 /* "hb_xgrab requested to allocate zero byte" */ +#define HB_EI_XREALLOCNULLSIZE 9024 /* "hb_xrealloc requested to resize to zero byte" */ #endif /* _ERROR_CH */ diff --git a/harbour/include/hbapilng.h b/harbour/include/hbapilng.h index 0965898ab0..aaa7adf231 100644 --- a/harbour/include/hbapilng.h +++ b/harbour/include/hbapilng.h @@ -68,8 +68,8 @@ extern "C" { #define HB_LANG_ITEM_BASE_NATMSG 25 #define HB_LANG_ITEM_BASE_ERRDESC 38 #define HB_LANG_ITEM_BASE_ERRINTR 89 -#define HB_LANG_ITEM_BASE_TEXT 112 -#define HB_LANG_ITEM_MAX_ 115 +#define HB_LANG_ITEM_BASE_TEXT 114 +#define HB_LANG_ITEM_MAX_ 117 /* This hack is needed to force preprocessing if id is also a macro */ #define HB_LANG_REQUEST( id ) HB_LANG_REQUEST_( id ) diff --git a/harbour/source/lang/msg_tpl.c b/harbour/source/lang/msg_tpl.c index 153fbdf42b..32d761ab2b 100644 --- a/harbour/source/lang/msg_tpl.c +++ b/harbour/source/lang/msg_tpl.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgca.c b/harbour/source/lang/msgca.c index 71cea0db19..7ccdbf359d 100644 --- a/harbour/source/lang/msgca.c +++ b/harbour/source/lang/msgca.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgcs852.c b/harbour/source/lang/msgcs852.c index 4d63edb0a1..0b0072dc50 100644 --- a/harbour/source/lang/msgcs852.c +++ b/harbour/source/lang/msgcs852.c @@ -12,15 +12,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -28,9 +21,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -172,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgcsiso.c b/harbour/source/lang/msgcsiso.c index 8b7b82fd2b..477751e4af 100644 --- a/harbour/source/lang/msgcsiso.c +++ b/harbour/source/lang/msgcsiso.c @@ -12,15 +12,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -28,9 +21,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -172,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgcskam.c b/harbour/source/lang/msgcskam.c index fa111fa366..cd47a8317e 100644 --- a/harbour/source/lang/msgcskam.c +++ b/harbour/source/lang/msgcskam.c @@ -12,15 +12,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -28,9 +21,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -172,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgcswin.c b/harbour/source/lang/msgcswin.c index 0e2427cbfe..2b276f8f33 100644 --- a/harbour/source/lang/msgcswin.c +++ b/harbour/source/lang/msgcswin.c @@ -13,15 +13,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -29,9 +22,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -173,6 +190,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgde.c b/harbour/source/lang/msgde.c index 883b7c45fa..9eeeec5ca4 100644 --- a/harbour/source/lang/msgde.c +++ b/harbour/source/lang/msgde.c @@ -11,15 +11,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -27,9 +20,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -171,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgen.c b/harbour/source/lang/msgen.c index 5ff411104f..5444c2bad4 100644 --- a/harbour/source/lang/msgen.c +++ b/harbour/source/lang/msgen.c @@ -188,8 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", - - /* Texts */ + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", "YYYY/MM/DD", "Y", diff --git a/harbour/source/lang/msgeo.c b/harbour/source/lang/msgeo.c index d1b0b10893..6ab955e7e7 100644 --- a/harbour/source/lang/msgeo.c +++ b/harbour/source/lang/msgeo.c @@ -190,6 +190,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msges.c b/harbour/source/lang/msges.c index b188a9ac1d..12ed0d8b8c 100644 --- a/harbour/source/lang/msges.c +++ b/harbour/source/lang/msges.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "Un item estaba siendo copiado sobre s mismo desde %s", "Smbolo item no vlido pasado como memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgeu.c b/harbour/source/lang/msgeu.c index 87654c9582..efddd5d167 100644 --- a/harbour/source/lang/msgeu.c +++ b/harbour/source/lang/msgeu.c @@ -171,6 +171,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgfr.c b/harbour/source/lang/msgfr.c index e1bf870ebe..b0616178eb 100644 --- a/harbour/source/lang/msgfr.c +++ b/harbour/source/lang/msgfr.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msggl.c b/harbour/source/lang/msggl.c index 0f577aed3f..326b676c3a 100644 --- a/harbour/source/lang/msggl.c +++ b/harbour/source/lang/msggl.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghe862.c b/harbour/source/lang/msghe862.c index 5bf0072187..c951ab7f30 100644 --- a/harbour/source/lang/msghe862.c +++ b/harbour/source/lang/msghe862.c @@ -189,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghewin.c b/harbour/source/lang/msghewin.c index 2b4d9bf4a8..57ed0039ba 100644 --- a/harbour/source/lang/msghewin.c +++ b/harbour/source/lang/msghewin.c @@ -189,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghr852.c b/harbour/source/lang/msghr852.c index be3c5bbd9d..e7fb003616 100644 --- a/harbour/source/lang/msghr852.c +++ b/harbour/source/lang/msghr852.c @@ -12,15 +12,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -28,9 +21,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -172,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghriso.c b/harbour/source/lang/msghriso.c index 2fe81aca94..38b14d2d46 100644 --- a/harbour/source/lang/msghriso.c +++ b/harbour/source/lang/msghriso.c @@ -12,15 +12,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -28,9 +21,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -172,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghu852.c b/harbour/source/lang/msghu852.c index 58aaeb2ce0..ec06156c9d 100644 --- a/harbour/source/lang/msghu852.c +++ b/harbour/source/lang/msghu852.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghucwi.c b/harbour/source/lang/msghucwi.c index fb891a156e..b83e100263 100644 --- a/harbour/source/lang/msghucwi.c +++ b/harbour/source/lang/msghucwi.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msghuwin.c b/harbour/source/lang/msghuwin.c index 259b5f2462..4e26f5433c 100644 --- a/harbour/source/lang/msghuwin.c +++ b/harbour/source/lang/msghuwin.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgid.c b/harbour/source/lang/msgid.c index 6158725d48..7dfd61f7c7 100644 --- a/harbour/source/lang/msgid.c +++ b/harbour/source/lang/msgid.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgis850.c b/harbour/source/lang/msgis850.c index ee8989e860..a66670783a 100644 --- a/harbour/source/lang/msgis850.c +++ b/harbour/source/lang/msgis850.c @@ -12,15 +12,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -28,9 +21,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -172,6 +189,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgit.c b/harbour/source/lang/msgit.c index bc4591e816..0cc586af2d 100644 --- a/harbour/source/lang/msgit.c +++ b/harbour/source/lang/msgit.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgko.c b/harbour/source/lang/msgko.c index e311b83b05..37c428fb0a 100644 --- a/harbour/source/lang/msgko.c +++ b/harbour/source/lang/msgko.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgnl.c b/harbour/source/lang/msgnl.c deleted file mode 100644 index 24b10e1c6c..0000000000 --- a/harbour/source/lang/msgnl.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $Id$ - */ - -/* Language Support Module */ - -/* Language name: Dutch */ -/* ISO language code (2 chars): NL */ -/* Codepage: ???? */ - -#include "hbdefs.h" - -char *hb_dateMonthsName[ 12 ] = -{ - "januari", - "februari", - "maart", - "april", - "mei", - "juni", - "juli", - "augustus", - "september", - "oktober", - "november", - "december" -}; - -char *hb_dateDaysName[ 7 ] = -{ - "zondag", - "maandag", - "dinsdag", - "woensdag", - "donderdag", - "vrijdag", - "zaterdag" -}; - -char *hb_errorsGeneric[] = -{ - "Unknown error", - "Argument error", - "Bound error", - "String overflow", - "Numeric overflow", - "Zero divisor", - "Numeric error", - "Syntax error", - "Operation too complex", - "", - "", - "Memory low", - "Undefined function", - "No exported method", - "Variable does not exist", - "Alias does not exist", - "No exported variable", - "Illegal characters in alias", - "Alias already in use", - "", - "Create error", - "Open error", - "Close error", - "Read error", - "Write error", - "Print error", - "", - "", - "", - "", - "Operation not supported", - "Limit exceeded", - "Corruption detected", - "Data type error", - "Data width error", - "Workarea not in use", - "Workarea not indexed", - "Exclusive required", - "Lock required", - "Write not allowed", - "Append lock failed", - "Lock Failure", - "", - "", - "", - "Incorrect number of arguments", - "array access", - "array assign", - "not an array", - "conditional" -}; diff --git a/harbour/source/lang/msgpl852.c b/harbour/source/lang/msgpl852.c index c8b3c71dfe..13cc194662 100644 --- a/harbour/source/lang/msgpl852.c +++ b/harbour/source/lang/msgpl852.c @@ -11,15 +11,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -27,9 +20,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -171,6 +188,8 @@ static HB_LANG s_lang = "Item nie moe by skopiowany w %s", "W %s podano zy item jako memvar", "Zapis poza przydzielonym obszarem", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgpliso.c b/harbour/source/lang/msgpliso.c index 1443190e39..6bf058135a 100644 --- a/harbour/source/lang/msgpliso.c +++ b/harbour/source/lang/msgpliso.c @@ -11,15 +11,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -27,9 +20,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -171,6 +188,8 @@ static HB_LANG s_lang = "Item nie moe by skopiowany w %s", "W %s podano zy item jako memvar", "Zapis poza przydzielonym obszarem", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgplmaz.c b/harbour/source/lang/msgplmaz.c index afb0242519..4cbd93a739 100644 --- a/harbour/source/lang/msgplmaz.c +++ b/harbour/source/lang/msgplmaz.c @@ -11,15 +11,8 @@ * * 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, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) with other files to produce - * an executable, this does not by itself cause the resulting executable - * to be covered by the GNU General Public License. Your use of that - * executable is in no way restricted on account of linking the HRL - * and/or HVM code into it. + * the Free Software Foundation; either version 2, 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 @@ -27,9 +20,33 @@ * 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., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. * */ @@ -171,6 +188,8 @@ static HB_LANG s_lang = "Item nie moe by skopiowany w %s", "W %s podano zy item jako memvar", "Zapis poza przydzielonym obszarem", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgpt.c b/harbour/source/lang/msgpt.c index 980ca42ea1..f34b05439e 100644 --- a/harbour/source/lang/msgpt.c +++ b/harbour/source/lang/msgpt.c @@ -200,6 +200,8 @@ static HB_LANG s_lang = "Um item iria ser copiado para ele mesmo em %s", "Symbol item invlido passado como memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgro.c b/harbour/source/lang/msgro.c index 391acad326..d940d8f1e4 100644 --- a/harbour/source/lang/msgro.c +++ b/harbour/source/lang/msgro.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgru866.c b/harbour/source/lang/msgru866.c index 62fba1afab..2e28f6ab58 100644 --- a/harbour/source/lang/msgru866.c +++ b/harbour/source/lang/msgru866.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "%s: ⪠ ஢ ᥡ", "%s: ୮ ६", "९ ", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgruwin.c b/harbour/source/lang/msgruwin.c index 2a18a5b4fb..ed5586446d 100644 --- a/harbour/source/lang/msgruwin.c +++ b/harbour/source/lang/msgruwin.c @@ -188,6 +188,8 @@ static HB_LANG s_lang = "%s: ", "%s: ", " ", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgsr852.c b/harbour/source/lang/msgsr852.c index b9f8bf95b7..ae9f9fa1fb 100644 --- a/harbour/source/lang/msgsr852.c +++ b/harbour/source/lang/msgsr852.c @@ -171,6 +171,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/lang/msgsriso.c b/harbour/source/lang/msgsriso.c index 68dee61cee..27d15a0c5c 100644 --- a/harbour/source/lang/msgsriso.c +++ b/harbour/source/lang/msgsriso.c @@ -171,6 +171,8 @@ static HB_LANG s_lang = "An item was going to be copied to itself from %s", "Invalid symbol item passed as memvar %s", "Memory buffer overflow", + "hb_xgrab requested to allocate zero byte", + "hb_xrealloc requested to resize to zero byte", /* Texts */ diff --git a/harbour/source/rtl/descend.c b/harbour/source/rtl/descend.c index 0f18654735..31ee7ac2fd 100644 --- a/harbour/source/rtl/descend.c +++ b/harbour/source/rtl/descend.c @@ -75,10 +75,16 @@ HB_FUNC( DESCEND ) if( HB_IS_STRING( pItem ) ) { ULONG ulLen = hb_itemGetCLen( pItem ); - char * szBuffer = ( char * ) hb_xgrab( ulLen + 1); - hb_strDescend( szBuffer, hb_itemGetCPtr( pItem ), ulLen ); - hb_retclen( szBuffer, ulLen ); - hb_xfree( szBuffer ); + + if( ulLen > 0 ) + { + char * szBuffer = ( char * ) hb_xgrab( ulLen ); + hb_strDescend( szBuffer, hb_itemGetCPtr( pItem ), ulLen ); + hb_retclen( szBuffer, ulLen ); + hb_xfree( szBuffer ); + } + else + hb_retc( "" ); } else if( HB_IS_DATE( pItem ) ) hb_retnl( 5231808 - hb_itemGetDL( pItem ) ); diff --git a/harbour/source/rtl/isprint.c b/harbour/source/rtl/isprint.c index c5f46cebdf..a85862e20e 100644 --- a/harbour/source/rtl/isprint.c +++ b/harbour/source/rtl/isprint.c @@ -6,7 +6,7 @@ * Harbour Project source code: * ISPRINTER() function * - * Copyright 1999-2001 Viktor Szakats + * Copyright 1999-2002 Viktor Szakats * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * - * Copyright 2001 Luiz Rafael Culik * ISPRINTER() support for win32 * * See doc/license.txt for licensing terms. @@ -67,63 +67,67 @@ #include "hbapifs.h" #if defined(HB_OS_WIN_32) && !defined(__RSXNT__) + #include #include #include - BOOL DPGetDefaultPrinter(LPTSTR pPrinterName, LPDWORD pdwBufferSize); - BOOL IsPrinterError(HANDLE hPrinter); - BOOL GetJobs(HANDLE hPrinter, - JOB_INFO_2 **ppJobInfo, - int *pcJobs, - DWORD *pStatus) ; - #define MAXBUFFERSIZE 250 + + static BOOL IsPrinterError(HANDLE hPrinter); + + static BOOL GetJobs(HANDLE hPrinter, + JOB_INFO_2 **ppJobInfo, + int *pcJobs, + DWORD *pStatus); + #endif -/* NOTE: The parameter is an extension over CA-Cl*pper, it's also supported - by Xbase++. [vszakats] */ - -HB_FUNC( ISPRINTER ) +BOOL hb_printerIsReady( char * pszPrinterName ) { - char * pszDOSPort = ( ISCHAR( 1 ) && hb_parclen( 1 ) >= 4 ) ? hb_parc( 1 ) : "LPT1"; - USHORT uiPort = atoi( pszDOSPort + 3 ); BOOL bIsPrinter; #if defined(HB_OS_DOS) /* NOTE: DOS specific solution, using BIOS interrupt */ - if( hb_strnicmp( pszDOSPort, "LPT", 3 ) == 0 && uiPort > 0 ) { - union REGS regs; - - regs.h.ah = 2; - regs.HB_XREGS.dx = uiPort - 1; - - HB_DOS_INT86( 0x17, ®s, ®s ); - - bIsPrinter = ( regs.h.ah == 0x90 ); + USHORT uiPort; + + if( hb_strnicmp( pszPrinterName, "PRN", 3 ) == 0 ) + { + union REGS regs; + + regs.h.ah = 2; + regs.HB_XREGS.dx = 0; /* LPT1 */ + + HB_DOS_INT86( 0x17, ®s, ®s ); + + bIsPrinter = ( regs.h.ah == 0x90 ); + } + else if( strlen( pszPrinterName ) >= 4 && + hb_strnicmp( pszPrinterName, "LPT", 3 ) == 0 && + ( uiPort = atoi( pszPrinterName + 3 ) ) > 0 ) + { + union REGS regs; + + regs.h.ah = 2; + regs.HB_XREGS.dx = uiPort - 1; + + HB_DOS_INT86( 0x17, ®s, ®s ); + + bIsPrinter = ( regs.h.ah == 0x90 ); + } + else + bIsPrinter = FALSE; } - else if( hb_strnicmp( pszDOSPort, "COM", 3 ) == 0 && uiPort > 0 ) - { - /* TODO: Proper COM port checking */ - bIsPrinter = TRUE; - } - else - bIsPrinter = FALSE; - #elif defined(HB_OS_WIN_32) && !defined(__RSXNT__) { - char DefaultPrinter[ 80 ]; - DWORD pdwBufferSize = 80; HANDLE hPrinter; - DPGetDefaultPrinter( ( LPTSTR ) &DefaultPrinter, &pdwBufferSize); - OpenPrinter( DefaultPrinter, &hPrinter, NULL ); - bIsPrinter = ! IsPrinterError( hPrinter ); + OpenPrinter( pszPrinterName, &hPrinter, NULL ); - HB_SYMBOL_UNUSED( uiPort ); + bIsPrinter = ! IsPrinterError( hPrinter ); } #else @@ -135,276 +139,180 @@ HB_FUNC( ISPRINTER ) trying to open it, since we are talking to the spooler. [vszakats] */ - if( ( hb_strnicmp( pszDOSPort, "LPT", 3 ) == 0 || - hb_strnicmp( pszDOSPort, "COM", 3 ) == 0 ) && uiPort > 0 ) { - FHANDLE fhnd = hb_fsOpen( ( BYTE * ) pszDOSPort, FO_WRITE | FO_SHARED | FO_PRIVATE ); + FHANDLE fhnd = hb_fsOpen( ( BYTE * ) pszPrinterName, FO_WRITE | FO_SHARED | FO_PRIVATE ); bIsPrinter = ( fhnd != FS_ERROR ); hb_fsClose( fhnd ); } - else - bIsPrinter = FALSE; #endif - hb_retl( bIsPrinter ); + return bIsPrinter; } -/** The code below does the check for the printer */ +/* NOTE: The parameter is an extension over CA-Cl*pper, it's also supported + by Xbase++. [vszakats] */ + +HB_FUNC( ISPRINTER ) +{ + hb_retl( hb_printerIsReady( ISCHAR( 1 ) ? hb_parc( 1 ) : "LPT1" ) ); +} + +/* The code below does the check for the printer under Win32 */ #if defined(HB_OS_WIN_32) && !defined(__RSXNT__) -BOOL DPGetDefaultPrinter(LPTSTR pPrinterName, LPDWORD pdwBufferSize) +static BOOL IsPrinterError( HANDLE hPrinter ) { - BOOL bFlag; - OSVERSIONINFO osv; - TCHAR cBuffer[MAXBUFFERSIZE]; - PRINTER_INFO_2 *ppi2 = NULL; - DWORD dwNeeded = 0; - DWORD dwReturned = 0; + JOB_INFO_2 *pJobs; + int cJobs, + i; + DWORD dwPrinterStatus; - /* What version of Windows are you running? */ - osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osv); - - /* If Windows 95 or 98, use EnumPrinters... */ - if (osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - { - /* The first EnumPrinters() tells you how big our buffer should - be in order to hold ALL of PRINTER_INFO_2. Note that this will - usually return FALSE. This only means that the buffer (the 4th - parameter) was not filled in. You don't want it filled in here... */ - EnumPrinters(PRINTER_ENUM_DEFAULT, NULL, 2, NULL, 0, &dwNeeded, &dwReturned); - if (dwNeeded == 0) - return FALSE; - - /* Allocate enough space for PRINTER_INFO_2... */ - ppi2 = (PRINTER_INFO_2 *)GlobalAlloc(GPTR, dwNeeded); - if (!ppi2) - return FALSE; - - /* The second EnumPrinters() will fill in all the current information... */ - bFlag = EnumPrinters(PRINTER_ENUM_DEFAULT, NULL, 2, (LPBYTE)ppi2, dwNeeded, &dwNeeded, &dwReturned); - if (!bFlag) - { - GlobalFree(ppi2); - return FALSE; - } - - /* If given buffer too small, set required size and fail... */ - if ((DWORD)lstrlen(ppi2->pPrinterName) >= *pdwBufferSize) - { - *pdwBufferSize = (DWORD)lstrlen(ppi2->pPrinterName) + 1; - GlobalFree(ppi2); - return FALSE; - } - - /* Copy printer name into passed-in buffer... */ - lstrcpy(pPrinterName, ppi2->pPrinterName); - - /* Set buffer size parameter to min required buffer size... */ - *pdwBufferSize = (DWORD)lstrlen(ppi2->pPrinterName) + 1; - } - - /* If Windows NT, use the GetDefaultPrinter API for Windows 2000, - or GetProfileString for version 4.0 and earlier... */ - else if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) - { -#if(WINVER >= 0x0500) - if (osv.dwMajorVersion >= 5) /* Windows 2000 or later */ - { - bFlag = GetDefaultPrinter(pPrinterName, pdwBufferSize); - if (!bFlag) - return FALSE; - } - - else /* NT4.0 or earlier */ -#endif - { - /* Retrieve the default string from Win.ini (the registry). - String will be in form "printername,drivername,portname". */ - if (GetProfileString("windows", "device", ",,,", cBuffer, MAXBUFFERSIZE) <= 0) + /* + * Get the state information for the Printer Queue and + * the jobs in the Printer Queue. + */ + if (!GetJobs(hPrinter, &pJobs, &cJobs, &dwPrinterStatus)) return FALSE; - /* Printer name precedes first "," character... */ - strtok(cBuffer, ","); - - /* If given buffer too small, set required size and fail... */ - if ((DWORD)lstrlen(cBuffer) >= *pdwBufferSize) - { - *pdwBufferSize = (DWORD)lstrlen(cBuffer) + 1; - return FALSE; - } - - /* Copy printer name into passed-in buffer... */ - lstrcpy(pPrinterName, cBuffer); - - /* Set buffer size parameter to min required buffer size... */ - *pdwBufferSize = (DWORD)lstrlen(cBuffer) + 1; + /* + * If the Printer reports an error, believe it. + */ + if (dwPrinterStatus & + (PRINTER_STATUS_ERROR | + PRINTER_STATUS_PAPER_JAM | + PRINTER_STATUS_PAPER_OUT | + PRINTER_STATUS_PAPER_PROBLEM | + PRINTER_STATUS_OUTPUT_BIN_FULL | + PRINTER_STATUS_NOT_AVAILABLE | + PRINTER_STATUS_NO_TONER | + PRINTER_STATUS_OUT_OF_MEMORY | + PRINTER_STATUS_OFFLINE | + PRINTER_STATUS_DOOR_OPEN)) + { + return TRUE; } - } - /* Cleanup... */ - if (ppi2) - GlobalFree(ppi2); + /* + * Find the Job in the Queue that is printing. + */ + for (i=0; i < cJobs; i++) + { + if (pJobs[i].Status & JOB_STATUS_PRINTING) + { + /* + * If the job is in an error state, + * report an error for the printer. + * Code could be inserted here to + * attempt an interpretation of the + * pStatus member as well. + */ + if (pJobs[i].Status & + (JOB_STATUS_ERROR | + JOB_STATUS_OFFLINE | + JOB_STATUS_PAPEROUT | + JOB_STATUS_BLOCKED_DEVQ)) + { + return TRUE; + } + } + } + + /* + * No error condition. + */ + return FALSE; - return TRUE; } -#undef MAXBUFFERSIZE - BOOL IsPrinterError(HANDLE hPrinter) - { - - JOB_INFO_2 *pJobs; - int cJobs, - i; - DWORD dwPrinterStatus; - - /* - * Get the state information for the Printer Queue and - * the jobs in the Printer Queue. - */ - if (!GetJobs(hPrinter, &pJobs, &cJobs, &dwPrinterStatus)) - return FALSE; - - /* - * If the Printer reports an error, believe it. - */ - if (dwPrinterStatus & - (PRINTER_STATUS_ERROR | - PRINTER_STATUS_PAPER_JAM | - PRINTER_STATUS_PAPER_OUT | - PRINTER_STATUS_PAPER_PROBLEM | - PRINTER_STATUS_OUTPUT_BIN_FULL | - PRINTER_STATUS_NOT_AVAILABLE | - PRINTER_STATUS_NO_TONER | - PRINTER_STATUS_OUT_OF_MEMORY | - PRINTER_STATUS_OFFLINE | - PRINTER_STATUS_DOOR_OPEN)) - { - return TRUE; - } - - /* - * Find the Job in the Queue that is printing. - */ - for (i=0; i < cJobs; i++) - { - if (pJobs[i].Status & JOB_STATUS_PRINTING) - { - /* - * If the job is in an error state, - * report an error for the printer. - * Code could be inserted here to - * attempt an interpretation of the - * pStatus member as well. - */ - if (pJobs[i].Status & - (JOB_STATUS_ERROR | - JOB_STATUS_OFFLINE | - JOB_STATUS_PAPEROUT | - JOB_STATUS_BLOCKED_DEVQ)) - { - return TRUE; - } - } - } - - /* - * No error condition. - */ - return FALSE; - - } - BOOL GetJobs(HANDLE hPrinter, /* Handle to the printer. */ - +static BOOL GetJobs(HANDLE hPrinter, /* Handle to the printer. */ JOB_INFO_2 **ppJobInfo, /* Pointer to be filled. */ int *pcJobs, /* Count of jobs filled. */ DWORD *pStatus) /* Print Queue status. */ +{ - { + DWORD cByteNeeded; + DWORD nReturned; + DWORD cByteUsed; + JOB_INFO_2 * pJobStorage; + PRINTER_INFO_2 * pPrinterInfo; - DWORD cByteNeeded, - nReturned, - cByteUsed; - JOB_INFO_2 *pJobStorage; - PRINTER_INFO_2 *pPrinterInfo; +/* Get the buffer size needed. */ + if (!GetPrinter(hPrinter, 2, NULL, 0, &cByteNeeded)) + { + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + return FALSE; + } - /* Get the buffer size needed. */ - if (!GetPrinter(hPrinter, 2, NULL, 0, &cByteNeeded)) - { - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - return FALSE; - } + pPrinterInfo = (PRINTER_INFO_2 *)malloc(cByteNeeded); + if (!(pPrinterInfo)) + /* Failure to allocate memory. */ + return FALSE; - pPrinterInfo = (PRINTER_INFO_2 *)malloc(cByteNeeded); - if (!(pPrinterInfo)) - /* Failure to allocate memory. */ - return FALSE; + /* Get the printer information. */ + if (!GetPrinter(hPrinter, + 2, + (LPBYTE)pPrinterInfo, + cByteNeeded, + &cByteUsed)) + { + /* Failure to access the printer. */ + free(pPrinterInfo); + return FALSE; + } - /* Get the printer information. */ - if (!GetPrinter(hPrinter, - 2, - (LPBYTE)pPrinterInfo, - cByteNeeded, - &cByteUsed)) - { - /* Failure to access the printer. */ - free(pPrinterInfo); - return FALSE; - } + /* Get job storage space. */ + if (!EnumJobs(hPrinter, + 0, + pPrinterInfo->cJobs, + 2, + NULL, + 0, + (LPDWORD)&cByteNeeded, + (LPDWORD)&nReturned)) + { + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + free(pPrinterInfo); + return FALSE; + } + } - /* Get job storage space. */ - if (!EnumJobs(hPrinter, - 0, - pPrinterInfo->cJobs, - 2, - NULL, - 0, - (LPDWORD)&cByteNeeded, - (LPDWORD)&nReturned)) - { - if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) - { - free(pPrinterInfo); - return FALSE; - } - } + pJobStorage = (JOB_INFO_2 *)malloc(cByteNeeded); + if (!pJobStorage) + { + /* Failure to allocate Job storage space. */ + free(pPrinterInfo); + return FALSE; + } - pJobStorage = (JOB_INFO_2 *)malloc(cByteNeeded); - if (!pJobStorage) - { - /* Failure to allocate Job storage space. */ - free(pPrinterInfo); - return FALSE; - } + ZeroMemory(pJobStorage, cByteNeeded); - ZeroMemory(pJobStorage, cByteNeeded); + /* Get the list of jobs. */ + if (!EnumJobs(hPrinter, + 0, + pPrinterInfo->cJobs, + 2, + (LPBYTE)pJobStorage, + cByteNeeded, + (LPDWORD)&cByteUsed, + (LPDWORD)&nReturned)) + { + free(pPrinterInfo); + free(pJobStorage); + return FALSE; + } - /* Get the list of jobs. */ - if (!EnumJobs(hPrinter, - 0, - pPrinterInfo->cJobs, - 2, - (LPBYTE)pJobStorage, - cByteNeeded, - (LPDWORD)&cByteUsed, - (LPDWORD)&nReturned)) - { - free(pPrinterInfo); - free(pJobStorage); - return FALSE; - } + /* + * Return the information. + */ + *pcJobs = nReturned; + *pStatus = pPrinterInfo->Status; + *ppJobInfo = pJobStorage; + free(pPrinterInfo); - /* - * Return the information. - */ - *pcJobs = nReturned; - *pStatus = pPrinterInfo->Status; - *ppJobInfo = pJobStorage; - free(pPrinterInfo); + return TRUE; +} - return TRUE; - - } #endif diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index 0ed272a4fe..487e163a2c 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -197,7 +197,7 @@ HB_FUNC( TRANSFORM ) /* Grab enough */ - szResult = ( char * ) hb_xgrab( ulExpLen + ulPicLen + 1); + szResult = ( char * ) hb_xgrab( ulExpLen + ulPicLen + 1 ); ulResultPos = 0; /* Support date function for strings */ diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index ab26d0dfa6..876fcc31ad 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -201,6 +201,9 @@ void HB_EXPORT * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exi #ifdef HB_FM_STATISTICS + if( ulSize == 0 ) + hb_errInternal( HB_EI_XGRABNULLSIZE, NULL, NULL, NULL ); + pMem = malloc( ulSize + sizeof( HB_MEMINFO ) + sizeof( ULONG ) ); if( ! pMem ) @@ -285,6 +288,9 @@ void HB_EXPORT * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates m if( ! pMem ) hb_errInternal( HB_EI_XREALLOCNULL, NULL, NULL, NULL ); + if( ulSize == 0 ) + hb_errInternal( HB_EI_XREALLOCNULLSIZE, NULL, NULL, NULL ); + pMemBlock = ( PHB_MEMINFO ) ( ( char * ) pMem - sizeof( HB_MEMINFO ) ); if( pMemBlock->ulSignature != HB_MEMINFO_SIGNATURE )