Re: [PATCH 3/4] kms++util: Add verification module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/12/17 18:13, Kieran Bingham wrote:

+void save_raw_frame(IFramebuffer& fb, const char *filename)
+{
+    unique_ptr<ofstream> os;
+    os = unique_ptr<ofstream>(new ofstream(filename, ofstream::binary));
+
+    for (unsigned i = 0; i < fb.num_planes(); ++i)
+        os->write((char*)fb.map(i), fb.size(i));
+}

You don't need any of that unique_ptr stuff here. I needed it as the code needed
to handle the case where we don't save, i.e. os = null.

Ah OK - I thought it was providing the hook up to automatically close the stream
at the end of the function.

I guess an explicit close would be just as clean :)

You don't need an explicit close. The ofstream instance will be destructed automatically, and thus the stream will be closed.

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux