Comment: | Use OFString as much as possible. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
67066be692234b27a0dd9cad0c094f37 |
User & Date: | js on 2009-05-15 20:01:54 |
Other Links: | manifest | tags |
2009-05-15
| ||
22:59 | As we memset our ivars to 0, get rid of some useless ivar inits. check-in: 4c6d6c56ac user: js tags: trunk | |
20:01 | Use OFString as much as possible. check-in: 67066be692 user: js tags: trunk | |
2009-05-14
| ||
14:24 | Get rid of OFNotInSetException. check-in: bdc9b3219f user: js tags: trunk | |
Modified src/OFExceptions.h from [046ef80792] to [97d15662b8].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | + | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" #import "OFString.h" /** * An exception indicating an object could not be allocated. * * This exception is preallocated, as if there's no memory, no exception can * be allocated of course. That's why you shouldn't and even can't deallocate *it. |
︙ | |||
27 28 29 30 31 32 33 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - + - + - - + + | { Class isa; } + (Class)class; /** |
︙ | |||
65 66 67 68 69 70 71 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | - + - + | /** * \return The class of the object in which the exception happened */ - (Class)inClass; /** |
︙ | |||
217 218 219 220 221 222 223 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | - - + + - - + + - - + + - - + + - - + + - + - + - + - + | @end /** * An OFException indicating the file couldn't be opened. */ @interface OFOpenFileFailedException: OFException { |
︙ | |||
363 364 365 366 367 368 369 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | - - - - - - - - - + + + - - + + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - + - + - + - + | /** * An OFException indicating an attempt to connect or bind an already connected * or bound socket. */ @interface OFAlreadyConnectedException: OFException {} @end |
︙ |
Modified src/OFExceptions.m from [89c27be317] to [55ea187f4c].
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + - + - + - - + - + | @implementation OFAllocFailedException + (Class)class { return self; } |
︙ | |||
106 107 108 109 110 111 112 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + - + + - - + + | self = [super initWithClass: class_]; req_size = size; return self; } |
︙ | |||
141 142 143 144 145 146 147 | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + - + + - - - - + + + + + | self = [super initWithClass: class_]; pointer = ptr; return self; } |
︙ | |||
178 179 180 181 182 183 184 | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | - + - + + - - + + + - + - + + - + + | self = [super initWithClass: class_]; selector = selector_; return self; } |
︙ | |||
220 221 222 223 224 225 226 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | - + - + + - - + + + - + - + + - - + + - + - + + - + + - + - + + - + + - - + + - - + + - - + + - + - - + - - + - + + - - + + + + - + - + | self = [super initWithClass: class_]; selector = selector_; return self; } |
︙ | |||
403 404 405 406 407 408 409 | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | - + - + + - - - + + + + + - - + + + - + - + + - - - + + + + + - - + + + - + - + + - - + + - + - + + - - + + - + - + + - - - + + + - - - - - - - - - - - - - + - - + + - - + + - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + - - - + + + - - - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | - (BOOL)hasNItems { return has_items; } @end @implementation OFReadFailedException |
︙ | |||
699 700 701 702 703 704 705 | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - + - + + - - + + + | backlog = backlog_; err = GET_SOCK_ERR; return self; } |
︙ | |||
731 732 733 734 735 736 737 | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | - + - + + - - + + + - + - + + - - - + + + + - + - + + - - + + + | self = [super initWithClass: class_]; err = GET_SOCK_ERR; return self; } |
Modified src/OFFile.h from [8b3e4349b5] to [0828962522].
︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | + - - + + - - + + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + | #include <sys/types.h> #else typedef int uid_t; typedef int gid_t; #endif #import "OFStream.h" #import "OFString.h" /** * The OFFile class provides functions to read, write and manipulate files. */ @interface OFFile: OFStream { FILE *fp; } /** |
︙ |
Modified src/OFFile.m from [57318981b1] to [c917d0f228].
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - - + + - + - + - + - + - + - + - - + + - + - - + + - + - - + + - + | #include <sys/stat.h> #endif #import "OFFile.h" #import "OFExceptions.h" @implementation OFFile |
︙ |
Modified src/OFMutableString.h from [2f469f9606] to [0dde8a8b94].
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + - + - + - + | */ - initWithCString: (const char*)str; /** * Initializes an already allocated OFMutableString from a format C string. * See printf for the format syntax. * |
Modified src/OFMutableString.m from [f3d57089d4] to [a4955aa6db].
︙ | |||
145 146 147 148 149 150 151 | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - + - + - + | } memcpy(string, str, length + 1); } return self; } |
︙ | |||
255 256 257 258 259 260 261 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | - + - - + + - - + + - + | toSize: length + strlength + 1]; memcpy(string + length, str, strlength + 1); length += strlength; return self; } |
︙ |
Modified src/OFPlugin.h from [2b644c907d] to [dcbe20abfe].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + - + | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" #import "OFString.h" /** * The OFPlugin class provides a system for loading plugins at runtime. */ @interface OFPlugin: OFObject { void *handle; } /** * Loads an OFPlugin from a file. * * \param path Path to the OFPlugin file. The suffix is appended automatically. * \return The loaded OFPlugin */ |
Modified src/OFPlugin.m from [0c45c3aa04] to [6ef03d99d0].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + - + | #include <string.h> #include <dlfcn.h> #import "OFPlugin.h" #import "OFExceptions.h" @implementation OFPlugin |
︙ |
Modified src/OFStream.h from [b001002c07] to [29bc7e1e05].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | + | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" #import "OFString.h" /** * The OFStream class provides a base class for different types of streams. */ @interface OFStream: OFObject { char *cache; |
︙ | |||
33 34 35 36 37 38 39 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - + - + - + - + - + | /** * Read until a newline or \0 occurs. * * If you want to use readNBytes afterwards again, you have to clear the cache * before and optionally get the cache before clearing it! * |
︙ |
Modified src/OFStream.m from [37d8c8f6d5] to [755dcbeaa4].
︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + - + + - - - + + + - + + + + + + + | - (size_t)readNBytes: (size_t)size intoBuffer: (char*)buf { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } |
︙ | |||
82 83 84 85 86 87 88 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - + - - - + + + - + + + + + + + | @throw e; } /* Look if there's a newline or \0 */ for (i = 0; i < len; i++) { if (OF_UNLIKELY(tmp[i] == '\n' || tmp[i] == '\0')) { @try { |
︙ | |||
140 141 142 143 144 145 146 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | - + - - + + | - (size_t)writeNBytes: (size_t)size fromBuffer: (const char*)buf { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } |
︙ |
Modified src/OFString.h from [7948d30ca4] to [3cfd596b43].
︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + - + - + - + | */ + stringWithCString: (const char*)str; /** * Creates a new OFMutableString from a format C string. * See printf for the format syntax. * |
︙ | |||
118 119 120 121 122 123 124 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | - + - + - + - - + + | */ - appendCString: (const char*)str; /** * Appends a formatted C string to the OFString. * See printf for the format syntax. * |
︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 | - + + + + | /** * Splits an OFString into an OFArray of OFStrings. * * \param delimiter The delimiter for splitting * \return An autoreleased OFArray with the splitted string */ |
Modified src/OFString.m from [5fed7eca62] to [dbcbcc49c8].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | - - + - + | #import "config.h" #include <stdarg.h> #include <stdlib.h> #include <string.h> #import "OFString.h" |
︙ | |||
123 124 125 126 127 128 129 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - + - - + + | - appendCString: (const char*)str { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } |
︙ | |||
154 155 156 157 158 159 160 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | - + + - + - + | - lower { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; } |
︙ |
Modified src/OFTCPSocket.h from [2683abb6c9] to [f1ec44f94b].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | + - - + + - - + + - + - - + + - - - + + + | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFSocket.h" #import "OFString.h" /** * The OFTCPSocket class provides functions to create and use sockets. */ @interface OFTCPSocket: OFSocket {} /** * \return A new autoreleased OFTCPSocket */ + tcpSocket; /** * Initializes an already allocated OFTCPSocket. * * \return An initialized OFTCPSocket */ - init; /** * Connect the OFTCPSocket to the specified destination. * |
︙ |
Modified src/OFTCPSocket.m from [713f66fbf8] to [9556eafe3a].
︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - - + + - - - - - - + - - - + + - - + + - - - + + + - - - - - - + + - - + - - - + + - - + + | { if (sock != INVALID_SOCKET) close(sock); [super dealloc]; } |
︙ |
Modified tests/OFDataArray/OFDataArray.m from [9fd6b5cc0c] to [ebf9c80b5a].
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | - + | @try { \ code; \ \ puts("NOT CAUGHT!"); \ return 1; \ } @catch (exception *e) { \ puts("CAUGHT! Error string was:"); \ |
︙ |
Modified tests/OFDictionary/OFDictionary.m from [3731d42c29] to [871e28ae32].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - | #include <stdio.h> #include <string.h> #import "OFAutoreleasePool.h" #import "OFDictionary.h" #import "OFIterator.h" |
︙ |
Modified tests/OFHashes/OFHashes.m from [0de7e8a2b0] to [4ae6911129].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - - + + | main() { char buf[64]; size_t len; OFMD5Hash *md5 = [OFMD5Hash md5Hash]; OFSHA1Hash *sha1 = [OFSHA1Hash sha1Hash]; |
︙ |
Modified tests/OFObject/OFObject.m from [020015e81a] to [80756659a6].
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | - + | @try { \ code; \ \ puts("NOT CAUGHT!"); \ return 1; \ } @catch (exception *e) { \ puts("CAUGHT! Error string was:"); \ |
︙ |
Modified tests/OFPlugin/OFPlugin.m from [4ca81ff021] to [dfdf5ba72e].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | #import "TestPlugin/TestPlugin.h" int main() { TestPlugin *plugin; |
Modified tests/OFString/OFString.m from [a3755365c5] to [3302635bae].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - | #import "config.h" #include <stdio.h> #include <string.h> #import "OFString.h" |
︙ | |||
66 67 68 69 70 71 72 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | - + + | s3 = [s1 copy]; CHECK([s1 isEqual: s3]) CHECK(![s1 isEqual: [[OFObject alloc] init]]) CHECK([s1 hash] == [s3 hash]) |
︙ | |||
91 92 93 94 95 96 97 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | - + - + - + | OFInvalidEncodingException) s1 = [OFString stringWithCString: "äöü€𝄞"]; CHECK(!strcmp([[s1 reverse] cString], "𝄞€üöä")) [s1 dealloc]; /* Format tests */ |
Modified tests/OFTCPSocket/OFTCPSocket.m from [a265aae238] to [2d157422ed].
︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | + + - - - + + + - - + + - + + - - - + + + - - + + - + - + | return port; } int main() { uint16_t port; OFString *service; srand(time(NULL)); @try { OFTCPSocket *server = [OFTCPSocket tcpSocket]; OFTCPSocket *client = [OFTCPSocket tcpSocket]; OFTCPSocket *accepted; char buf[7]; puts("== IPv4 =="); port = get_port(); service = [OFString stringWithFormat: @"%d", port]; |
Modified tests/OFThread/OFThread.m from [dfe628bf94] to [970ee61a34].
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | */ #import "config.h" #include <stdio.h> #import "OFThread.h" |
︙ |