Bien, pues decidido a pasar TODAS las aplicaciones mias a Harbour, en la
recta final, me encuentro con este Wrapper que no termina de funcionar.
#pragma BEGINDUMP
#include "hbapi.h"
#include "hbapierr.h"
#include "hbstack.h"
HB_FUNC( URL_ENCODE )
{
char *cData = hb_parc(1);
int nLen = hb_parclen(1);
BOOL bComplete = hb_parl(2);
char *cRet;
int nPos = 0, nPosRet = 0, nVal;
char cElem;
if ( hb_pcount() < 2 )
{
bComplete = TRUE;
}
if ( ! cData )
{
hb_errRT_BASE( EG_ARG, 3012, NULL,
"TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
return;
}
if ( ! nLen )
{
hb_retc( "" );
return;
}
// Giving maximum final length possible
cRet = (char *) hb_xgrab( nLen * 3 +1);
while ( nPos < nLen )
{
cElem = cData[ nPos ];
if ( cElem == ' ' )
{
cRet[ nPosRet ] = '+';
}
else if (
(cElem >= 'A' && cElem <= 'Z') ||
(cElem >= 'a' && cElem <= 'z') ||
(cElem >= '0' && cElem <= '9') ||
cElem == '.' || cElem == ',' ||
cElem == '/' || cElem == ';' || cElem =='_' )
{
cRet[ nPosRet ] = cElem;
}
else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem ==
'=' ) )
{
cRet[ nPosRet ] = cElem;
}
else // encode!
{
cRet[ nPosRet++] = '%';
nVal = ((unsigned char) cElem) >> 4;
cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
nVal = ((unsigned char) cElem) & 0x0f;
cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
}
nPosRet++;
nPos++;
}
cRet[ nPosRet ] = 0;
/* this function also adds a zero */
hb_retclenAdoptRaw( cRet, nPosRet );
}
#pragma ENDDUMP
No se si ya existe esa funcion en Harbour, pues hasta hoy la utilizo para
enviar SMSs en mi aplicación Xailer+xHarbour.
el error de compilado-enlazado...
Compilant TSms.prg...
Compilant DatosPostVenta.prg...
Compilant LlistatsFitxersG520.prg...
Warning W8075 TSms.prg 244: Suspicious pointer conversion in function
HB_FUN_URL_ENCODE
Error E2451 TSms.prg 246: Undefined symbol 'BOOL' in function
HB_FUN_URL_ENCODE
Error E2379 TSms.prg 246: Statement missing ; in function HB_FUN_URL_ENCODE
Error E2140 TSms.prg 247: Declaration is not allowed here in function
HB_FUN_URL_ENCODE
Error E2140 TSms.prg 248: Declaration is not allowed here in function
HB_FUN_URL_ENCODE
Error E2140 TSms.prg 249: Declaration is not allowed here in function
HB_FUN_URL_ENCODE
Error E2451 TSms.prg 253: Undefined symbol 'bComplete' in function
HB_FUN_URL_ENCODE
Error E2451 TSms.prg 253: Undefined symbol 'TRUE' in function
HB_FUN_URL_ENCODE
Warning W8065 TSms.prg 308: Call to function 'hb_retclenAdoptRaw' with no
prototype in function HB_FUN_URL_ENCODE
3 Files, 2 Warnings, 7 Errors
Temps de compilació: 2.53s Temps d'enllaçat: 0s Temp total: 3.14s
Gracias.
Un Saludo,
Xevi
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 7663 (20121106) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Ultimo escollo
Ultimo escollo
Un Saludo,
Xevi.
Xevi.
Ultimo escollo
Gracias a José Lalín...
Ya está compilando!!!
Un Saludo,
Xevi.
"Xevi" <xevicomas@gmail.com> ha escrit al missatge del grup de discussió:
50990108$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Bien, pues decidido a pasar TODAS las aplicaciones mias a Harbour, en la
> recta final, me encuentro con este Wrapper que no termina de funcionar.
>
> #pragma BEGINDUMP
> #include "hbapi.h"
> #include "hbapierr.h"
> #include "hbstack.h"
>
> HB_FUNC( URL_ENCODE )
> {
> char *cData = hb_parc(1);
> int nLen = hb_parclen(1);
> BOOL bComplete = hb_parl(2);
> char *cRet;
> int nPos = 0, nPosRet = 0, nVal;
> char cElem;
>
> if ( hb_pcount() < 2 )
> {
> bComplete = TRUE;
> }
>
> if ( ! cData )
> {
> hb_errRT_BASE( EG_ARG, 3012, NULL,
> "TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
> return;
> }
>
> if ( ! nLen )
> {
> hb_retc( "" );
> return;
> }
>
> // Giving maximum final length possible
> cRet = (char *) hb_xgrab( nLen * 3 +1);
>
> while ( nPos < nLen )
> {
> cElem = cData[ nPos ];
>
> if ( cElem == ' ' )
> {
> cRet[ nPosRet ] = '+';
> }
> else if (
> (cElem >= 'A' && cElem <= 'Z') ||
> (cElem >= 'a' && cElem <= 'z') ||
> (cElem >= '0' && cElem <= '9') ||
> cElem == '.' || cElem == ',' ||
> cElem == '/' || cElem == ';' || cElem =='_' )
> {
> cRet[ nPosRet ] = cElem;
> }
> else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem ==
> '=' ) )
> {
> cRet[ nPosRet ] = cElem;
> }
> else // encode!
> {
> cRet[ nPosRet++] = '%';
> nVal = ((unsigned char) cElem) >> 4;
> cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
> nVal = ((unsigned char) cElem) & 0x0f;
> cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
> }
>
> nPosRet++;
> nPos++;
> }
>
> cRet[ nPosRet ] = 0;
> /* this function also adds a zero */
> hb_retclenAdoptRaw( cRet, nPosRet );
> }
> #pragma ENDDUMP
>
>
> No se si ya existe esa funcion en Harbour, pues hasta hoy la utilizo para
> enviar SMSs en mi aplicación Xailer+xHarbour.
>
> el error de compilado-enlazado...
>
> Compilant TSms.prg...
> Compilant DatosPostVenta.prg...
> Compilant LlistatsFitxersG520.prg...
> Warning W8075 TSms.prg 244: Suspicious pointer conversion in function
> HB_FUN_URL_ENCODE
> Error E2451 TSms.prg 246: Undefined symbol 'BOOL' in function
> HB_FUN_URL_ENCODE
> Error E2379 TSms.prg 246: Statement missing ; in function
> HB_FUN_URL_ENCODE
> Error E2140 TSms.prg 247: Declaration is not allowed here in function
> HB_FUN_URL_ENCODE
> Error E2140 TSms.prg 248: Declaration is not allowed here in function
> HB_FUN_URL_ENCODE
> Error E2140 TSms.prg 249: Declaration is not allowed here in function
> HB_FUN_URL_ENCODE
> Error E2451 TSms.prg 253: Undefined symbol 'bComplete' in function
> HB_FUN_URL_ENCODE
> Error E2451 TSms.prg 253: Undefined symbol 'TRUE' in function
> HB_FUN_URL_ENCODE
> Warning W8065 TSms.prg 308: Call to function 'hb_retclenAdoptRaw' with no
> prototype in function HB_FUN_URL_ENCODE
> 3 Files, 2 Warnings, 7 Errors
> Temps de compilació: 2.53s Temps d'enllaçat: 0s Temp total: 3.14s
>
>
> Gracias.
>
> Un Saludo,
> Xevi
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7663 (20121106) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7665 (20121106) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 7666 (20121106) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
Ya está compilando!!!
Un Saludo,
Xevi.
"Xevi" <xevicomas@gmail.com> ha escrit al missatge del grup de discussió:
50990108$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Bien, pues decidido a pasar TODAS las aplicaciones mias a Harbour, en la
> recta final, me encuentro con este Wrapper que no termina de funcionar.
>
> #pragma BEGINDUMP
> #include "hbapi.h"
> #include "hbapierr.h"
> #include "hbstack.h"
>
> HB_FUNC( URL_ENCODE )
> {
> char *cData = hb_parc(1);
> int nLen = hb_parclen(1);
> BOOL bComplete = hb_parl(2);
> char *cRet;
> int nPos = 0, nPosRet = 0, nVal;
> char cElem;
>
> if ( hb_pcount() < 2 )
> {
> bComplete = TRUE;
> }
>
> if ( ! cData )
> {
> hb_errRT_BASE( EG_ARG, 3012, NULL,
> "TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
> return;
> }
>
> if ( ! nLen )
> {
> hb_retc( "" );
> return;
> }
>
> // Giving maximum final length possible
> cRet = (char *) hb_xgrab( nLen * 3 +1);
>
> while ( nPos < nLen )
> {
> cElem = cData[ nPos ];
>
> if ( cElem == ' ' )
> {
> cRet[ nPosRet ] = '+';
> }
> else if (
> (cElem >= 'A' && cElem <= 'Z') ||
> (cElem >= 'a' && cElem <= 'z') ||
> (cElem >= '0' && cElem <= '9') ||
> cElem == '.' || cElem == ',' ||
> cElem == '/' || cElem == ';' || cElem =='_' )
> {
> cRet[ nPosRet ] = cElem;
> }
> else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem ==
> '=' ) )
> {
> cRet[ nPosRet ] = cElem;
> }
> else // encode!
> {
> cRet[ nPosRet++] = '%';
> nVal = ((unsigned char) cElem) >> 4;
> cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
> nVal = ((unsigned char) cElem) & 0x0f;
> cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
> }
>
> nPosRet++;
> nPos++;
> }
>
> cRet[ nPosRet ] = 0;
> /* this function also adds a zero */
> hb_retclenAdoptRaw( cRet, nPosRet );
> }
> #pragma ENDDUMP
>
>
> No se si ya existe esa funcion en Harbour, pues hasta hoy la utilizo para
> enviar SMSs en mi aplicación Xailer+xHarbour.
>
> el error de compilado-enlazado...
>
> Compilant TSms.prg...
> Compilant DatosPostVenta.prg...
> Compilant LlistatsFitxersG520.prg...
> Warning W8075 TSms.prg 244: Suspicious pointer conversion in function
> HB_FUN_URL_ENCODE
> Error E2451 TSms.prg 246: Undefined symbol 'BOOL' in function
> HB_FUN_URL_ENCODE
> Error E2379 TSms.prg 246: Statement missing ; in function
> HB_FUN_URL_ENCODE
> Error E2140 TSms.prg 247: Declaration is not allowed here in function
> HB_FUN_URL_ENCODE
> Error E2140 TSms.prg 248: Declaration is not allowed here in function
> HB_FUN_URL_ENCODE
> Error E2140 TSms.prg 249: Declaration is not allowed here in function
> HB_FUN_URL_ENCODE
> Error E2451 TSms.prg 253: Undefined symbol 'bComplete' in function
> HB_FUN_URL_ENCODE
> Error E2451 TSms.prg 253: Undefined symbol 'TRUE' in function
> HB_FUN_URL_ENCODE
> Warning W8065 TSms.prg 308: Call to function 'hb_retclenAdoptRaw' with no
> prototype in function HB_FUN_URL_ENCODE
> 3 Files, 2 Warnings, 7 Errors
> Temps de compilació: 2.53s Temps d'enllaçat: 0s Temp total: 3.14s
>
>
> Gracias.
>
> Un Saludo,
> Xevi
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7663 (20121106) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7665 (20121106) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 7666 (20121106) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
Un Saludo,
Xevi.
Xevi.
Ultimo escollo
Perdón... la solución.
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbapierr.h"
HB_FUNC( URL_ENCODE )
{
const char *cData = hb_parc(1);
int nLen = hb_parclen(1);
BOOL bComplete = hb_parl(2);
char *cRet;
int nPos = 0, nPosRet = 0, nVal;
char cElem;
if ( hb_pcount() < 2 )
{
bComplete = HB_TRUE;
}
if ( ! cData )
{
hb_errRT_BASE( EG_ARG, 3012, NULL,
"TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
return;
}
if ( ! nLen )
{
hb_retc( "" );
return;
}
// Giving maximum final length possible
cRet = (char *) hb_xgrab( nLen * 3 +1);
while ( nPos < nLen )
{
cElem = cData[ nPos ];
if ( cElem == ' ' )
{
cRet[ nPosRet ] = '+';
}
else if (
(cElem >= 'A' && cElem <= 'Z') ||
(cElem >= 'a' && cElem <= 'z') ||
(cElem >= '0' && cElem <= '9') ||
cElem == '.' || cElem == ',' ||
cElem == '/' || cElem == ';' || cElem =='_' )
{
cRet[ nPosRet ] = cElem;
}
else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem
=='=' ) )
{
cRet[ nPosRet ] = cElem;
}
else // encode!
{
cRet[ nPosRet++] = '%';
nVal = ((unsigned char) cElem) >4;
cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
nVal = ((unsigned char) cElem) & 0x0f;
cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
}
nPosRet++;
nPos++;
}
cRet[ nPosRet ] = 0;
/* this function also adds a zero */
hb_retclen_buffer( cRet, nPosRet );
}
#pragma ENDDUMP
*******************************
Luego, también puestos y viendo los pequeños detalles a modificar, modifico
el wrapper URL_DECODE y también me compila
#pragma BEGINDUMP
HB_FUNC( URL_DECODE )
{
const char *cData = hb_parc(1);
int nLen = hb_parclen(1);
char *cRet;
int nPos = 0, nPosRet = 0;
char cElem;
if ( ! cData )
{
hb_errRT_BASE( EG_ARG, 3012, NULL,
"TIPENCODERBASE64_DECODE", 1, hb_paramError(1) );
return;
}
if ( ! nLen )
{
hb_retc( "" );
return;
}
// maximum possible lenght
cRet = (char *) hb_xgrab( nLen );
while ( nPos < nLen )
{
cElem = cData[ nPos ];
if ( cElem == '+' )
{
cRet[ nPosRet ] = ' ';
}
else if ( cElem == '%' )
{
if ( nPos < nLen - 2 )
{
cElem = cData[ ++nPos ];
cRet[ nPosRet ] = cElem < 'A' ? cElem - '0' : cElem - 'A' + 10;
cRet[ nPosRet ] *= 16;
cElem = cData[ ++nPos ];
cRet[ nPosRet ] |= cElem < 'A' ? cElem - '0' : cElem - 'A' + 10;
}
else
{
if (nPosRet > 0 )
{
break;
}
}
}
else
{
cRet[ nPosRet ] = cElem;
}
nPos++;
nPosRet++;
}
/* this function also adds a zero */
/* hopefully reduce the size of cRet */
cRet = (char *) hb_xrealloc( cRet, nPosRet + 1 );
hb_retclen_buffer( cRet, nPosRet );
}
#pragma ENDDUMP
Un Saludo,
Xevi.
"Xevi" <xevicomas@gmail.com> ha escrit al missatge del grup de discussió:
50998beb$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Gracias a José Lalín...
>
> Ya está compilando!!!
>
>
> Un Saludo,
> Xevi.
>
> "Xevi" <xevicomas@gmail.com> ha escrit al missatge del grup de discussió:
> 50990108$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
>> Bien, pues decidido a pasar TODAS las aplicaciones mias a Harbour, en la
>> recta final, me encuentro con este Wrapper que no termina de funcionar.
>>
>> #pragma BEGINDUMP
>> #include "hbapi.h"
>> #include "hbapierr.h"
>> #include "hbstack.h"
>>
>> HB_FUNC( URL_ENCODE )
>> {
>> char *cData = hb_parc(1);
>> int nLen = hb_parclen(1);
>> BOOL bComplete = hb_parl(2);
>> char *cRet;
>> int nPos = 0, nPosRet = 0, nVal;
>> char cElem;
>>
>> if ( hb_pcount() < 2 )
>> {
>> bComplete = TRUE;
>> }
>>
>> if ( ! cData )
>> {
>> hb_errRT_BASE( EG_ARG, 3012, NULL,
>> "TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
>> return;
>> }
>>
>> if ( ! nLen )
>> {
>> hb_retc( "" );
>> return;
>> }
>>
>> // Giving maximum final length possible
>> cRet = (char *) hb_xgrab( nLen * 3 +1);
>>
>> while ( nPos < nLen )
>> {
>> cElem = cData[ nPos ];
>>
>> if ( cElem == ' ' )
>> {
>> cRet[ nPosRet ] = '+';
>> }
>> else if (
>> (cElem >= 'A' && cElem <= 'Z') ||
>> (cElem >= 'a' && cElem <= 'z') ||
>> (cElem >= '0' && cElem <= '9') ||
>> cElem == '.' || cElem == ',' ||
>> cElem == '/' || cElem == ';' || cElem =='_' )
>> {
>> cRet[ nPosRet ] = cElem;
>> }
>> else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem ==
>> '=' ) )
>> {
>> cRet[ nPosRet ] = cElem;
>> }
>> else // encode!
>> {
>> cRet[ nPosRet++] = '%';
>> nVal = ((unsigned char) cElem) >> 4;
>> cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
>> nVal = ((unsigned char) cElem) & 0x0f;
>> cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
>> }
>>
>> nPosRet++;
>> nPos++;
>> }
>>
>> cRet[ nPosRet ] = 0;
>> /* this function also adds a zero */
>> hb_retclenAdoptRaw( cRet, nPosRet );
>> }
>> #pragma ENDDUMP
>>
>>
>> No se si ya existe esa funcion en Harbour, pues hasta hoy la utilizo para
>> enviar SMSs en mi aplicación Xailer+xHarbour.
>>
>> el error de compilado-enlazado...
>>
>> Compilant TSms.prg...
>> Compilant DatosPostVenta.prg...
>> Compilant LlistatsFitxersG520.prg...
>> Warning W8075 TSms.prg 244: Suspicious pointer conversion in function
>> HB_FUN_URL_ENCODE
>> Error E2451 TSms.prg 246: Undefined symbol 'BOOL' in function
>> HB_FUN_URL_ENCODE
>> Error E2379 TSms.prg 246: Statement missing ; in function
>> HB_FUN_URL_ENCODE
>> Error E2140 TSms.prg 247: Declaration is not allowed here in function
>> HB_FUN_URL_ENCODE
>> Error E2140 TSms.prg 248: Declaration is not allowed here in function
>> HB_FUN_URL_ENCODE
>> Error E2140 TSms.prg 249: Declaration is not allowed here in function
>> HB_FUN_URL_ENCODE
>> Error E2451 TSms.prg 253: Undefined symbol 'bComplete' in function
>> HB_FUN_URL_ENCODE
>> Error E2451 TSms.prg 253: Undefined symbol 'TRUE' in function
>> HB_FUN_URL_ENCODE
>> Warning W8065 TSms.prg 308: Call to function 'hb_retclenAdoptRaw' with no
>> prototype in function HB_FUN_URL_ENCODE
>> 3 Files, 2 Warnings, 7 Errors
>> Temps de compilació: 2.53s Temps d'enllaçat: 0s Temp total: 3.14s
>>
>>
>> Gracias.
>>
>> Un Saludo,
>> Xevi
>>
>>
>> __________ Información de ESET NOD32 Antivirus, versión de la base de
>> firmas de virus 7663 (20121106) __________
>>
>> ESET NOD32 Antivirus ha comprobado este mensaje.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>> __________ Información de ESET NOD32 Antivirus, versión de la base de
>> firmas de virus 7665 (20121106) __________
>>
>> ESET NOD32 Antivirus ha comprobado este mensaje.
>>
>> http://www.eset.com
>>
>>
>>
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7666 (20121106) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7667 (20121107) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 7667 (20121107) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
#include "hbapierr.h"
HB_FUNC( URL_ENCODE )
{
const char *cData = hb_parc(1);
int nLen = hb_parclen(1);
BOOL bComplete = hb_parl(2);
char *cRet;
int nPos = 0, nPosRet = 0, nVal;
char cElem;
if ( hb_pcount() < 2 )
{
bComplete = HB_TRUE;
}
if ( ! cData )
{
hb_errRT_BASE( EG_ARG, 3012, NULL,
"TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
return;
}
if ( ! nLen )
{
hb_retc( "" );
return;
}
// Giving maximum final length possible
cRet = (char *) hb_xgrab( nLen * 3 +1);
while ( nPos < nLen )
{
cElem = cData[ nPos ];
if ( cElem == ' ' )
{
cRet[ nPosRet ] = '+';
}
else if (
(cElem >= 'A' && cElem <= 'Z') ||
(cElem >= 'a' && cElem <= 'z') ||
(cElem >= '0' && cElem <= '9') ||
cElem == '.' || cElem == ',' ||
cElem == '/' || cElem == ';' || cElem =='_' )
{
cRet[ nPosRet ] = cElem;
}
else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem
=='=' ) )
{
cRet[ nPosRet ] = cElem;
}
else // encode!
{
cRet[ nPosRet++] = '%';
nVal = ((unsigned char) cElem) >4;
cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
nVal = ((unsigned char) cElem) & 0x0f;
cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
}
nPosRet++;
nPos++;
}
cRet[ nPosRet ] = 0;
/* this function also adds a zero */
hb_retclen_buffer( cRet, nPosRet );
}
#pragma ENDDUMP
*******************************
Luego, también puestos y viendo los pequeños detalles a modificar, modifico
el wrapper URL_DECODE y también me compila
#pragma BEGINDUMP
HB_FUNC( URL_DECODE )
{
const char *cData = hb_parc(1);
int nLen = hb_parclen(1);
char *cRet;
int nPos = 0, nPosRet = 0;
char cElem;
if ( ! cData )
{
hb_errRT_BASE( EG_ARG, 3012, NULL,
"TIPENCODERBASE64_DECODE", 1, hb_paramError(1) );
return;
}
if ( ! nLen )
{
hb_retc( "" );
return;
}
// maximum possible lenght
cRet = (char *) hb_xgrab( nLen );
while ( nPos < nLen )
{
cElem = cData[ nPos ];
if ( cElem == '+' )
{
cRet[ nPosRet ] = ' ';
}
else if ( cElem == '%' )
{
if ( nPos < nLen - 2 )
{
cElem = cData[ ++nPos ];
cRet[ nPosRet ] = cElem < 'A' ? cElem - '0' : cElem - 'A' + 10;
cRet[ nPosRet ] *= 16;
cElem = cData[ ++nPos ];
cRet[ nPosRet ] |= cElem < 'A' ? cElem - '0' : cElem - 'A' + 10;
}
else
{
if (nPosRet > 0 )
{
break;
}
}
}
else
{
cRet[ nPosRet ] = cElem;
}
nPos++;
nPosRet++;
}
/* this function also adds a zero */
/* hopefully reduce the size of cRet */
cRet = (char *) hb_xrealloc( cRet, nPosRet + 1 );
hb_retclen_buffer( cRet, nPosRet );
}
#pragma ENDDUMP
Un Saludo,
Xevi.
"Xevi" <xevicomas@gmail.com> ha escrit al missatge del grup de discussió:
50998beb$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Gracias a José Lalín...
>
> Ya está compilando!!!
>
>
> Un Saludo,
> Xevi.
>
> "Xevi" <xevicomas@gmail.com> ha escrit al missatge del grup de discussió:
> 50990108$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
>> Bien, pues decidido a pasar TODAS las aplicaciones mias a Harbour, en la
>> recta final, me encuentro con este Wrapper que no termina de funcionar.
>>
>> #pragma BEGINDUMP
>> #include "hbapi.h"
>> #include "hbapierr.h"
>> #include "hbstack.h"
>>
>> HB_FUNC( URL_ENCODE )
>> {
>> char *cData = hb_parc(1);
>> int nLen = hb_parclen(1);
>> BOOL bComplete = hb_parl(2);
>> char *cRet;
>> int nPos = 0, nPosRet = 0, nVal;
>> char cElem;
>>
>> if ( hb_pcount() < 2 )
>> {
>> bComplete = TRUE;
>> }
>>
>> if ( ! cData )
>> {
>> hb_errRT_BASE( EG_ARG, 3012, NULL,
>> "TIPENCODERBASE64_ENCODE", 1, hb_paramError(1) );
>> return;
>> }
>>
>> if ( ! nLen )
>> {
>> hb_retc( "" );
>> return;
>> }
>>
>> // Giving maximum final length possible
>> cRet = (char *) hb_xgrab( nLen * 3 +1);
>>
>> while ( nPos < nLen )
>> {
>> cElem = cData[ nPos ];
>>
>> if ( cElem == ' ' )
>> {
>> cRet[ nPosRet ] = '+';
>> }
>> else if (
>> (cElem >= 'A' && cElem <= 'Z') ||
>> (cElem >= 'a' && cElem <= 'z') ||
>> (cElem >= '0' && cElem <= '9') ||
>> cElem == '.' || cElem == ',' ||
>> cElem == '/' || cElem == ';' || cElem =='_' )
>> {
>> cRet[ nPosRet ] = cElem;
>> }
>> else if ( ! bComplete && ( cElem == ':' || cElem == '?' || cElem ==
>> '=' ) )
>> {
>> cRet[ nPosRet ] = cElem;
>> }
>> else // encode!
>> {
>> cRet[ nPosRet++] = '%';
>> nVal = ((unsigned char) cElem) >> 4;
>> cRet[ nPosRet++] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
>> nVal = ((unsigned char) cElem) & 0x0f;
>> cRet[ nPosRet ] = nVal < 10 ? '0' + nVal : 'A' + nVal - 10;
>> }
>>
>> nPosRet++;
>> nPos++;
>> }
>>
>> cRet[ nPosRet ] = 0;
>> /* this function also adds a zero */
>> hb_retclenAdoptRaw( cRet, nPosRet );
>> }
>> #pragma ENDDUMP
>>
>>
>> No se si ya existe esa funcion en Harbour, pues hasta hoy la utilizo para
>> enviar SMSs en mi aplicación Xailer+xHarbour.
>>
>> el error de compilado-enlazado...
>>
>> Compilant TSms.prg...
>> Compilant DatosPostVenta.prg...
>> Compilant LlistatsFitxersG520.prg...
>> Warning W8075 TSms.prg 244: Suspicious pointer conversion in function
>> HB_FUN_URL_ENCODE
>> Error E2451 TSms.prg 246: Undefined symbol 'BOOL' in function
>> HB_FUN_URL_ENCODE
>> Error E2379 TSms.prg 246: Statement missing ; in function
>> HB_FUN_URL_ENCODE
>> Error E2140 TSms.prg 247: Declaration is not allowed here in function
>> HB_FUN_URL_ENCODE
>> Error E2140 TSms.prg 248: Declaration is not allowed here in function
>> HB_FUN_URL_ENCODE
>> Error E2140 TSms.prg 249: Declaration is not allowed here in function
>> HB_FUN_URL_ENCODE
>> Error E2451 TSms.prg 253: Undefined symbol 'bComplete' in function
>> HB_FUN_URL_ENCODE
>> Error E2451 TSms.prg 253: Undefined symbol 'TRUE' in function
>> HB_FUN_URL_ENCODE
>> Warning W8065 TSms.prg 308: Call to function 'hb_retclenAdoptRaw' with no
>> prototype in function HB_FUN_URL_ENCODE
>> 3 Files, 2 Warnings, 7 Errors
>> Temps de compilació: 2.53s Temps d'enllaçat: 0s Temp total: 3.14s
>>
>>
>> Gracias.
>>
>> Un Saludo,
>> Xevi
>>
>>
>> __________ Información de ESET NOD32 Antivirus, versión de la base de
>> firmas de virus 7663 (20121106) __________
>>
>> ESET NOD32 Antivirus ha comprobado este mensaje.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>> __________ Información de ESET NOD32 Antivirus, versión de la base de
>> firmas de virus 7665 (20121106) __________
>>
>> ESET NOD32 Antivirus ha comprobado este mensaje.
>>
>> http://www.eset.com
>>
>>
>>
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7666 (20121106) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
>
>
> __________ Información de ESET NOD32 Antivirus, versión de la base de
> firmas de virus 7667 (20121107) __________
>
> ESET NOD32 Antivirus ha comprobado este mensaje.
>
> http://www.eset.com
>
>
>
__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 7667 (20121107) __________
ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
Un Saludo,
Xevi.
Xevi.