Skip to content

Commit e2c1fba

Browse files
author
Andreas Sandberg
committed
Removing explicit charset param
1 parent 38319b2 commit e2c1fba

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

CSSParser.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($sText, $sDefaultCharset = 'utf-8') {
3030

3131
public function setCharset($sCharset) {
3232
$this->sCharset = $sCharset;
33-
$this->iLength = $this->strlen($this->sText, $this->sCharset);
33+
$this->iLength = $this->strlen($this->sText);
3434
}
3535

3636
public function getCharset() {
@@ -168,7 +168,7 @@ private function parseCharacter($bIsForIdentifier) {
168168
return $this->consume(1);
169169
}
170170
$sUnicode = $this->consumeExpression('/^[0-9a-fA-F]{1,6}/u');
171-
if($this->strlen($sUnicode, $this->sCharset) < 6) {
171+
if($this->strlen($sUnicode) < 6) {
172172
//Consume whitespace after incomplete unicode escape
173173
if(preg_match('/\\s/isSu', $this->peek())) {
174174
if($this->comes('\r\n')) {
@@ -356,15 +356,15 @@ private function parseColorValue() {
356356
if($this->comes('#')) {
357357
$this->consume('#');
358358
$sValue = $this->parseIdentifier(false);
359-
if($this->strlen($sValue, $this->sCharset) === 3) {
359+
if($this->strlen($sValue) === 3) {
360360
$sValue = $sValue[0].$sValue[0].$sValue[1].$sValue[1].$sValue[2].$sValue[2];
361361
}
362362
$aColor = array('r' => new CSSSize(intval($sValue[0].$sValue[1], 16), null, true), 'g' => new CSSSize(intval($sValue[2].$sValue[3], 16), null, true), 'b' => new CSSSize(intval($sValue[4].$sValue[5], 16), null, true));
363363
} else {
364364
$sColorMode = $this->parseIdentifier(false);
365365
$this->consumeWhiteSpace();
366366
$this->consume('(');
367-
$iLength = $this->strlen($sColorMode, $this->sCharset);
367+
$iLength = $this->strlen($sColorMode);
368368
for($i=0;$i<$iLength;$i++) {
369369
$this->consumeWhiteSpace();
370370
$aColor[$sColorMode[$i]] = $this->parseNumericValue(true);
@@ -406,27 +406,27 @@ private function peek($iLength = 1, $iOffset = 0) {
406406
return '';
407407
}
408408
if(is_string($iLength)) {
409-
$iLength = $this->strlen($iLength, $this->sCharset);
409+
$iLength = $this->strlen($iLength);
410410
}
411411
if(is_string($iOffset)) {
412-
$iOffset = $this->strlen($iOffset, $this->sCharset);
412+
$iOffset = $this->strlen($iOffset);
413413
}
414-
return $this->substr($this->sText, $this->iCurrentPosition+$iOffset, $iLength, $this->sCharset);
414+
return $this->substr($this->sText, $this->iCurrentPosition+$iOffset, $iLength);
415415
}
416416

417417
private function consume($mValue = 1) {
418418
if(is_string($mValue)) {
419-
$iLength = $this->strlen($mValue, $this->sCharset);
420-
if($this->substr($this->sText, $this->iCurrentPosition, $iLength, $this->sCharset) !== $mValue) {
419+
$iLength = $this->strlen($mValue);
420+
if($this->substr($this->sText, $this->iCurrentPosition, $iLength) !== $mValue) {
421421
throw new Exception("Expected $mValue, got ".$this->peek(5));
422422
}
423-
$this->iCurrentPosition += $this->strlen($mValue, $this->sCharset);
423+
$this->iCurrentPosition += $this->strlen($mValue);
424424
return $mValue;
425425
} else {
426426
if($this->iCurrentPosition+$mValue > $this->iLength) {
427427
throw new Exception("Tried to consume $mValue chars, exceeded file end");
428428
}
429-
$sResult = $this->substr($this->sText, $this->iCurrentPosition, $mValue, $this->sCharset);
429+
$sResult = $this->substr($this->sText, $this->iCurrentPosition, $mValue);
430430
$this->iCurrentPosition += $mValue;
431431
return $sResult;
432432
}
@@ -470,7 +470,7 @@ private function consumeUntil($sEnd) {
470470
}
471471

472472
private function inputLeft() {
473-
return $this->substr($this->sText, $this->iCurrentPosition, -1, $this->sCharset);
473+
return $this->substr($this->sText, $this->iCurrentPosition, -1);
474474
}
475475

476476
private function substr($string, $start, $length){

0 commit comments

Comments
 (0)