uppsrc_IconDes.diff

Proposed patch for uppsrc/IconDes files (since 13633 revision) - Sender Ghost, 10/09/2019 04:53 AM

Download (2.93 KB)

View differences:

uppsrc/IconDes/ImlFile.cpp
185 185
	}
186 186
}
187 187

  
188
String ImlEOL("\r\n");
189

  
188 190
bool LoadIml(const String& data, Array<ImlImage>& img, int& format)
189 191
{
192
	ImlEOL = "\r\n";
193
	int q = data.ReverseFind("\n");
194
	if(q >= 0) {
195
		if(data.Mid(q - 1, 1) != "\r")
196
			ImlEOL = "\n";
197
	}
198
#if 0
199
	else if(data.ReverseFind("\r") >= 0)
200
		ImlEOL = "\r";
201
#endif
190 202
	CParser p(data);
191 203
	format = 0;
192 204
	try {
......
277 289
	int64 start = out.GetPos();
278 290
	while(b < e) {
279 291
		if(split && out.GetPos() >= start + 200u) {
280
			out.Put("\"\r\n\t\"");
292
			out << "\"" << ImlEOL << "\t\"";
281 293
			start = out.GetPos();
282 294
		}
283 295
		if((byte)*b >= ' ' && *b != '\x7F' && *b != '\xFF') {
......
299 311
		for(int i = 0; i < iml.GetCount(); i++) {
300 312
			const ImlImage& c = iml[i];
301 313
			if(c.exp)
302
				out << "IMAGE_META(\"exp\", \"\")\r\n";
314
				out << "IMAGE_META(\"exp\", \"\")" << ImlEOL;
303 315
			String name = c.name;
304 316
			Image buffer = c.image;
305 317
			if(IsNull(name))
......
314 326
						out.PutLine("\tIMAGE_SCAN(\"\")");
315 327
					out.Put("\tIMAGE_SCAN(");
316 328
					PutOctalString(out, scan.Begin(), scan.End(), true);
317
					out.Put(")\r\n");
329
					out << ")" << ImlEOL;
318 330
					last = i + 1;
319 331
				}
320 332
			}
......
331 343
			ASSERT(!datastrm.IsError());
332 344
			String s = datastrm.GetResult();
333 345
			PutOctalString(out, s.Begin(), s.End());
334
			out.Put(")\r\n");
346
			out << ")" << ImlEOL;
335 347
		}
336 348
	}
337 349
	else {
338
		out << "PREMULTIPLIED\r\n";
350
		out << "PREMULTIPLIED" << ImlEOL;
339 351
		Index<String> std_name;
340 352
		for(int i = 0; i < iml.GetCount(); i++) {
341 353
			const ImlImage& c = iml[i];
......
351 363
				out << "__DARK";
352 364
			out << ")";
353 365
			if(c.exp)
354
				out << " IMAGE_META(\"exp\", \"\")\r\n";
355
			out << "\r\n";
366
				out << " IMAGE_META(\"exp\", \"\")" << ImlEOL;
367
			out << ImlEOL;
356 368
		}
357 369
		int ii = 0;
358 370
		while(ii < iml.GetCount()) {
......
372 384
				bn++;
373 385
			}
374 386
			String bs = PackImlData(bimg);
375
			out << "\r\nIMAGE_BEGIN_DATA\r\n";
387
			out << ImlEOL << "IMAGE_BEGIN_DATA" << ImlEOL;
376 388
			bs.Cat(0, ((bs.GetCount() + 31) & ~31) - bs.GetCount());
377 389
			const byte *s = bs;
378 390
			for(int n = bs.GetCount() / 32; n--;) {
......
381 393
					if(j) out << ',';
382 394
					out << (int)*s++;
383 395
				}
384
				out << ")\r\n";
396
				out << ")" << ImlEOL;
385 397
			}
386
			out << "IMAGE_END_DATA(" << bs.GetCount() << ", " << bn << ")\r\n";
398
			out << "IMAGE_END_DATA(" << bs.GetCount() << ", " << bn << ")" << ImlEOL;
387 399
		}
388 400
	}
389 401
	return out.GetResult();