[dw-free] 32bit support
[commit: http://hg.dwscoalition.org/dw-free/rev/066a9423390f]
http://bugs.dwscoalition.org/show_bug.cgi?id=1632
Add rudimentary 32 bit support to Dreamwidth.
Patch by
scsi.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1632
Add rudimentary 32 bit support to Dreamwidth.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/Entry.pm
- cgi-bin/ljprotocol.pl
- cgi-bin/modperl_subs.pl
- doc/config-private.pl.txt
-------------------------------------------------------------------------------- diff -r f831f9f3a42a -r 066a9423390f cgi-bin/LJ/Entry.pm --- a/cgi-bin/LJ/Entry.pm Sat Jan 09 00:43:59 2010 +0000 +++ b/cgi-bin/LJ/Entry.pm Sat Jan 09 01:10:00 2010 +0000 @@ -1329,9 +1329,9 @@ sub get_log2_row $row = LJ::MemCache::get($memkey); if ($row) { - @$item{'posterid', 'eventtime', 'logtime', 'allowmask', 'ditemid'} = unpack("NNNQN", $row); + @$item{'posterid', 'eventtime', 'logtime', 'allowmask', 'ditemid'} = unpack($LJ::LOGMEMCFMT, $row); $item->{'security'} = ($item->{'allowmask'} == 0 ? 'private' : - ($item->{'allowmask'} == 2**63 ? 'public' : 'usemask')); + ($item->{'allowmask'} == $LJ::PUBLICBIT ? 'public' : 'usemask')); $item->{'journalid'} = $jid; @$item{'jitemid', 'anum'} = ($item->{'ditemid'} >> 8, $item->{'ditemid'} % 256); $item->{'eventtime'} = LJ::mysql_time($item->{'eventtime'}, 1); @@ -1355,13 +1355,13 @@ sub get_log2_row my ($sec, $eventtime, $logtime); $sec = $item->{'allowmask'}; $sec = 0 if $item->{'security'} eq 'private'; - $sec = 2**63 if $item->{'security'} eq 'public'; + $sec = $LJ::PUBLICBIT if $item->{'security'} eq 'public'; $eventtime = LJ::mysqldate_to_time($item->{'eventtime'}, 1); $logtime = LJ::mysqldate_to_time($item->{'logtime'}, 1); # note: this cannot distinguish between security == private and security == usemask with allowmask == 0 (no groups) # both should have the same display behavior, but we don't store the security value in memcache - $row = pack("NNNQN", $item->{'posterid'}, $eventtime, $logtime, $sec, + $row = pack($LJ::LOGMEMCFMT, $item->{'posterid'}, $eventtime, $logtime, $sec, $item->{'ditemid'}); LJ::MemCache::set($memkey, $row); @@ -1425,11 +1425,11 @@ sub get_log2_recent_log my $n = (length($rows) - 5)/24; for (my $i=0; $i<$n; $i++) { my ($posterid, $eventtime, $rlogtime, $allowmask, $ditemid) = - unpack("NNNQN", substr($rows, $i*24+5, 24)); + unpack($LJ::LOGMEMCFMT, substr($rows, $i*24+5, 24)); next if $notafter and $rlogtime > $notafter; $eventtime = LJ::mysql_time($eventtime, 1); my $security = $allowmask == 0 ? 'private' : - ($allowmask == 2**63 ? 'public' : 'usemask'); + ($allowmask == $LJ::PUBLICBIT ? 'public' : 'usemask'); my ($jitemid, $anum) = ($ditemid >> 8, $ditemid % 256); my $item = {}; @$item{'posterid','eventtime','rlogtime','allowmask','ditemid', @@ -1526,11 +1526,11 @@ sub get_log2_recent_log my ($sec, $ditemid, $eventtime, $logtime); $sec = $item->{'allowmask'}; $sec = 0 if $item->{'security'} eq 'private'; - $sec = 2**63 if $item->{'security'} eq 'public'; + $sec = $LJ::PUBLICBIT if $item->{'security'} eq 'public'; $ditemid = $item->{'jitemid'}*256 + $item->{'anum'}; $eventtime = LJ::mysqldate_to_time($item->{'eventtime'}, 1); - $rows .= pack("NNNQN", + $rows .= pack($LJ::LOGMEMCFMT, $item->{'posterid'}, $eventtime, $item->{'rlogtime'}, diff -r f831f9f3a42a -r 066a9423390f cgi-bin/ljprotocol.pl --- a/cgi-bin/ljprotocol.pl Sat Jan 09 00:43:59 2010 +0000 +++ b/cgi-bin/ljprotocol.pl Sat Jan 09 01:10:00 2010 +0000 @@ -1884,9 +1884,9 @@ sub editevent # update memcached my $sec = $qallowmask; $sec = 0 if $security eq 'private'; - $sec = 2**63 if $security eq 'public'; + $sec = $LJ::PUBLICBIT if $security eq 'public'; - my $row = pack("NNNQN", $oldevent->{'posterid'}, + my $row = pack($LJ::LOGMEMCFMT, $oldevent->{'posterid'}, LJ::mysqldate_to_time($eventtime, 1), LJ::mysqldate_to_time($oldevent->{'logtime'}, 1), $sec, diff -r f831f9f3a42a -r 066a9423390f cgi-bin/modperl_subs.pl --- a/cgi-bin/modperl_subs.pl Sat Jan 09 00:43:59 2010 +0000 +++ b/cgi-bin/modperl_subs.pl Sat Jan 09 01:10:00 2010 +0000 @@ -23,7 +23,22 @@ use Apache2::ServerUtil (); use Apache2::ServerUtil (); use LJ::Config; -BEGIN { LJ::Config->load; } + +BEGIN { + LJ::Config->load; + + # now that configuration is loaded, setup arch specific stuff + if ( $LJ::ARCH32 ) { + $LJ::ARCH = 32; + $LJ::LOGMEMCFMT = 'NNNLN'; + $LJ::PUBLICBIT = 2 ** 31; + } else { + $LJ::ARCH32 = 0; + $LJ::ARCH = 64; + $LJ::LOGMEMCFMT = 'NNNQN'; + $LJ::PUBLICBIT = 2 ** 63; + } +} use Apache::LiveJournal; use Apache::BML; diff -r f831f9f3a42a -r 066a9423390f doc/config-private.pl.txt --- a/doc/config-private.pl.txt Sat Jan 09 00:43:59 2010 +0000 +++ b/doc/config-private.pl.txt Sat Jan 09 01:10:00 2010 +0000 @@ -50,6 +50,14 @@ pass => 'password', # CHANGETHIS }, ); + + # 32 vs 64 bit arch. By default everything goes to a 64 bit arch. Uncomment + # to enable 32 bit arch support. + # + # WARNING: This must be set prior to setting up your site. If you change it + # later on a running site, things may go badly for you. + # + #$ARCH32 = "1"; # allow changelog posting. this allows unauthenticated posts to the changelog # community from the IP and users specified. this does not work on its own, --------------------------------------------------------------------------------