Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Fix compile error #25

Open
wants to merge 2 commits into
base: release_0.5
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Naiad/CodeGeneration/AutoSerialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* See the Apache Version 2.0 License for specific language governing
* permissions and limitations under the License.
*/
//#define FIXED_STRING_SERIALIZATION
// #define FIXED_STRING_SERIALIZATION
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
Expand Down Expand Up @@ -1193,7 +1193,7 @@ private IEnumerable<CodeStatement> GenerateStringSerializeInstructions(
stringStmts.Add(Stmt(string.Format("fixed (char* {0} = {1})", stringPtrVar, stringAliasVar) +
"{"));

stringStmts.Add(Decl(sourceCharPtr, typeof(char*), Var(stringPtrVar)));
stringStmts.Add(Decl(sourceCharPtr, typeof(char).MakePointerType(), Var(stringPtrVar)));
#endif

string iterationVar = this.GenerateTempVariableName("iteration");
Expand Down Expand Up @@ -1239,7 +1239,7 @@ private IEnumerable<CodeStatement> GenerateStringDeserializeInstructions(CodeVar
List<CodeStatement> stringStmts = new List<CodeStatement>();

stringStmts.Add(Assign(toDeserialize,
new CodeObjectCreateExpression(typeof(string), new CodeCastExpression(typeof(char*), currentPosition), Expr("0"), Var(lengthVar))));
new CodeObjectCreateExpression(typeof(string), new CodeCastExpression(typeof(char).MakePointerType(), currentPosition), Expr("0"), Var(lengthVar))));

stringStmts.Add(Assign(currentPosition, new CodeBinaryOperatorExpression(currentPosition, CodeBinaryOperatorType.Add, BinOp(Var(lengthVar), CodeBinaryOperatorType.Multiply, Expr("sizeof(char)")))));
stringStmts.Add(Assign(bytesRemaining, new CodeBinaryOperatorExpression(bytesRemaining, CodeBinaryOperatorType.Subtract, BinOp(Var(lengthVar), CodeBinaryOperatorType.Multiply, Expr("sizeof(char)")))));
Expand Down