Skip to content

Commit

Permalink
Fix errors with use of AnsiString
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/indysoap/code-0/trunk@19 75be9796-0ac5-4f83-a77f-cba69ea37c88
  • Loading branch information
grahamegrieve committed Sep 15, 2013
1 parent 10b9276 commit 8bf04e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions source/IdSoapClient.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ function TIdSoapBaseSender.ProcessParamStringChar(ABasicType: TIdSoapBasicType;
begin
if (ADefault = MININT) or not (seoSendNoDefaults in EncodingOptions) or not (AnsiString(AData) = '') then
begin
ASoapWriter.DefineParamString(ARootNode, AParamName, String(AnsiString(AData))); // the debugger displays it wrong but its correct
ASoapWriter.DefineParamAnsiString(ARootNode, AParamName, String(AnsiString(AData))); // the debugger displays it wrong but its correct
end;
end;
isbtWideString:
Expand Down Expand Up @@ -2261,7 +2261,7 @@ function TIdSoapBaseSender.ProcessResultStringChar(ABasicType: TIdSoapBasicType
// Ret var on stack is 8 bytes above param pointer.
// 4 bytes for ret adr and 4 bytes for the param itself
LTempPtr := Pointer(Pointer(PAnsiChar(AParams) - 8)^);
AnsiString(LTempPtr^) := AnsiString(ASoapReader.ParamString[nil, FResultParamName]);
AnsiString(LTempPtr^) := AnsiString(ASoapReader.ParamAnsiString[nil, FResultParamName]);
end;
isbtWideString:
begin
Expand Down
1 change: 1 addition & 0 deletions source/IdSoapConsts.pas
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
ID_SOAP_BIN_TYPE_DATETIME_NULL = 24;
ID_SOAP_BIN_TYPE_GENERAL = 25;
ID_SOAP_BIN_TYPE_XML = 26;
ID_SOAP_BIN_TYPE_ANSISTRING = 27;

ID_SOAP_WSDL_SUFFIX_SERVICE = 'Service';
ID_SOAP_WSDL_SUFFIX_PORT = 'Port';
Expand Down
2 changes: 1 addition & 1 deletion source/IdSoapDefines.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ IndySOAP: Indy Soap Global Defines
In addition to choosing the define, you must make sure that the
matching indy version is on the path or in the project uses clause.
}
{.$.DEFINE INDY_V10}
{$DEFINE INDY_V10}

{$IFNDEF INDY_V10}
{$IFDEF VER200}
Expand Down
12 changes: 7 additions & 5 deletions source/IdSoapRpcBin.pas
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ function DescribeParamType(AType : Byte):String;
ID_SOAP_BIN_TYPE_SINGLE : result := 'Single';
ID_SOAP_BIN_TYPE_SMALLINT : result := 'SmallInt';
ID_SOAP_BIN_TYPE_STRING : result := 'String';
ID_SOAP_BIN_TYPE_ANSISTRING : result := 'AnsiString';
ID_SOAP_BIN_TYPE_WIDECHAR : result := 'WideChar';
ID_SOAP_BIN_TYPE_WIDESTRING : result := 'WideString';
ID_SOAP_BIN_TYPE_WORD : result := 'Word';
Expand Down Expand Up @@ -280,6 +281,7 @@ procedure TIdSoapReaderBin.ReadParam(ANode: TIdSoapNode);
ID_SOAP_BIN_TYPE_SINGLE : StreamSkip(FStream, Sizeof(Single));
ID_SOAP_BIN_TYPE_SMALLINT : StreamSkip(FStream, Sizeof(SmallInt));
ID_SOAP_BIN_TYPE_STRING : StreamSkip(FStream, StreamReadCardinal(FStream) {$IFDEF UNICODE}*2{$ENDIF});
ID_SOAP_BIN_TYPE_ANSISTRING : StreamSkip(FStream, StreamReadCardinal(FStream));
ID_SOAP_BIN_TYPE_WIDECHAR : StreamSkip(FStream, Sizeof(WideChar));
ID_SOAP_BIN_TYPE_WIDESTRING : StreamSkip(FStream, StreamReadCardinal(FStream) * 2);
ID_SOAP_BIN_TYPE_WORD : StreamSkip(FStream, Sizeof(Word));
Expand Down Expand Up @@ -868,22 +870,22 @@ function TIdSoapReaderBin.GetParamAnsiString(ANode: TIdSoapNode; const AName: St
const ASSERT_LOCATION = ASSERT_UNIT+'.TIdSoapReaderBin.GetParamAnsiString';
var
LType : Byte;
tmp : String;
tmp : AnsiString;
begin
Assert(self.TestValid(TIdSoapReaderBin), ASSERT_LOCATION+': Self is not valid');
// GetParamPosition will check other parameters
if GetParamExists(ANode, AName) then
begin
FStream.Position := GetParamPosition(ANode, AName);
LType := StreamReadByte(FStream);
Assert(LType = ID_SOAP_BIN_TYPE_STRING, ASSERT_LOCATION+': Value is actually '+DescribeParamType(LType));
Assert(LType = ID_SOAP_BIN_TYPE_ANSISTRING, ASSERT_LOCATION+': Value is actually '+DescribeParamType(LType));
SetLength(tmp, StreamReadCardinal(FStream));
if length(tmp) > 0 then
begin
StreamReadBinary(FStream, @result[1], Length(result) {$IFDEF UNICODE}*2{$ENDIF});
StreamReadBinary(FStream, @tmp[1], Length(tmp));
if seoUseCrLf in EncodingOptions then
begin
result := IdSoapAdjustLineBreaks(result, tislbsCRLF);
tmp := IdSoapAdjustLineBreaks(tmp, tislbsCRLF);
end;
end;
result := tmp;
Expand Down Expand Up @@ -1973,7 +1975,7 @@ procedure TIdSoapWriterBin.DefineParamAnsiString(ANode: TIdSoapNode; const AName
end;
StreamWriteByte(ANode.Stream, ID_SOAP_BIN_TYPE_PARAM);
StreamWriteLongString(ANode.Stream, AName);
StreamWriteByte(ANode.Stream, ID_SOAP_BIN_TYPE_STRING);
StreamWriteByte(ANode.Stream, ID_SOAP_BIN_TYPE_ANSISTRING);
StreamWriteCardinal(ANode.Stream, Length(LValue));
if length(LValue) > 0 then
begin
Expand Down

0 comments on commit 8bf04e7

Please sign in to comment.