tools/jprof/intcnt.h
author Mantaroh Yoshinaga <mantaroh@gmail.com>
Fri, 13 Oct 2017 09:46:39 +0900
changeset 385979 0466471b9f67aa6a60bf3fb98515532e8a53095d
parent 129337 931e85b3d576d5971e7c02896dade6ce9a57fc44
child 448947 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1185236 - Shorten print job name when GTK version is older than 3.18.2. r=karlt Since GTK 3.18.2, GTK allows setting job name with more than 255 bytes. As result, CUPS received the IPP error. (RFC 2911, Section 4.3.1) This patch will shorten print job name, if runtime GTK version is older than 3.18.2. MozReview-Commit-ID: EfB87Bvo6hX

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef INTCNT_H
#define INTCNT_H

class IntCount
{
public:
    IntCount();
    ~IntCount();
    void clear();
    int countAdd(int index, int increment=1);
    int countGet(int index);
    int getSize();
    int getCount(int pos);
    int getIndex(int pos);

    IntCount(const IntCount&old)
    {
      numInts = old.numInts;
      if (numInts > 0) {
        iPair = new IntPair[numInts];
        for (int i = 0; i < numInts; i++) {
          iPair[i] = old.iPair[i];
        }
      } else {
        iPair = nullptr;
      }
    }
private:

    int    numInts;
    struct IntPair{int idx; int cnt;} *iPair;
};

#endif