Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimal 'x' flag to pack() #2908

Closed
p6rt opened this issue Oct 3, 2012 · 6 comments
Closed

Add minimal 'x' flag to pack() #2908

p6rt opened this issue Oct 3, 2012 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 3, 2012

Migrated from rt.perl.org#115120 (status was 'resolved')

Searchable as RT115120$

@p6rt
Copy link
Author

p6rt commented Oct 3, 2012

From @supernovus

Find patch attached.

@p6rt
Copy link
Author

p6rt commented Oct 3, 2012

From @supernovus

0001-Added-x-to-pack.patch
From ca22aec9d4133ebca75c5504c2c0896e97b92f83 Mon Sep 17 00:00:00 2001
From: Timothy Totten <2010@huri.net>
Date: Mon, 1 Oct 2012 09:50:11 -0700
Subject: [PATCH] Added 'x' to pack.

---
 src/core/Buf.pm |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/core/Buf.pm b/src/core/Buf.pm
index 1e47609..ec3dd49 100644
--- a/src/core/Buf.pm
+++ b/src/core/Buf.pm
@@ -239,6 +239,15 @@ multi sub pack(Str $template, *@items) {
                 }
                 @bytes.push: map { :16($_) }, $hexstring.comb(/../);
             }
+            when 'x' {
+                if $amount eq '*' {
+                    $amount = 0;
+                }
+                elsif $amount eq '' {
+                    $amount = 1;
+                }
+                @bytes.push: 0x00 xx $amount;
+            }
             when 'C' {
                 my $number = shift(@items);
                 @bytes.push: $number % 0x100;
-- 
1.7.10.4

@p6rt
Copy link
Author

p6rt commented Oct 12, 2012

From @supernovus

I have added 3 new tests to the S32-str/pack.t test file in 'roast'
that test the functionality of this patch.

@p6rt
Copy link
Author

p6rt commented Oct 14, 2012

From @coke

This patch was applied by moritz++ and the OP supplied tests.

Closing ticket.

--
Will "Coke" Coleda

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 14, 2012

From @coke

This patch was applied by moritz++ and the OP supplied tests.

Closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 14, 2012

@coke - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Oct 14, 2012
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant