Skip to content

Commit

Permalink
Fix bz2 compilation on Silverlight/Android/WP7.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhardy committed May 6, 2012
1 parent 4b95a03 commit 0938201
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Languages/IronPython/IronPython.Modules/bz2/BZ2Compressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Ionic.BZip2;
using IronPython.Runtime;
using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;

namespace IronPython.Modules.Bz2 {
public static partial class Bz2Module {
Expand Down Expand Up @@ -87,7 +88,12 @@ private byte[] GetLatestData() {

byte[] result = new byte[newDataCount];
if (newDataCount > 0) {
#if !SILVERLIGHT && !WP75
Array.Copy(this.output.GetBuffer(), this.lastPosition, result, 0, newDataCount);
#else
Array.Copy(this.output.GetBuffer(), (int)this.lastPosition, result, 0, (int)newDataCount);
#endif

this.lastPosition = this.output.Position;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ public Bytes unused_data {

var unusedCount = this.input.Length - this.lastSuccessfulPosition;
var unused = new byte[unusedCount];

#if !SILVERLIGHT && !WP75
Array.Copy(buffer, this.lastSuccessfulPosition, unused, 0, unusedCount);
#else
Array.Copy(buffer, (int)this.lastSuccessfulPosition, unused, 0, (int)unusedCount);
#endif

return new Bytes(unused);
}
Expand Down
1 change: 1 addition & 0 deletions Languages/IronPython/IronPython.Modules/bz2/BZ2File.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using IronPython.Runtime;
using Microsoft.Scripting.Runtime;
using IronPython.Runtime.Operations;
using Microsoft.Scripting.Utils;

namespace IronPython.Modules.Bz2 {
public static partial class Bz2Module {
Expand Down
1 change: 1 addition & 0 deletions Languages/IronPython/IronPython.Modules/bz2/BZ2Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using IronPython.Runtime;
using Microsoft.Scripting.Runtime;
using IronPython.Runtime.Operations;
using Microsoft.Scripting.Utils;

[assembly: PythonModule("bz2", typeof(IronPython.Modules.Bz2.Bz2Module))]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,12 @@ private void TraceOutput(TraceBits bits, string format, params object[] varParam
//lock(outputLock)
{
int tid = System.Threading.Thread.CurrentThread.GetHashCode();
#if !SILVERLIGHT && !NETCF
#if FEATURE_FULL_CONSOLE
Console.ForegroundColor = (ConsoleColor) (tid % 8 + 10);
#endif
Console.Write("{0:000} PBOS ", tid);
Console.WriteLine(format, varParams);
#if !SILVERLIGHT && !NETCF
#if FEATURE_FULL_CONSOLE
Console.ResetColor();
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ namespace Ionic.Crc
/// archive files.
/// </remarks>

[Interop.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000C")]
[Interop.ComVisible(true)]
#if !NETCF
[Interop.ClassInterface(Interop.ClassInterfaceType.AutoDispatch)]
#endif
public class CRC32
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,12 @@ private void TraceOutput(TraceBits bits, string format, params object[] varParam
lock(outputLock)
{
int tid = Thread.CurrentThread.GetHashCode();
#if !SILVERLIGHT
#if FEATURE_FULL_CONSOLE
Console.ForegroundColor = (ConsoleColor) (tid % 8 + 10);
#endif
Console.Write("{0:000} PBOS ", tid);
Console.WriteLine(format, varParams);
#if !SILVERLIGHT
#if FEATURE_FULL_CONSOLE
Console.ResetColor();
#endif
}
Expand Down

0 comments on commit 0938201

Please sign in to comment.